Ian Abbott [Fri, 28 Jun 2013 16:09:28 +0000 (17:09 +0100)]
staging: comedi: COMEDI_NI_LABPC_ISA no longer depends on VIRT_TO_BUS
After migrating ISA DMA support from the "ni_labpc" module to the new
"ni_labpc_isadma" module, the `COMEDI_NI_LABPC_ISA` configuration option
no longer depends on `VIRT_TO_BUS`, so remove the dependency.
(The new `COMEDI_NI_LABPC_ISADMA` option does depend on `VIRT_TO_BUS`
but is not configured manually and is only selected automatically if the
`VIRT_TO_BUS` and `ISA_DMA_API` options are set.)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:26 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: migrate DMA status handling
Migrate the code for checking and handling the interrupt status handling
for ISA DMA transfers into new a new function
`labpc_handle_dma_status()` in the "ni_labpc_isadma" module. Provide a
dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma"
module is not being built.
The static function `handle_isa_dma()` also needs to move across to the
new module.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:24 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: migrate DMA transfer set-up
Migrate the code for setting up an ISA DMA transfer into a new function
`labpc_setup_dma()` in the "ni_labpc_isadma" module. Provide a dummy
inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module
is not being built.
The static function `labpc_suggest_transfer_size()` also needs to move
across to the new module.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:23 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: move register defs to new file
The new "ni_labpc_isadma" module will need to access some register
definitions from "ni_labpc.c", which is not part of the module's source.
Move all the register definitions into a new, common header file
"ni_labpc_regs.h".
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:22 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: use labpc_have_dma_chan()
Call the new static inline function `labpc_have_dma_chan()` from
`labpc_ai_cmd()` to check if the ISA DMA channel has been initialized,
tidying up the surrounding code and removing an `#ifdef`. If the
"ni_labpc_isadma" module is not being built, `labpc_have_dma_chan()`
doesn't bother checking the DMA channel and just returns `false`,
allowing the compiler to optimize out a small amount of code.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add a static inline function to "ni_labpc_isadma.h" to test if a DMA
channel has been set-up, in which case `devpriv->dma_chan` will be
non-zero (where `devpriv` point to the private data for the comedi
device). If the "ni_labpc_isadma" module is not being built, don't
bother checking `devpriv->dma_chan`; just return `false` as this may
help the compiler to optimize out some unreachable code.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Migrate the code for requesting an ISA DMA channel and a DMA buffer, and
the code for freeing them into two new functions in the
"ni_labpc_isadma" module: `labpc_init_dma_chan()` and
`labpc_free_dma_chan()`. Dummy inline functions are provided in
"ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:19 +0000 (17:09 +0100)]
staging: comedi: ni_labpc_isadma: new module for ISA DMA support
It's just an empty module at the moment, selected by COMEDI_NI_LABPC_ISA
&& ISA_DMA_API && VIRT_TO_BUS, but will be populated by later patches to
migrate ISA DMA support for NI Lab-PC cards out of the "ni_labpc"
module.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:18 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: don't clear cmd3 bits explicitly in labpc_ai_cmd()
`labpc_ai_cmd()` calls `labpc_cancel()` which already sets
`devpriv->cmd3` to 0. Remove the lines from `labpc_ai_cmd()` that clear
specific bits in `devpriv->cmd3` explicitly as they have no effect.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 28 Jun 2013 16:09:17 +0000 (17:09 +0100)]
staging: comedi: ni_labpc: fix possible double-free of dma_buffer
If `labpc_attach()` allocates memory for `devpriv->dma_buffer` but fails
to request a DMA channel, it frees `devpriv->dma_buffer` but leaves the
pointer set. Later, `labpc_detach()` frees `devpriv->dma_buffer` again,
which means it has been freed twice in this case.
Fix it by only setting `devpriv->dma_buffer` in `labpc_attach()` if the
DMA channel was requested successfully.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 27 Jun 2013 13:50:58 +0000 (14:50 +0100)]
staging: comedi: use a mutex when accessing driver list
Low-level comedi drivers registered with the comedi core by
`comedi_driver_register()` are linked together into a simple linked list
headed by the `comedi_drivers` variable and chained by the `next` member
of `struct comedi_driver`. A driver is removed from the list by
`comedi_driver_unregister()`. The driver list is iterated through by
`comedi_device_attach()` when the `COMEDI_DEVCONFIG` ioctl is used to
attach a "legacy" device to a driver, and is also iterated through by
`comedi_read()` in "proc.c" when reading "/proc/comedi".
There is currently no protection against items being added or removed
from the list while it is being iterated. Add a mutex
`comedi_drivers_list_lock` to be locked while adding or removing an item
on the list, or when iterating through the list.
`comedi_driver_unregister()` also checks for and detaches any devices
using the driver. This is currently done before unlinking the driver
from the list, but it makes more sense to unlink the driver from the
list first to prevent `comedi_device_attach()` attempting to use it, so
move the unlinking part to the start of the function. Also, in
`comedi_device_attach()` hold on to the mutex until we've finished
attempting to attach the device to avoid it interfering with the
detachment in `comedi_driver_unregister()`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 27 Jun 2013 13:50:57 +0000 (14:50 +0100)]
staging: comedi: return void from comedi_driver_unregister()
'Unregister' functions generally return `void`.
`comedi_driver_unregister()` currently returns an `int` errno value.
Nothing looks at the return value. Change the return type to `void`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: ii_pci20kc: this is an ISA board not a PCI board
The Intelligent Instrumentation PCI-20001C board is a legacy PC/XT/AT
8-bit ISA board not a PCI board. The "PCI" appears to mean "Personal
Computer Instrumentation".
Move the Kconfig option into the COMEDI_ISA group.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: don't rely on comedidev.h to include headers
comedidev.h is the main kernel header for comedi. Every comedi
driver includes this header which then includes a number of
<linux/*> headers. All the drivers need <linux/module.h> and some
of them need <linux/delay.h>. The rest are not needed by any of
the drivers.
Remove all the includes in comedidev.h except for <linux/dma-mapping.h>,
which is needed to pick up the enum dma_data_direction for the
comedi_subdevice definition, and "comedi.h", which is the uapi
header for comedi.
Add <linux/module.h> to all the comedi drivers and <linux/delay.h>
to the couple that need it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use the helper function to allocate memory and set the comedi_device
private data pointer.
This removes the dependency on slab.h from most of the drivers so
remove the global #include in comedidev.h and the local #include
in some of the drivers.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fan Yong [Mon, 22 Jul 2013 16:07:08 +0000 (00:07 +0800)]
staging/lustre/scrub: purge inconsistenct objects after OI scrub
When OI scrub repaired the found inconsistency, it needs to purge the
old object out of cache; otherwise, others may still use those cached
stale information.
Original patch adds functions in obdclass that is only used by server.
Drop that part. Only merge in error handling change.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3335
Lustre-change: http://review.whamcloud.com/6697 Signed-off-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Patrick Farrell [Mon, 22 Jul 2013 16:07:03 +0000 (00:07 +0800)]
staging/lustre/llite: Anonymous dentry incorrectly identified as root
When exporting Lustre via NFS on SLES11SP2, this check incorrectly identifies
anonymous dentries as root dentries. This is due to a change in SLES11SP2
which makes the d_name.name for anonymous dentries the same as that for root
dentries. (Details in LU-3484.)
This changes the check to directly compare the value of the dentry pointer
to the root dentry pointer found in the superblock, rather than using the name.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3484
Lustre-change: http://review.whamcloud.com/6726 Signed-off-by: Patrick Farrell <paf@cray.com> Reviewed-by: Bob Glossman <bob.glossman@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Peng Tao <bergwolf@gmail.com> Reviewed-by: James Simmons <uja.ornl@gmail.com> Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Keith Mannthey [Mon, 22 Jul 2013 16:07:02 +0000 (00:07 +0800)]
staging/lustre/llite: error of listxattr when buffer is small
According to the standard, listxattr(2) should return -1
and errno should be set to ERANGE if the size of the list
buffer is too small to hold the result. However ll_listxattr()
will return a value bigger than the size of buffer in some cases.
Let's assume listxattr(2) returns SIZE when it is called with a
large enough list buffer. If it's called again with a list buffer
whose size is smaller than SIZE but bigger than (SIZE - 12), then
listxattr(2) will return SIZE too. This patch fixes the problem.
Original patch by Li Xi <pkuelelixi@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3403
Lustre-change: http://review.whamcloud.com/6463 Signed-off-by: Keith Mannthey <keith.mannthey@intel.com> Reviewed-by: Li Xi <pkuelelixi@gmail.com> Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fan Yong [Mon, 22 Jul 2013 16:07:01 +0000 (00:07 +0800)]
staging/lustre/llite: return valid fsid for statfs
Lustre uses 64-bits inode number to identify object on client side.
When re-export Lustre via NFS, NFS will detect whether support fsid
via statfs(). For the non-support case, it will only recognizes and
packs low 32-bits inode number in nfs handle. Such handle cannot be
used to locate the object properly.
To avoid patch linux kernel, Lustre client should generate fsid and
return it via statfs() to up layer.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2904
Lustre-change: http://review.whamcloud.com/6493 Signed-off-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Previously, I accidentally introduced a new way for duplicate
directory entries to be returned from readdir(). That patch fails
to properly decrement the nlupgs counter when breaking out of the
inner-for loop. This accounting error causes an extra iteration
of the inner-for loop when processing the next cfs page and a bad
ldp_hash_end value is then saved in the lu_dirpage. To fix this,
always decrement the nlupgs counter on entry into the inner loop.
Note: this bug only affects architectures with > 4k-sized pages, e.g.
PowerPC.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3182
Lustre-change: http://review.whamcloud.com/6405 Signed-off-by: Ned Bass <bass6@llnl.gov> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Bobi Jam <bobijam@gmail.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 22 Jul 2013 16:06:58 +0000 (00:06 +0800)]
staging/lustre/procfs: return -ENOMEM from lprocfs_register()
In lprocfs_register(), if proc_mkdir() fails then return
ERR_PTR(-ENOMEM) rather than NULL and hold _lprocfs_mutex for the
whole function. In lprocfs_remove_nolock() return early if the entry
is an error pointer. Improve error handling around lprocfs_register()
in a few spots.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2650
Lustre-change: http://review.whamcloud.com/5161 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Emoly Liu <emoly.liu@intel.com> Reviewed-by: Keith Mannthey <keith.mannthey@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Liu Xuezhao [Mon, 22 Jul 2013 16:06:54 +0000 (00:06 +0800)]
staging/lustre/fld: prepare FLD module for client server split
Split FLD server from client, fld_{handler,index}.c are not compliled
unless server support is enabled. Do not include dt_object.h or
lustre_mdt.h in lustre_fld.h and fix the minor breakages caused by
this elsewhere. Generally cleanup includes in lustre/fld.
Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com> Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1330
Lustre-change: http://review.whamcloud.com/2675 Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Deadlock isn't detected if 2 threads are trying to
grant 2 locks which deadlock on each other.
They call ldlm_flock_deadlock() simultaneously
and deadlock ins't detected.
The soulition is to add lock to blocking list before
calling ldlm_flock_deadlock()
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1602
Lustre-change: http://review.whamcloud.com/3277 Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com> Reviewed-by: Vitaly Fertman <vitaly_fertman@xyratex.com> Reviewed-by: Bruce Korb <bruce_korb@xyratex.com> Reviewed-by: Keith Mannthey <keith.mannthey@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 22 Jul 2013 16:06:51 +0000 (00:06 +0800)]
staging/lustre/llite: call simple_setattr() from ll_md_setattr()
This partially reverts the change from "LU-2482 layout: introduce new
layout for released files" by calling simple_setattr() from
ll_md_setattr() without ATTR_SIZE set. Doing so avoids failed
assertions in osc_page_delete(). Disable truncates on released files
and modify sanity 229 accordingly.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3448
Lustre-change: http://review.whamcloud.com/6643 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Dilger [Mon, 22 Jul 2013 16:06:50 +0000 (00:06 +0800)]
staging/lustre/mdt: duplicate link names in directory
When creating a hard link to a file, the MDT/MDD/OSD code does
not verify whether the target link name already exists in the
directory. The ZFS ZAP code checks for duplicate entries. The
add_dirent_to_buf() function in ldiskfs only checks entries for
duplicates while it is traversing the leaf block looking for free
space. Even if it scanned the whole leaf block, this would not
work for non-htree directories since there is no guarantee that
the name is being inserted into the same leaf block.
To fix this, link should check target object doesn't exist as
other creat operations.
Add sanity.sh test_31o with multiple threads racing to link a new
name into the directory, while ensuring that there is a free entry
in the leaf block that is large enough to hold the duplicate name.
This needs to be racy, because otherwise the client VFS will see
the existing name and not send the RPC to the MDS, hiding the bug.
Add DLDLMRES/PLDLMRES macros for printing the whole lock resource
name (including the name hash) in LDLM_DEBUG() messages in a format
similar to DFID/PFID so they can be found in debug logs more easily.
The patch pickes client side change of the original patch, which only
contains the DLM printk part.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2901
Lustre-change: http://review.whamcloud.com/6591 Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: Mike Pershin <mike.pershin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/lustre/ptlrpc: Race between start and stop service threads
When ptlrpc_start_thread fails to create a new thread, it will
finalize and free a struct ptlrpc_thread created and used here.
Considering this, it can be a problem when ptlrpc_svcpt_stop_thread
is driven and handles the struct ptlrpc_thread right after or right
before failure of cfs_create_thread. Because this situation let
the both of ptlrpc_start_thread and ptlrpc_svcpt_stop_threads
access the freed ptlrpc_thread and cause OS panic. Or, it may
happen that ptlrpc_svcpt_stop_threads waits forever holding an
already-freed waitq.
This patch adds an error handling into ptlrpc_start_thread to fix
this problem.
Original patch resolves some LFSCK 1.5 technical debts, including:
1) Check and remove repeated linkea entries.
2) Merge some "goto" branches to make the code more readable.
3) Some comments about object's nlink inconsistency processing.
This patch picks the obd flags change.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2915
Lustre-change: http://review.whamcloud.com/6344 Signed-off-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/lustre/llite: force lvb_data update after layout change
When a file is restored the layout lock is first
associated with the released layout and after restore
it has to be assocaited with the new layout. This patch
forces lvb_data update in ll_layout_fetch() even if one
is present (case for released->normal state change)
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3299
Lustre-change: http://review.whamcloud.com/6291 Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Johann Lombardi <johann.lombardi@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Liu Xuezhao [Mon, 22 Jul 2013 16:06:44 +0000 (00:06 +0800)]
staging/lustre/fid: prepare FID module for client server split
Split FID server from client, fid_{handler,store,lib}.c are not
compliled unless server support is enabled. Generally cleanup
includes in lustre/fid/ and reduce the need for client code to
directly or indirectly include {dt,md}_object.h.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1330
Lustre-change: http://review.whamcloud.com/2673 Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com> Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix 'code maintainability' issues found by Coverity version 6.5.1:
Unused pointer value (UNUSED_VALUE)
Pointer returned by function is never used.
Missing varargs init or cleanup (VARARGS)
va_end was not called for variable.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3107
Lustre-change: http://review.whamcloud.com/5944 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 22 Jul 2013 16:06:38 +0000 (00:06 +0800)]
staging/lustre/md: fix lu_ucred.c boilerplate
In preparing Ie3a3cd99 (LU-1330 obdclass: splits server-side object
stack from client) the lu_ucred infrastructure was put in its own
file. Fixup the boilerplate of this file to give the proper path,
short description, and authors.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1330
Lustre-change: http://review.whamcloud.com/5910 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Vitaly Fertman <vitaly_fertman@xyratex.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bruce Korb [Mon, 22 Jul 2013 16:06:37 +0000 (00:06 +0800)]
staging/lustre/dlmlock: compress out unused space
* lustre/include/lustre_dlm.h: Remove all bit fields and the unused
weighing callback procedure. respell LDLM_AST_DISCARD_DATA as
LDLM_FL_AST_DISCARD_DATA to match other flags.
* .gitignore: ignore emacs temporary files
* autogen.sh: rebuild the lock bits, if autogen is available.
* contrib/bit-masks/lustre_dlm_flags.def: define the ldlm_lock flags
* contrib/bit-masks/lustre_dlm_flags.tpl: template for emitting text
* contrib/bit-masks/Makefile: construct the .c and .h files
The .c file is for constructing a crash extension and is not
preserved.
* contrib/bit-masks/.gitignore: ignore built products
* lustre/contrib/wireshark/packet-lustre.c: use built files instead
of local versions of the defines.
In the rest of the modified sources, replace flag field references
with bit mask references.
* lustre/osc/osc_lock.c: removed osc_lock_weigh, too
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2771
Lustre-change: http://review.whamcloud.com/5312 Signed-off-by: Bruce Korb <bruce_korb@xyratex.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com> Reviewed-by: Keith Mannthey <keith.mannthey@intel.com> Reviewed-by: <bruce.korb@gmail.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/lustre: Make quota namespace refcounting consistent
It seems quota namespace is needlessly referenced on connect,
but that's not necessary as it could not go away until entire
obd goes away.
On the other hand this extra reference disturbs other logic
depending on empty namespace having zero refcount, so this patch
drops such extra referencing.
This picks client side change of the original patch.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2924
Lustre-change: http://review.whamcloud.com/6234 Signed-off-by: Oleg Drokin <oleg.drokin@intel.com> Reviewed-by: Niu Yawei <yawei.niu@intel.com> Reviewed-by: Johann Lombardi <johann.lombardi@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/lustre: Only wake up ldlm_poold as frequently as the check interval
We used to wake up ldlm poold every second, but that's overkill,
we should just see how much time is left until next closest recalc
interval hits and sleep this much.
This will make "per-second" client grant statistic not actually
per-second, but I don't think we need any precision in that code
staging/lustre/ldlm: split client namespaces into active and inactive
The main reason behind this is ldlm_poold walks all namespaces currently
no matter if there are any locks or not. On large systems this could take
quite a bit of time, esp. since ldlm_poold is currently woken up once per
second.
Now every time a client namespace loses it's last resource it is placed
into an inactive list that is not touched by ldlm_poold as pointless.
On creation of a first resource in a namespace it is placed back into
the active list.
Li Wei [Mon, 22 Jul 2013 16:06:32 +0000 (00:06 +0800)]
staging/lustre/ptlrpc: Translate between host and network errnos
Lustre puts system errors (e.g., ENOTCONN) on wire as numbers
essentially specific to senders' architectures. While this is fine
for x86-only sites, where receivers share the same error number
definition with senders, problems will arise, however, for sites
involving multiple architectures with different error number
definitions. For instance, an ENOTCONN reply from a sparc server will
be put on wire as -57, which, for an x86 client, means EBADSLT
instead.
To solve the problem, this patch defines a set of network errors for
on-wire or on-disk uses. These errors correspond to a subset of the
x86 system errors and share the same number definition, maintaining
compatibility with existing x86 clients and servers.
Then, either error numbers could be translated at run time, or all
host errors going on wire could be replaced with network errors in the
code. This patch does the former by introducing both generic and
field-specific translation routines and calling them at proper places,
so that translations for existing fields are transparent.
(Personally, I tend to think the latter way might be worthwhile, as it
is more straightforward conceptually. Do we really need so many
different errors? Should errors returned by kernel routines really be
passed up and eventually put on wire? There could even be security
implications in that.)
Thank Fujitsu for the original idea and their contributions that make
this available upstream.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2743
Lustre-change: http://review.whamcloud.com/5577 Signed-off-by: Li Wei <wei.g.li@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Dilger [Mon, 22 Jul 2013 16:06:30 +0000 (00:06 +0800)]
staging/lustre/ldlm: print FID in lvbo_init(), lvbo_update
Print the namespace and OBD device name, as well as the first two
lock resource fields (typically the FID) if there is an error with
loading the object from disk. This will be more important with
FID-on-OST and also the MDS. Using fid_extract_from_res_name() isn't
possible in the LDLM code, since the lock resource may not be a FID.
Make fid_extract_quota_resid() argument order and name consistent
with other fid_*_res() functions, with FID first and resource second.
Fix a bug in ofd_lvbo_init() where NULL lvb is accessed on error.
Print FID in ofd_lvbo_update() CDEBUG() and CERROR() messages.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2193
Lustre-change: http://review.whamcloud.com/4501 Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 22 Jul 2013 16:06:24 +0000 (00:06 +0800)]
staging/lustre/llite: use READ, WRITE around ll_rw_stats_tally()
In vvp_io_write_start() the stats function ll_rw_stats_tally() was
incorrectly called with a rw argument of 0. Correct this and use the
macros READ and WRITE in and around ll_rw_stats_tally() for clarity.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3384
Lustre-change: http://review.whamcloud.com/6447 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Bolle [Sat, 13 Jul 2013 18:46:39 +0000 (20:46 +0200)]
staging/lustre/libcfs: drop bogus Kconfig default
Commit 4b5b4c7222 ("staging/lustre/libcfs: restore LINVRNT") added
"default false" to this Kconfig file. It was obviously meant to use
"default n" here. But we might as well drop this line, as a Kconfig bool
defaults to 'n' anyway.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:16 +0000 (22:27 +0800)]
staging/lustre: fix build warnning on 32bit system
Building on 32bit system, I got warnings like below:
drivers/staging/lustre/lustre/llite/../include/lprocfs_status.h:666:7: note: expected ‘long unsigned int *’ but argument is of type ‘size_t *’
char *lprocfs_find_named_value(const char *buffer, const char *name,
drivers/staging/lustre/lustre/lov/lov_io.c: In function ‘lov_io_rw_iter_init’:
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:15 +0000 (22:27 +0800)]
staging/lustre: fix build error on non-x86 platforms
dump_trace() is only available on X86. Without it, Lustre's own
watchdog is broken. We can only dump current task's stack.
The client-side this code is much less likely to hit deadlocks and
it's probably OK to drop this altogether, since we hardly have any
ptlrpc threads on clients, most notable ones are ldlm cb threads
that should not really be blocking on the client anyway.
Remove libcfs watchdog for now, until the upstream kernel watchdog
can detect distributed deadlocks and dump other kernel threads.
Cc: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:14 +0000 (22:27 +0800)]
staging/lustre: fix build when CONFIG_UIDGID_STRICT_TYPE_CHECKS is on
kuid_t/kgid_t are wrappered when CONFIG_UIDGID_STRICT_TYPE_CHECKS is on.
Lustre build is broken because we always treat them as plain __u32.
The patch fixes it. Internally, Lustre always use __u32 uid/gid, and
convert to kuid_t/kgid_t when necessary.
Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:12 +0000 (22:27 +0800)]
staging/lustre/llite: add missing include file for prefetchw
Got below errors on s390 build:
CC [M] drivers/staging/lustre/lustre/llite/dir.o
drivers/staging/lustre/lustre/llite/dir.c: In function 'll_dir_filler':
drivers/staging/lustre/lustre/llite/dir.c:225:3: error: implicit declaration of function 'prefetchw' [-Werror=implicit-function-declaration]
Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:11 +0000 (22:27 +0800)]
staging/lustre: fix build on s390
As reported by Fengguang:
In file included from drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_idl.h:99:0,
from drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:46,
from drivers/staging/lustre/lustre/obdclass/../include/obd_support.h:42,
from drivers/staging/lustre/lustre/obdclass/../include/obd_class.h:40,
from drivers/staging/lustre/lustre/obdclass/lu_object.c:53:
drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_user.h:356:10: error: field 'lmd_st' has incomplete type
drivers/staging/lustre/lustre/obdclass/../include/lustre/lustre_user.h:361:10: error: field 'lmd_st' has incomplete type
Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:09 +0000 (22:27 +0800)]
staging/lustre: remove HIPQUAD
Stephen Rothwell reported below error on powerpc:
In file included from drivers/staging/lustre/include/linux/libcfs/libcfs.h:203:0,
from drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h:67,
from drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:41:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c: In function 'kiblnd_dev_need_failover':
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h:215:16: error: implicit declaration of function 'NIPQUAD' [-Werror=implicit-function-declaration]
static struct libcfs_debug_msg_data msgdata; \
^
We should just remove HIPQUAD and replace it with %pI4h.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Joe Perches <joe@perches.com> Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:08 +0000 (22:27 +0800)]
stating/lustre: only build if configured as module
Lustre internal dependency needs to be cleaned up. Currently,
libcfs is acting as a basis of all other modules, while other
modules in lustre/ directory in turn depend on lnet modules.
It creates a dependency loop that need to be fixed. Hopefully
we will remove libcfs in the end. So just disable buildin for
now.
Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 15 Jul 2013 14:27:05 +0000 (22:27 +0800)]
staging/lustre: fix Lustre code link order
Change Makefiles to keep link order in match with Lustre module
dependency, so that when Lustre is built in kernel, we'll have
the same dependency. Otherwise we'll crash kernel if Lustre is
builtin due to missing internal dependency.
Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'acpi-video-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI video support fixes from Rafael Wysocki:
"I'm sending a separate pull request for this as it may be somewhat
controversial. The breakage addressed here is not really new and the
fixes may not satisfy all users of the affected systems, but we've had
so much back and forth dance in this area over the last several weeks
that I think it's time to actually make some progress.
The source of the problem is that about a year ago we started to tell
BIOSes that we're compatible with Windows 8, which we really need to
do, because some systems shipping with Windows 8 are tested with it
and nothing else, so if we tell their BIOSes that we aren't compatible
with Windows 8, we expose our users to untested BIOS/AML code paths.
However, as it turns out, some Windows 8-specific AML code paths are
not tested either, because Windows 8 actually doesn't use the ACPI
methods containing them, so if we declare Windows 8 compatibility and
attempt to use those ACPI methods, things break. That occurs mostly
in the backlight support area where in particular the _BCM and _BQC
methods are plain unusable on some systems if the OS declares Windows
8 compatibility.
[ The additional twist is that they actually become usable if the OS
says it is not compatible with Windows 8, but that may cause
problems to show up elsewhere ]
Investigation carried out by Matthew Garrett indicates that what
Windows 8 does about backlight is to leave backlight control up to
individual graphics drivers. At least there's evidence that it does
that if the Intel graphics driver is used, so we've decided to follow
Windows 8 in that respect and allow i915 to control backlight (Daniel
likes that part).
The first commit from Aaron Lu makes ACPICA export the variable from
which we can infer whether or not the BIOS believes that we are
compatible with Windows 8.
The second commit from Matthew Garrett prepares the ACPI video driver
by making it initialize the ACPI backlight even if it is not going to
be used afterward (that is needed for backlight control to work on
Thinkpads).
The third commit implements the actual workaround making i915 take
over backlight control if the firmware thinks it's dealing with
Windows 8 and is based on the work of multiple developers, including
Matthew Garrett, Chun-Yi Lee, Seth Forshee, and Aaron Lu.
The final commit from Aaron Lu makes us follow Windows 8 by informing
the firmware through the _DOS method that it should not carry out
automatic brightness changes, so that brightness can be controlled by
GUI.
Hopefully, this approach will allow us to avoid using blacklists of
systems that should not declare Windows 8 compatibility just to avoid
backlight control problems in the future.
- Change from Aaron Lu makes ACPICA export a variable which can be
used by driver code to determine whether or not the BIOS believes
that we are compatible with Windows 8.
- Change from Matthew Garrett makes the ACPI video driver initialize
the ACPI backlight even if it is not going to be used afterward
(that is needed for backlight control to work on Thinkpads).
- Fix from Rafael J Wysocki implements Windows 8 backlight support
workaround making i915 take over bakclight control if the firmware
thinks it's dealing with Windows 8. Based on the work of multiple
developers including Matthew Garrett, Chun-Yi Lee, Seth Forshee,
and Aaron Lu.
- Fix from Aaron Lu makes the kernel follow Windows 8 by informing
the firmware through the _DOS method that it should not carry out
automatic brightness changes, so that brightness can be controlled
by GUI"
* tag 'acpi-video-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / video: no automatic brightness changes by win8-compatible firmware
ACPI / video / i915: No ACPI backlight if firmware expects Windows 8
ACPI / video: Always call acpi_video_init_brightness() on init
ACPICA: expose OSI version
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext[34] tmpfile bugfix from Ted Ts'o:
"Fix regression caused by commit af51a2ac36d1f which added ->tmpfile()
support (along with a similar fix for ext3)"
* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext3: fix a BUG when opening a file with O_TMPFILE flag
ext4: fix a BUG when opening a file with O_TMPFILE flag
Zheng Liu [Sun, 21 Jul 2013 02:03:20 +0000 (22:03 -0400)]
ext3: fix a BUG when opening a file with O_TMPFILE flag
When we try to open a file with O_TMPFILE flag, we will trigger a bug.
The root cause is that in ext4_orphan_add() we check ->i_nlink == 0 and
this check always fails because we set ->i_nlink = 1 in
inode_init_always(). We can use the following program to trigger it:
Here we couldn't call clear_nlink() directly because in d_tmpfile() we
will call inode_dec_link_count() to decrease ->i_nlink. So this commit
tries to call d_tmpfile() before ext4_orphan_add() to fix this problem.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk>
Zheng Liu [Sun, 21 Jul 2013 01:58:38 +0000 (21:58 -0400)]
ext4: fix a BUG when opening a file with O_TMPFILE flag
When we try to open a file with O_TMPFILE flag, we will trigger a bug.
The root cause is that in ext4_orphan_add() we check ->i_nlink == 0 and
this check always fails because we set ->i_nlink = 1 in
inode_init_always(). We can use the following program to trigger it:
Here we couldn't call clear_nlink() directly because in d_tmpfile() we
will call inode_dec_link_count() to decrease ->i_nlink. So this commit
tries to call d_tmpfile() before ext4_orphan_add() to fix this problem.
Reported-by: Dave Jones <davej@redhat.com> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Tested-by: Darrick J. Wong <darrick.wong@oracle.com> Tested-by: Dave Jones <davej@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Merge tag 'staging-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree fixes from Greg KH:
"Here are a few iio driver fixes for 3.11-rc2. They are still spread
across drivers/iio and drivers/staging/iio so they are coming in
through this tree.
I've also removed the drivers/staging/csr/ driver as the developers
who originally sent it to me have moved on to other companies, and CSR
still will not send us the specs for the device, making the driver
pretty much obsolete and impossible to fix up. Deleting it now
prevents people from sending in lots of tiny codingsyle fixes that
will never go anywhere.
It also helps to offset the large lustre filesystem merge that
happened in 3.11-rc1 in the overall 3.11.0 diffstat. :)"
* tag 'staging-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: csr: remove driver
iio: lps331ap: Fix wrong in_pressure_scale output value
iio staging: fix lis3l02dq, read error handling
staging:iio:ad7291: add missing .driver_module to struct iio_info
iio: ti_am335x_adc: add missing .driver_module to struct iio_info
iio: mxs-lradc: Remove useless check in read_raw
iio: mxs-lradc: Fix misuse of iio->trig
iio: inkern: fix iio_convert_raw_to_processed_unlocked
iio: Fix iio_channel_has_info
iio:trigger: device_unregister->device_del to avoid double free
iio: dac: ad7303: fix error return code in ad7303_probe()
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro:
"The sget() one is a long-standing bug and will need to go into -stable
(in fact, it had been originally caught in RHEL6), the other two are
3.11-only"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vfs: constify dentry parameter in d_count()
livelock avoidance in sget()
allow O_TMPFILE to work with O_WRONLY
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 bugfixes from Ted Ts'o:
"Fixes for 3.11-rc2, sent at 5pm, in the professoinal style. :-)"
I'm not sure I like this new level of "professionalism".
9-5, people, 9-5.
* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: call ext4_es_lru_add() after handling cache miss
ext4: yield during large unlinks
ext4: make the extent_status code more robust against ENOMEM failures
ext4: simplify calculation of blocks to free on error
ext4: fix error handling in ext4_ext_truncate()
Merge tag 'nfs-for-3.11-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust:
- Fix a regression against NFSv4 FreeBSD servers when creating a new
file
- Fix another regression in rpc_client_register()
* tag 'nfs-for-3.11-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
NFSv4: Fix a regression against the FreeBSD server
SUNRPC: Fix another issue with rpc_client_register()
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next
Pull btrfs fixes from Josef Bacik:
"I'm playing the role of Chris Mason this week while he's on vacation.
There are a few critical fixes for btrfs here, all regressions and
have been tested well"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next:
Btrfs: fix wrong write offset when replacing a device
Btrfs: re-add root to dead root list if we stop dropping it
Btrfs: fix lock leak when resuming snapshot deletion
Btrfs: update drop progress before stopping snapshot dropping
Al Viro [Fri, 19 Jul 2013 23:13:55 +0000 (03:13 +0400)]
livelock avoidance in sget()
Eric Sandeen has found a nasty livelock in sget() - take a mount(2) about
to fail. The superblock is on ->fs_supers, ->s_umount is held exclusive,
->s_active is 1. Along comes two more processes, trying to mount the same
thing; sget() in each is picking that superblock, bumping ->s_count and
trying to grab ->s_umount. ->s_active is 3 now. Original mount(2)
finally gets to deactivate_locked_super() on failure; ->s_active is 2,
superblock is still ->fs_supers because shutdown will *not* happen until
->s_active hits 0. ->s_umount is dropped and now we have two processes
chasing each other:
s_active = 2, A acquired ->s_umount, B blocked
A sees that the damn thing is stillborn, does deactivate_locked_super()
s_active = 1, A drops ->s_umount, B gets it
A restarts the search and finds the same superblock. And bumps it ->s_active.
s_active = 2, B holds ->s_umount, A blocked on trying to get it
... and we are in the earlier situation with A and B switched places.
The root cause, of course, is that ->s_active should not grow until we'd
got MS_BORN. Then failing ->mount() will have deactivate_locked_super()
shut the damn thing down. Fortunately, it's easy to do - the key point
is that grab_super() is called only for superblocks currently on ->fs_supers,
so it can bump ->s_count and grab ->s_umount first, then check MS_BORN and
bump ->s_active; we must never increment ->s_count for superblocks past
->kill_sb(), but grab_super() is never called for those.
The bug is pretty old; we would've caught it by now, if not for accidental
exclusion between sget() for block filesystems; the things like cgroup or
e.g. mtd-based filesystems don't have anything of that sort, so they get
bitten. The right way to deal with that is obviously to fix sget()...