[PATCH] hyperv_fb: Add support for Gen2 VM
This patch enables Hyper-V FB driver to run on Gen2 VM. The Gen2 VM provides MMIO area for synthetic video from ACPI module, which is exported by vmbus. The generic video is provided by UEFI. PCI video in Gen1 is no longer available. To support synthetic video on Hyper-V Gen2 VM, this patch updated code related to the changes above. Signed-off-by: Haiyang Zhang Reviewed-by: K. Y. Srinivasan --- drivers/video/hyperv_fb.c | 60 ++-- 1 files changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index bbcc8c0..5db1f20 100644 --- a/drivers/video/hyperv_fb.c +++ b/drivers/video/hyperv_fb.c @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -461,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev) goto error; } - if (par->synthvid_version == SYNTHVID_VERSION_WIN7) { + if (par->synthvid_version == SYNTHVID_VERSION_WIN7) screen_depth = SYNTHVID_DEPTH_WIN7; - screen_fb_size = SYNTHVID_FB_SIZE_WIN7; - } else { + else screen_depth = SYNTHVID_DEPTH_WIN8; - screen_fb_size = SYNTHVID_FB_SIZE_WIN8; - } + + screen_fb_size = hdev->channel->offermsg.offer. + mmio_megabytes * 1024 * 1024; return 0; @@ -635,22 +636,33 @@ static void hvfb_get_option(struct fb_info *info) /* Get framebuffer memory from Hyper-V video pci space */ static int hvfb_getmem(struct fb_info *info) { - struct pci_dev *pdev; + struct pci_dev *pdev = NULL; ulong fb_phys; void __iomem *fb_virt; + bool gen2vm = efi_enabled(EFI_BOOT); - pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, + if (gen2vm) { + if (!hyperv_mmio_start || hyperv_mmio_size < screen_fb_size) { + pr_err("Unable to find ACPI MMIO area\n"); + return -ENODEV; + } + + fb_phys = hyperv_mmio_start; + } else { + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_HYPERV_VIDEO, NULL); - if (!pdev) { - pr_err("Unable to find PCI Hyper-V video\n"); - return -ENODEV; - } + if (!pdev) { + pr_err("Unable to find PCI Hyper-V video\n"); + return -ENODEV; + } - if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || - pci_resource_len(pdev, 0) < screen_fb_size) - goto err1; + if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || + pci_resource_len(pdev, 0) < screen_fb_size) + goto err1; + + fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; + } - fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1; if (!request_mem_region(fb_phys, screen_fb_size, KBUILD_MODNAME)) goto err1; @@ -662,14 +674,22 @@ static int hvfb_getmem(struct fb_info *info) if (!info->apertures) goto err3; - info->apertures->ranges[0].base = pci_resource_start(pdev, 0); - info->apertures->ranges[0].size = pci_resource_len(pdev, 0); + if (gen2vm) { + info->apertures->ranges[0].base = screen_info.lfb_base; + info->apertures->ranges[0].size = screen_info.lfb_size; + } else { + info->apertures->ranges[0].base = pci_resource_start(pdev, 0); + info->apertures->ranges[0].size = pci_resource_len(pdev, 0); + } + info->fix.smem_start = fb_phys; info->fix.smem_len = screen_fb_size; info->screen_base = fb_virt; info->screen_size = screen_fb_size; - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return 0; err3: @@ -677,7 +697,9 @@ err3: err2: release_mem_region(fb_phys, screen_fb_size); err1: - pci_dev_put(pdev); + if (!gen2vm) + pci_dev_put(pdev); + return -ENOMEM; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] imx-drm: imx-drm-core: Remove unused 'imxdrm' variable
From: Fabio Estevam Since commit 020a9ea7c2 (imx-drm: imx-drm-core: avoid going the long route round for drm_device) the 'imxdrm' variable is not used anymore, which causes the following build warning: drivers/staging/imx-drm/imx-drm-core.c:87:25: warning: unused variable 'imxdrm' [-Wunused-variable] Just remove it. Signed-off-by: Fabio Estevam --- drivers/staging/imx-drm/imx-drm-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 236ed66..573fe88 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -84,8 +84,6 @@ static void imx_drm_driver_lastclose(struct drm_device *drm) static int imx_drm_driver_unload(struct drm_device *drm) { - struct imx_drm_device *imxdrm = drm->dev_private; - imx_drm_device_put(); drm_vblank_cleanup(drm); -- 1.8.1.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] imx-drm: imx-drm-core: Remove unused 'imxdrm' variable
On Sat, Feb 08, 2014 at 06:49:49PM -0200, Fabio Estevam wrote: > From: Fabio Estevam > > Since commit 020a9ea7c2 (imx-drm: imx-drm-core: avoid going the long route > round > for drm_device) the 'imxdrm' variable is not used anymore, which causes the > following build warning: > > drivers/staging/imx-drm/imx-drm-core.c:87:25: warning: unused variable > 'imxdrm' [-Wunused-variable] > > Just remove it. NAK. My later patches need this, so there wasn't any point removing it in previous patches. -- FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad. Estimate before purchase was "up to 13.2Mbit". ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
web development partnership
Hello, I would like to partner with your website to sell my company's web development services for a 20% commission. Please let me know if you're interested and I will send more info. Best regards, Nick Cosic ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH V4 1/1] Drivers: hv: Implement the file copy service
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Friday, February 07, 2014 3:17 PM > To: KY Srinivasan > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com > Subject: Re: [PATCH V4 1/1] Drivers: hv: Implement the file copy service > > On Tue, Jan 21, 2014 at 05:43:53PM -0800, K. Y. Srinivasan wrote: > > +/* > > + * Create a char device that can support read/write for passing > > + * the payload. > > + */ > > +static struct cdev fcopy_cdev; > > +static struct class *cl; > > +static struct device *sysfs_dev; > > Why not just be a misc device, you only want 1 minor number for a char > device: > > > +static int fcopy_dev_init(void) > > +{ > > + int result; > > + > > + result = alloc_chrdev_region(&fcopy_dev, 1, 1, "hv_fcopy"); > > See, one minor. > > > + if (result < 0) { > > + pr_err("Cannot get major number\n"); > > + return result; > > + } > > + > > + cl = class_create(THIS_MODULE, "chardev"); > > That's a _really_ generic name, come on, you know better than that. > > > + if (IS_ERR(cl)) { > > + pr_err("Error creating fcopy class.\n"); > > Your error string is wrong :( > > > + result = PTR_ERR(cl); > > + goto err_unregister; > > + } > > + > > + sysfs_dev = device_create(cl, NULL, fcopy_dev, "%s", "hv_fcopy"); > > A device at the root of sysfs? No, you have a bus to hang devices off > of, use that. What do you need this device for anyway? > > > + if (IS_ERR(sysfs_dev)) { > > + pr_err("Device creation failed\n"); > > + result = PTR_ERR(cl); > > + goto err_destroy_class; > > + } > > + > > + cdev_init(&fcopy_cdev, &fcopy_fops); > > + fcopy_cdev.owner = THIS_MODULE; > > + fcopy_cdev.ops = &fcopy_fops; > > + > > + result = cdev_add(&fcopy_cdev, fcopy_dev, 1); > > Ah, to get udev to pay attention to the char device, no, just use a misc > device, should make this whole code a lot simpler and more "obvious" as > to what you want/need. > > > + if (result) { > > + pr_err("Cannot cdev_add\n"); > > + goto err_destroy_device; > > + } > > + return result; > > + > > +err_destroy_device: > > + device_destroy(cl, fcopy_dev); > > +err_destroy_class: > > + class_destroy(cl); > > +err_unregister: > > + unregister_chrdev_region(fcopy_dev, 1); > > + return result; > > > Ugh, I hate the cdev interface, one of these days I'll fix it up, it's > so unwieldy... > > > +static void fcopy_dev_deinit(void) > > +{ > > + /* > > +* first kill the daemon. > > +*/ > > + if (dtp != NULL) > > + send_sig(SIGKILL, dtp, 0); > > We kill userspace daemon's from the kernel? That's a recipe for > disaster... > > Why? What does it matter here if the daemon keeps running, it should > fail gracefully if the character device is removed, right? If not, that > needs to be fixed anyway. Greg, Thanks for the detailed comments; I will address these in the next version. Regards, K. Y ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V5 1/1] Drivers: hv: Implement the file copy service
Implement the file copy service for Linux guests on Hyper-V. This permits the host to copy a file (over VMBUS) into the guest. This facility is part of "guest integration services" supported on the Windows platform. Here is a link that provides additional details on this functionality: http://technet.microsoft.com/en-us/library/dn464282.aspx In V1 version of the patch I have addressed comments from Olaf Hering and Dan Carpenter In V2 version of this patch I did some minor cleanup (making some globals static). In V4 version of the patch I have addressed all of Olaf's most recent set of comments/concerns. In this version of the patch I have addressed Greg's most recent comments. I would like to thank Greg for suggesting that I use misc device; it has significantly simplified the code. Signed-off-by: K. Y. Srinivasan --- drivers/hv/Makefile|2 +- drivers/hv/hv_fcopy.c | 388 drivers/hv/hv_util.c | 10 ++ include/linux/hyperv.h | 61 +++ tools/hv/hv_fcopy_daemon.c | 195 ++ 5 files changed, 655 insertions(+), 1 deletions(-) create mode 100644 drivers/hv/hv_fcopy.c create mode 100644 tools/hv/hv_fcopy_daemon.c diff --git a/drivers/hv/Makefile b/drivers/hv/Makefile index 0a74b56..5e4dfa4 100644 --- a/drivers/hv/Makefile +++ b/drivers/hv/Makefile @@ -5,4 +5,4 @@ obj-$(CONFIG_HYPERV_BALLOON)+= hv_balloon.o hv_vmbus-y := vmbus_drv.o \ hv.o connection.o channel.o \ channel_mgmt.o ring_buffer.o -hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o +hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o hv_fcopy.o diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c new file mode 100644 index 000..15cf35c --- /dev/null +++ b/drivers/hv/hv_fcopy.c @@ -0,0 +1,388 @@ +/* + * An implementation of file copy service. + * + * Copyright (C) 2014, Microsoft, Inc. + * + * Author : K. Y. Srinivasan + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIN8_SRV_MAJOR 1 +#define WIN8_SRV_MINOR 1 +#define WIN8_SRV_VERSION (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR) + +/* + * Global state maintained for transaction that is being processed. + * For a class of integration services, including the "file copy service", + * the specified protocol is a "request/response" protocol which means that + * there can only be single outstanding transaction from the host at any + * given point in time. We use this to simplify memory management in this + * driver - we cache and process only one message at a time. + * + * While the request/response protocol is guaranteed by the host, we further + * ensure this by serializing packet processing in this driver - we do not + * read additional packets from the VMBUs until the current packet is fully + * handled. + * + * The transaction "active" state is set when we receive a request from the + * host and we cleanup this state when the transaction is completed - when we + * respond to the host with our response. When the transaction active state is + * set, we defer handling incoming packets. + */ + +static struct { + bool active; /* transaction status - active or not */ + int recv_len; /* number of bytes received. */ + struct hv_fcopy_hdr *fcopy_msg; /* current message */ + struct hv_start_fcopy message; /* sent to daemon */ + struct vmbus_channel *recv_channel; /* chn we got the request */ + u64 recv_req_id; /* request ID. */ + void *fcopy_context; /* for the channel callback */ + struct semaphore read_sema; +} fcopy_transaction; + +static bool opened; /* currently device opened */ + +/* + * Before we can accept copy messages from the host, we need + * to handshake with the user level daemon. This state tracks + * if we are in the handshake phase. + */ +static bool in_hand_shake = true; +static void fcopy_send_data(void); +static void fcopy_respond_to_host(int error); +static void fcopy_work_func(struct work_struct *dummy); +static DECLARE_DELAYED_WORK(fcopy_work, fcopy_work_func); +static u8 *recv_buffer; + +static void fcopy_work_func(struct work_struct *dummy) +{ + /* +* If the timer fires, the user-mode component has not responded; +* process the pending transaction. +*/ + fcopy_respond_to_host(HV_E_FAIL); +} + +static int fcopy_handle_handshake(u32 version) +{ +
[PATCH 1/2] drivers:staging:rtl8821ae: Fixed few coding style erors and warnings
Fixed multiple coding style errors and warnings wifi.h:1077: WARNING: please, no space before tabs wifi.h:762: WARNING: missing space after struct definition wifi.h:972: WARNING: please, no spaces at the start of a line wifi.h:1825: WARNING: Unnecessary space after function pointer name wifi.h:1826: ERROR: "foo * bar" should be "foo *bar" wifi.h:1099: WARNING: missing space after return type wifi.h:1320: ERROR: Macros with complex values should be enclosed in parenthesis wifi.h:1758: WARNING: Multiple spaces after return type wifi.h:1855: ERROR: code indent should use tabs where possible wifi.h:2303: ERROR: space prohibited after that open parenthesis '(' wifi.h:2408: ERROR: spaces required around that '=' (ctx:VxV) Signed-off-by: Surendra Patil --- drivers/staging/rtl8821ae/wifi.h | 450 --- 1 file changed, 226 insertions(+), 224 deletions(-) diff --git a/drivers/staging/rtl8821ae/wifi.h b/drivers/staging/rtl8821ae/wifi.h index cfe88a1..5ad95b8 100644 --- a/drivers/staging/rtl8821ae/wifi.h +++ b/drivers/staging/rtl8821ae/wifi.h @@ -40,10 +40,10 @@ #define RF_CHANGE_BY_INIT 0 -#define RF_CHANGE_BY_IPS BIT(28) -#define RF_CHANGE_BY_PSBIT(29) -#define RF_CHANGE_BY_HWBIT(30) -#define RF_CHANGE_BY_SWBIT(31) +#define RF_CHANGE_BY_IPS BIT(28) +#define RF_CHANGE_BY_PSBIT(29) +#define RF_CHANGE_BY_HWBIT(30) +#define RF_CHANGE_BY_SWBIT(31) #define IQK_ADDA_REG_NUM 16 #define IQK_MAC_REG_NUM4 @@ -69,7 +69,7 @@ #define QBSS_LOAD_SIZE 5 #define MAX_WMMELE_LENGTH 64 -#define TOTAL_CAM_ENTRY32 +#define TOTAL_CAM_ENTRY32 /*slot time for 11g. */ #define RTL_SLOT_TIME_99 @@ -77,27 +77,27 @@ /*related with tcp/ip. */ /*if_ehther.h*/ -#define ETH_P_PAE 0x888E /*Port Access Entity +#define ETH_P_PAE 0x888E /*Port Access Entity *(IEEE 802.1X) */ -#define ETH_P_IP 0x0800 /*Internet Protocol packet */ -#define ETH_P_ARP 0x0806 /*Address Resolution packet */ -#define SNAP_SIZE 6 +#define ETH_P_IP 0x0800 /*Internet Protocol packet */ +#define ETH_P_ARP 0x0806 /*Address Resolution packet */ +#define SNAP_SIZE 6 #define PROTOC_TYPE_SIZE 2 /*related with 802.11 frame*/ -#define MAC80211_3ADDR_LEN 24 -#define MAC80211_4ADDR_LEN 30 +#define MAC80211_3ADDR_LEN 24 +#define MAC80211_4ADDR_LEN 30 #define CHANNEL_MAX_NUMBER (14 + 24 + 21) /* 14 is the max * channel number */ #define CHANNEL_MAX_NUMBER_2G 14 -#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to +#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to *"phy_GetChnlGroup8812A" and * "Hal_ReadTxPowerInfo8812A"*/ #define CHANNEL_MAX_NUMBER_5G_80M 7 #define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, ch4~9, ch10~14 * total three groups */ -#define MAX_PG_GROUP 13 +#define MAX_PG_GROUP 13 #defineCHANNEL_GROUP_MAX_2G3 #defineCHANNEL_GROUP_IDX_5GL 3 #defineCHANNEL_GROUP_IDX_5GM 6 @@ -119,7 +119,7 @@ #defineMAX_CHNL_GROUP_5G 14 /* BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. */ -#define MAX_TX_QUEUE 9 +#define MAX_TX_QUEUE 9 #define TX_PWR_BY_RATE_NUM_BAND2 #define TX_PWR_BY_RATE_NUM_RF 4 @@ -127,11 +127,11 @@ #define MAX_BASE_NUM_IN_PHY_REG_PG_24G 6 #define MAX_BASE_NUM_IN_PHY_REG_PG_5G 5 -#define DELTA_SWINGIDX_SIZE30 -#define BAND_NUM 3 +#define DELTA_SWINGIDX_SIZE30 +#define BAND_NUM 3 /*Now, it's just for 8192ee *not OK yet, keep it 0*/ -#define DMA_IS_64BIT 0 +#define DMA_IS_64BIT 0 #define RTL8192EE_SEG_NUM 1 /* 0:2 seg, 1: 4 seg, 2: 8 seg */ struct txpower_info_2g { @@ -219,7 +219,7 @@ enum hardware_type { }; enum scan_operation_backup_opt { - SCAN_OPT_BACKUP_BAND0=0, + SCAN_OPT_BACKUP_BAND0 = 0, SCAN_OPT_BACKUP_BAND1, SCAN_OPT_RESTORE, SCAN_OPT_MAX @@ -645,9 +645,9 @@ enum wireless_mode { }; enum ratr_table_mode { - RATR_INX_WIRELESS_NGB = 0, // BGN 40 Mhz 2SS 1SS - RATR_INX_WIRELESS_NG = 1, // GN or N - RATR_IN
[PATCH 2/2] vers:staging:rtl8821ae: Fixed multiple coding style erors and warnings
Fixed multiple coding style errors and warnings wifi.h:1077: WARNING: please, no space before tabs wifi.h:762: WARNING: missing space after struct definition wifi.h:972: WARNING: please, no spaces at the start of a line wifi.h:1825: WARNING: Unnecessary space after function pointer name wifi.h:1826: ERROR: "foo * bar" should be "foo *bar" wifi.h:1099: WARNING: missing space after return type wifi.h:1320: ERROR: Macros with complex values should be enclosed in parenthesis wifi.h:1758: WARNING: Multiple spaces after return type wifi.h:1855: ERROR: code indent should use tabs where possible wifi.h:2303: ERROR: space prohibited after that open parenthesis '(' wifi.h:2408: ERROR: spaces required around that '=' (ctx:VxV) Signed-off-by: Surendra Patil --- drivers/staging/rtl8821ae/wifi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8821ae/wifi.h b/drivers/staging/rtl8821ae/wifi.h index 5ad95b8..1e830e8 100644 --- a/drivers/staging/rtl8821ae/wifi.h +++ b/drivers/staging/rtl8821ae/wifi.h @@ -2403,9 +2403,9 @@ Set subfield of little-endian 4-byte value to specified value.*/ (_os).length = (_len); #define CP_MACADDR(des,src)\ - ((des)[0] = (src)[0],(des)[1] = (src)[1],\ - (des)[2] = (src)[2],(des)[3] = (src)[3],\ - (des)[4] = (src)[4],(des)[5] = (src)[5]) + ((des)[0] = (src)[0], (des)[1] = (src)[1],\ + (des)[2] = (src)[2], (des)[3] = (src)[3],\ + (des)[4] = (src)[4], (des)[5] = (src)[5]) static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) { -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] Lustre fixes
This is a set of patches that eliminates rest of crashes and most leaks hit during standard lustre regression testing for me. This serie + O_LOV_DELAY_CREATE patch from Andreas (that was submitted separately and needs separate approval: http://www.spinics.net/lists/linux-fsdevel/msg72386.html ) makes most of the sanity testing to also pass. Andrew Perepechko (1): lustre/xattr: separate ACL and XATTR caches Bobi Jam (1): lustre/lov: avoid subobj's coh_parent race John L. Hammond (1): lustre: don't leak llog handle in llog_cat_process_cb() Swapnil Pimpale (1): lustre: Unsafe error handling around ll_splice_alias yang sheng (1): lustre: instantiate negative dentry .../lustre/lustre/include/lustre/lustre_idl.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 - .../staging/lustre/lustre/llite/llite_internal.h | 7 -- drivers/staging/lustre/lustre/llite/namei.c| 15 ++- drivers/staging/lustre/lustre/llite/statahead.c| 9 +- drivers/staging/lustre/lustre/llite/xattr.c| 29 +++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 117 - drivers/staging/lustre/lustre/lov/lov_object.c | 10 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 4 + drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 9 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 30 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 3 +- 15 files changed, 100 insertions(+), 146 deletions(-) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] lustre: don't leak llog handle in llog_cat_process_cb()
From: "John L. Hammond" An early return from llog_cat_process_cb() was leaking the llog handle. Fix this by not doing that. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/7847 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4054 Reviewed-by: Andreas Dilger Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Mike Pershin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c0f3af7..1d999310 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -551,9 +551,8 @@ int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, if (rec->lrh_index < d->lpd_startcat) /* Skip processing of the logs until startcat */ - return 0; - - if (d->lpd_startidx > 0) { + rc = 0; + else if (d->lpd_startidx > 0) { struct llog_process_cat_data cd; cd.lpcd_first_idx = d->lpd_startidx; @@ -566,6 +565,7 @@ int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, rc = llog_process_or_fork(env, llh, d->lpd_cb, d->lpd_data, NULL, false); } + llog_handle_put(llh); return rc; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] lustre/lov: avoid subobj's coh_parent race
From: Bobi Jam * during a file lov object initialization, we need protect the access and change of its subobj->coh_parent, since it could be another layout change race there, which makes an unreferenced lovsub obj in the site object hash table. * dump lovsub objects in the site if the lovsub device reference > 0 during its finalization phase. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/6105 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1480 Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/lov_object.c | 10 +++--- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 4 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index df8b5b5..fe0b70a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -122,8 +122,8 @@ static struct cl_object *lov_sub_find(const struct lu_env *env, } static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, - struct cl_object *stripe, - struct lov_layout_raid0 *r0, int idx) + struct cl_object *stripe, struct lov_layout_raid0 *r0, + int idx) { struct cl_object_header *hdr; struct cl_object_header *subhdr; @@ -144,7 +144,6 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, hdr= cl_object_header(lov2cl(lov)); subhdr = cl_object_header(stripe); - parent = subhdr->coh_parent; oinfo = lov->lo_lsm->lsm_oinfo[idx]; CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: ostid: "DOSTID @@ -153,8 +152,12 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen); + /* reuse ->coh_attr_guard to protect coh_parent change */ + spin_lock(&subhdr->coh_attr_guard); + parent = subhdr->coh_parent; if (parent == NULL) { subhdr->coh_parent = hdr; + spin_unlock(&subhdr->coh_attr_guard); subhdr->coh_nesting = hdr->coh_nesting + 1; lu_object_ref_add(&stripe->co_lu, "lov-parent", lov); r0->lo_sub[idx] = cl2lovsub(stripe); @@ -166,6 +169,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, struct lov_object *old_lov; unsigned int mask = D_INODE; + spin_unlock(&subhdr->coh_attr_guard); old_obj = lu_object_locate(&parent->coh_lu, &lov_device_type); LASSERT(old_obj != NULL); old_lov = cl2lov(lu2cl(old_obj)); diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c index 998ea1c..926c35a 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c @@ -131,6 +131,10 @@ static struct lu_device *lovsub_device_free(const struct lu_env *env, struct lovsub_device *lsd = lu2lovsub_dev(d); struct lu_device *next = cl2lu_dev(lsd->acid_next); + if (atomic_read(&d->ld_ref) && d->ld_site) { + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL); + lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer); + } cl_device_fini(lu2cl_dev(d)); OBD_FREE_PTR(lsd); return next; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] lustre/xattr: separate ACL and XATTR caches
From: Andrew Perepechko This patch separates ACL and XATTR caches, so that when updating an ACL only LOOKUP lock is needed and when updating another XATTR only XATTR lock is needed. This patch also reverts XATTR cache support for setxattr because client performing REINT under even PR lock will deadlock if an active server operation (like unlink) attempts to cancel all locks, and setxattr has to wait for it (MDC max-in-flight is 1). This patch disables the r/o cache if the data is unreasonably large (larger than maximum single EA size). Signed-off-by: Andrew Perepechko Signed-off-by: Nathaniel Clark Reviewed-on: http://review.whamcloud.com/7208 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3669 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 - .../staging/lustre/lustre/llite/llite_internal.h | 7 -- drivers/staging/lustre/lustre/llite/xattr.c| 29 +++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 117 - drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 9 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 30 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 3 +- 10 files changed, 68 insertions(+), 134 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 05c77c0..4183a35 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1747,7 +1747,6 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \ OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP) -#define OBD_MD_FLXATTRLOCKED OBD_MD_FLGETATTRLOCK #define OBD_MD_FLXATTRALL (OBD_MD_FLXATTR | OBD_MD_FLXATTRLS) /* don't forget obdo_fid which is way down at the bottom so it can diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 692623b..0548aca 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -145,8 +145,6 @@ char *ldlm_it2str(int it) return "getxattr"; case IT_LAYOUT: return "layout"; - case IT_SETXATTR: - return "setxattr"; default: CERROR("Unknown intent %d\n", it); return "UNKNOWN"; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 28669ea..bc17c29 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -296,13 +296,6 @@ int ll_xattr_cache_get(struct inode *inode, size_t size, __u64 valid); -int ll_xattr_cache_update(struct inode *inode, - const char *name, - const char *newval, - size_t size, - __u64 valid, - int flags); - /* * Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS. diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index af83580..b1ed4d9 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -183,17 +183,11 @@ int ll_setxattr_common(struct inode *inode, const char *name, valid |= rce_ops2valid(rce->rce_ops); } #endif - if (sbi->ll_xattr_cache_enabled && - (rce == NULL || rce->rce_ops == RMT_LSETFACL)) { - rc = ll_xattr_cache_update(inode, name, pv, size, valid, flags); - } else { oc = ll_mdscapa_get(inode); rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc, valid, name, pv, size, 0, flags, ll_i2suppgid(inode), &req); capa_put(oc); - } - #ifdef CONFIG_FS_POSIX_ACL if (new_value != NULL) lustre_posix_acl_xattr_free(new_value, size); @@ -292,6 +286,7 @@ int ll_getxattr_common(struct inode *inode, const char *name, void *xdata; struct obd_capa *oc; struct rmtacl_ctl_entry *rce = NULL; + struct ll_inode_info *lli = ll_i2info(inode); CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, inode->i_generation, inode); @@ -339,7 +334,7 @@ int ll_getxattr_common(struct inode *inode, const char *name, */
[PATCH 3/5] lustre: instantiate negative dentry
From: yang sheng In the atomic_open callback. We should instantiate negative dentry. Else will got sanity:183 failed. Signed-off-by: yang sheng Reviewed-on: http://review.whamcloud.com/8110 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3228 Reviewed-by: Peng Tao Reviewed-by: Lai Siyao Reviewed-by: James Simmons Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/namei.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 8938d37..93c3744 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -468,6 +468,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request, if (IS_ERR(alias)) return PTR_ERR(alias); *de = alias; + } else if (!it_disposition(it, DISP_LOOKUP_NEG) && + !it_disposition(it, DISP_OPEN_CREATE)) { + /* With DISP_OPEN_CREATE dentry will + instantiated in ll_create_it. */ + LASSERT((*de)->d_inode == NULL); + d_instantiate(*de, inode); } if (!it_disposition(it, DISP_LOOKUP_NEG)) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] lustre: Unsafe error handling around ll_splice_alias
From: Swapnil Pimpale Callers of ll_splice_alias() should not assign the returned pointer to the dentry since it can be an err pointer. Fixed the above bug using a temporary dentry pointer. This temporary pointer is assigned to dentry only if ll_splice_alias has not returned an err pointer. Signed-off-by: Swapnil Pimpale Reviewed-on: http://review.whamcloud.com/7460 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3807 Reviewed-by: Fan Yong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/namei.c | 9 ++--- drivers/staging/lustre/lustre/llite/statahead.c | 9 ++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 1d03a6f..8938d37 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -462,9 +462,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request, * Atoimc_open may passin hashed dentries for open. */ if (d_unhashed(*de)) { - *de = ll_splice_alias(inode, *de); - if (IS_ERR(*de)) - return PTR_ERR(*de); + struct dentry *alias; + + alias = ll_splice_alias(inode, *de); + if (IS_ERR(alias)) + return PTR_ERR(alias); + *de = alias; } if (!it_disposition(it, DISP_LOOKUP_NEG)) { diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 183b415..ad61ad4 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -1585,12 +1585,15 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, ll_inode2fid(inode), &bits); if (rc == 1) { if ((*dentryp)->d_inode == NULL) { - *dentryp = ll_splice_alias(inode, + struct dentry *alias; + + alias = ll_splice_alias(inode, *dentryp); - if (IS_ERR(*dentryp)) { + if (IS_ERR(alias)) { ll_sai_unplug(sai, entry); - return PTR_ERR(*dentryp); + return PTR_ERR(alias); } + *dentryp = alias; } else if ((*dentryp)->d_inode != inode) { /* revalidate, but inode is recreated */ CDEBUG(D_READA, -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel