Current code calls release_mem_regin on driver remove without
requesting it explicit first. The region is only requested via
devm_ioremap_resource and that releases it automatically. Removing the
release_mem_region calls fixes this.
Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: mt7621-mmc: Fix memory leek in case of error in probe
If the base address is not successfully obtained in the probe
function, then the mmc_host struct is not freed. Adding an exit for
that case fixes the bug.
staging: mt7621-mmc: Remove code for different soc types
Remove code that is intended for soc other then the mt7621 because
this driver is only for that soc. This also removes some conditions.
However the remaining code is also at the wrong place, it just selects
the mode of the pins, this is a job for pinctl not for the sdxc driver.
Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: mt7621-pci: Hack 2 more PCI interrupts for gnubee1
The mt7621-pci support 3 pci devices and has 3 interrupts.
Each of these need to be enabled by the same sort of hack to
map hwirq number to virq number.
This is a hack which will go as soon as I understand how this is
supposed to work.
Ji-Hun Kim [Thu, 5 Apr 2018 07:09:20 +0000 (16:09 +0900)]
staging: vt6655: add handling memory leak on vnt_start()
There was no code for handling memory leaks of device_init_rings() and
request_irq(). It needs to free allocated memory in the device_init_rings()
, when request_irq() would be failed. Add freeing sequences of irq and
device init rings.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ji-Hun Kim [Thu, 5 Apr 2018 07:09:19 +0000 (16:09 +0900)]
staging: vt6655: check for memory allocation failures
There are no null pointer checking on rd_info and td_info values which
are allocated by kzalloc. It has potential null pointer dereferencing
issues. Implement error handling code on device_init_rd*, device_init_td*
and vnt_start for the allocation failures.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: add container_of_safe()
Luster has a container_of0() function which is similar to
container_of() but passes an IS_ERR_OR_NULL() pointer through
unchanged.
This could be generally useful: bcache at last has a similar function.
Naming is hard, but the precedent set by hlist_entry_safe() suggests
a _safe suffix might be most consistent.
So add container_of_safe() to kernel.h, and replace all occurrences of
container_of0() with one of
- list_first_entry, list_next_entry, when that is a better fit,
- container_of(), when the pointer is used as a validpointer in
surrounding code,
- container_of_safe() when there is no obviously better alternative.
staging: lustre: rearrange placement of CPU partition management code.
Currently the code for cpu-partition tables lives in various places.
The non-SMP code is partly in libcfs/libcfs_cpu.h as static inlines,
and partly in lnet/libcfs/libcfs_cpu.c - some of the functions are
tiny and could well be inlines.
The SMP code is all in lnet/libcfs/linux/linux-cpu.c.
This patch moves all the trivial non-SMP functions into
libcfs_cpu.h as inlines, and all the SMP functions into libcfs_cpu.c
with the non-trival !SMP code.
Now when you go looking for some function, it is easier to find both
versions together when neither is trivial.
There is no code change here - just code movement.
This include file contains definitions used when CONFIG_SMP
is in effect. Other includes contain corresponding definitions
for when it isn't.
This can be hard to follow, so move the definitions to the one place.
As HAVE_LIBCFS_CPT is defined precisely when CONFIG_SMP, we discard
that macro and just use CONFIG_SMP when needed.
staging: lustre: convert osc_quota hash to rhashtable
As this is indexed by an integer, an extensible array
or extensible bitmap would be better.
If/when xarray lands, we should change to use that.
For now, just a simple conversion to rhashtable.
When removing an entry, we need to hold rcu_read_lock()
across the lookup and remove in case we race with another thread
performing a removal. This means we need to use call_rcu()
to free the quota info so we need an rcu_head in there, which
unfortunately doubles the size of the structure.
staging: lustre: convert obd uuid hash to rhashtable
The rhashtable data type is a perfect fit for the
export uuid hash table, so use that instead of
cfs_hash (which will eventually be removed).
As rhashtable supports lookups and insertions in atomic
context, there is no need to drop a spinlock while
inserting a new entry, which simplifies code quite a bit.
As there are no simple lookups on this hash table (only
insertions which might fail and take a spinlock), there is
no need to use rcu to free the exports.
staging: lustre: convert lov_pool to use rhashtable
The pools hashtable can be implemented using
the rhashtable implementation in lib.
This has the benefit that lookups are lock-free.
We need to use kfree_rcu() to free a pool so
that a lookup racing with a deletion will not access
freed memory.
rhashtable has no combined lookup-and-delete interface,
but as the lookup is lockless and the chains are short,
this brings little cost. Even if a lookup finds a pool,
we must be prepared for the delete to fail to find it,
as we might race with another thread doing a delete.
We use atomic_inc_not_zero() after finding a pool in the
hash table and if that fails, we must have raced with a
deletion, so we treat the lookup as a failure.
Use hashlen_string() rather than a hand-crafted hash
function.
Note that the pool_name, and the search key, are
guaranteed to be nul terminated.
staging: lustre: ptlrpc: convert conn_hash to rhashtable
Linux has a resizeable hashtable implementation in lib,
so we should use that instead of having one in libcfs.
This patch converts the ptlrpc conn_hash to use rhashtable.
In the process we gain lockless lookup.
As connections are never deleted until the hash table is destroyed,
there is no need to count the reference in the hash table. There
is also no need to enable automatic_shrinking.
This include file is only included in one place,
and only contains a list of other include directives.
So just move all those to the place where this file
is included, and discard the file.
One include directive uses a local name ("linux-cpu.h"), so
that needs to be given a proper path.
Probably many of these should be remove from here, and moved to
just the files that need them.
staging: lustre: move stack-check macros to libcfs_debug.h
CDEBUG_STACK() and CHECK_STACK() are macros to help with
debugging, so move them from
drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
to
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
This seems a more fitting location, and is a step towards
removing linux/libcfs.h and simplifying the include file structure.
John L. Hammond [Mon, 16 Apr 2018 04:15:09 +0000 (00:15 -0400)]
staging: lustre: llite: use xattr_handler name for ACLs
If struct xattr_handler has a name member then use it (rather than
prefix) for the ACL xattrs. This avoids a bug where ACL operations
failed for some kernels.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10785
Reviewed-on: https://review.whamcloud.com/ Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add proper punctuation to the comments. Change buf_size to size
for comment in ll_listxattr() since buf_size doesn't exit which
will confuse someone reading the code.
Having an extra ifdef makes the code harder to read. For the case
of ll_xattr_get_common() we have a variable initialized at the
start of the function but it is only used in XATTR_ACL_ACCESS_T
code block. Lets move that variable to that location since its
only used there and make the code look cleaner.
Bobi Jam [Mon, 16 Apr 2018 04:15:00 +0000 (00:15 -0400)]
staging: lustre: llite: eat -EEXIST on setting trusted.lov
Tools like rsync, tar, cp may copy and restore the xattrs on a file.
The client previously ignored the setting of trusted.lov/lustre.lov
if the layout had already been specified, to avoid causing these
tools to fail for no reason.
For PFL files we still need to silently eat -EEXIST on setting these
attributes to avoid problems.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9484
Reviewed-on: https://review.whamcloud.com/27126 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Niu Yawei <yawei.niu@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bobi Jam [Mon, 16 Apr 2018 04:14:58 +0000 (00:14 -0400)]
staging: lustre: llite: break up ll_setstripe_ea function
Place all the handling of information of trusted.lov that
is not stripe related into the new function ll_adjust_lum().
Now ll_setstripe_ea() only handles striping information.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9484
Reviewed-on: https://review.whamcloud.com/27126 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Niu Yawei <yawei.niu@intel.com> Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The function ll_xattr_set() contains special code to handle
the lustre specific xattr lustre.lov. Move all this code to
a new function ll_setstripe_ea().
Signed-off-by: Bobi Jam <bobijam.xu@intel.com> Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8998
Reviewed-on: https://review.whamcloud.com/24851 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Robin Humble [Mon, 16 Apr 2018 04:14:55 +0000 (00:14 -0400)]
staging: lustre: llite: Remove filtering of seclabel xattr
The security.capability xattr is used to implement File
Capabilities in recent Linux versions. Capabilities are a
fine grained approach to granting executables elevated
privileges. eg. /bin/ping can have capabilities
cap_net_admin, cap_net_raw+ep instead of being setuid root.
This xattr has long been filtered out by llite, initially for
stability reasons (b15587), and later over performance
concerns as this xattr is read for every file with eg.
'ls --color'. Since LU-2869 xattr's are cached on clients,
alleviating most performance concerns.
Removing llite's filtering of the security.capability xattr
enables using Lustre as a root filesystem, which is used on
some large clusters.
Signed-off-by: Robin Humble <plaguedbypenguins@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9562
Reviewed-on: https://review.whamcloud.com/27292 Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Sebastien Buisson <sbuisson@ddn.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In ll_xattr_cache_refill() if the xattr cache was invalid (and no
request was sent) then return -EAGAIN so that ll_getxattr_common()
caller will fetch the xattr from the MDT.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10132
Reviewed-on: https://review.whamcloud.com/29654 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: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: lustre: ldlm: xattr locks are lost on mdt
On the server side mdt_intent_getxattr() can return EFAULT if a
buffer cannot be found, it is returned after lock_replace, where a
new lock is installed into lockp. An error forces ldlm_lock_enqueue()
to destroy the original lock, but ldlm_handle_enqueue0() drops the
reference on the new lock. The xattr client code implied intent
error is returned under a lock, which is immediately cancelled.
Check if a lock obtained and cancel it properly for error cases.
Note: we should support both cases for interop needs, an intent
error under a lock and with a lock abort. Keep returning a lock
with an intent error for interop purposes for now, to be dropped
later when client will get old enough. make all intent ops to
work through md_intent_lock: getxattr and layout, which should
extract the intent error.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7433
Seagate-bug-id: MRP-3072 MRP-3137
Reviewed-on: http://review.whamcloud.com/17220 Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com> Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com> Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com> Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The lookup_intent it_op fields in many cases will be compared
to the settings of IT_OPEN | IT_UNLINK | IT_LOOKUP | IT_GETATTR.
Create a simple inline function for this common case.
Signed-off-by: Vitaly Fertman <vitaly.fertman@seagate.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7433
Seagate-bug-id: MRP-3072 MRP-3137
Reviewed-on: http://review.whamcloud.com/17220 Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com> Reviewed-by: Andriy Skulysh <andriy.skulysh@seagate.com> Tested-by: Elena V. Gryaznova <elena.gryaznova@seagate.com> Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When the allocation of xattr->xe_name was moved to kstrdup()
setting xattr->xe_namelen was dropped. This field is used
in several parts of the xattr cache code so it broke xattr
handling. Initialize xattr->xe_namelen when allocating
xattr->xe_name succeeds. Also change the debugging statement
to really report the xattr name instead of its length which
wasn't event being set.
Fixes: b3dd8957c23a ("staging: lustre: lustre: llite: Use kstrdup" Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: libcfs: discard cfs_time_add/sub
cfs_time_add adds its arguments.
cfs_time_sub subtracts finds the difference.
Discard these and use '+' and '-' directly.
This change highlighted a type error. The structure field
cr_queued_time was used to store jiffies, but was declared
as time_t (meant for seconds). So the time is changed to
"unsigned long".
staging: Android: Add 'vsoc' driver for cuttlefish.
The cuttlefish system is a virtual SoC architecture based on QEMU. It
uses the QEMU ivshmem feature to share memory regions between guest and
host with a custom protocol.
staging: android: ion: remove duplicate buffer field initializes
As a result of various previous patches, ion_buffer_create() now
has two sets of identical statements for initializing two fields of
the buffer struct, next to each other. Remove one set.
Move the initialization of these two fields together with the
statements that initialize the other two fields from the function
parameters, prior to the heap allocate() call, for consistency.
NeilBrown [Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)]
staging: lustre: tidy up ldlm_resource_putref()
1/ the return value of ldlm_resource_putref() is never
used, so change it to return 'void'.
2/ Move all of the code to run on the last putref to
__ldlm_resource_putref_final(). This means a lock
is taken in one function and dropped in another, but
that isn't too uncommon, and will disappear in a future
patch.
Now that the code it together, it becomes apparent that
we are dropping a ref on the namespace *before* the last
use. So keep the ref until after.
Wolfram Sang [Thu, 19 Apr 2018 14:06:19 +0000 (16:06 +0200)]
staging: nvec: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Marc Dietrich <marvin24@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: wilc1000: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Johnny Kim <johnny.kim@microchip.com> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: olpc_dcon: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
staging: nvec: Augment TODO file with GPIO work item
To make sure that this driver does not leave staging before it
is properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Marc Dietrich <marvin24@gmx.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
GPIO drivers should include <linux/gpio/driver.h> only, the
<linux/gpio.h> header is deprecated.
Cc: John Crispin <john@phrozen.org> Cc: Zhiyong Tao <zhiyong.tao@mediatek.com> Cc: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: atomisp: Augment TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
Cc: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: iio: Augment TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.
staging: greybus: Add TODO file with GPIO work items
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API, and the
GPIOLIB_IRQCHIP helper library, create the TODO file with these work
items.
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API, create
the TODO file with this work item.
staging: ks7010: init local variables when they are declared in ks7010_sdio_probe
This commit change init point of two variables to forward them to
init time. This variables are just being assigned some lines after
and it is more clear to init them when the init value is known and
in this case this is known when they are declared.
staging: ks7010: review includes of michael_mic.c file
This commit reviews includes of michael_mic.c source file
removing those which are not being used at all and
reordering the remaining ones in alphabetically order.
staging: ks7010: review includes of ks7010_sdio file
This commit reviews includes of ks7010_sdio.c source
file removing those which are not being used at all.
Kernel header includes have been ordered alphabetically
also.
staging: ks7010: review includes of ks_wlan.h file
This commit reviews includes of ks_wlan.h header file.
It removes those which are not being used at all. It
also reorder remaining ones in alphabetical order.
The linux/module.h include file has been moved to the
correct file which is ks7010_sdio.c in order to be able
to compile the driver without problems.
staging: ks7010: review includes of ks_wlan_net.c file
This commit reviews really needed includes in ks_wlan_net.c
source file. It removes those which are not needed at all.
It also reorder the remaining ones in alphabetical order.