kernel_optimize_test/fs/nfs
Catalin Marinas 3028efe03b NFS: Fix nfs4_lock_state refcounting in nfs4_alloc_{lock,unlock}data()
Commit 7b587e1a5a ("NFS: use locks_copy_lock() to copy locks.")
changed the lock copying from memcpy() to the dedicated
locks_copy_lock() function. The latter correctly increments the
nfs4_lock_state.ls_count via nfs4_fl_copy_lock(), however, this refcount
has already been incremented in the nfs4_alloc_{lock,unlock}data().
Kmemleak subsequently reports an unreferenced nfs4_lock_state object as
below (arm64 platform):

unreferenced object 0xffff8000fce0b000 (size 256):
  comm "systemd-sysuser", pid 1608, jiffies 4294892825 (age 32.348s)
  hex dump (first 32 bytes):
    20 57 4c fb 00 80 ff ff 20 57 4c fb 00 80 ff ff   WL..... WL.....
    00 57 4c fb 00 80 ff ff 01 00 00 00 00 00 00 00  .WL.............
  backtrace:
    [<000000000d15010d>] kmem_cache_alloc+0x178/0x208
    [<00000000d7c1d264>] nfs4_set_lock_state+0x124/0x1f0
    [<000000009c867628>] nfs4_proc_lock+0x90/0x478
    [<000000001686bd74>] do_setlk+0x64/0xe8
    [<00000000e01500d4>] nfs_lock+0xe8/0x1f0
    [<000000004f387d8d>] vfs_lock_file+0x18/0x40
    [<00000000656ab79b>] do_lock_file_wait+0x68/0xf8
    [<00000000f17c4a4b>] fcntl_setlk+0x224/0x280
    [<0000000052a242c6>] do_fcntl+0x418/0x730
    [<000000004f47291a>] __arm64_sys_fcntl+0x84/0xd0
    [<00000000d6856e01>] el0_svc_common+0x80/0xf0
    [<000000009c4bd1df>] el0_svc_handler+0x2c/0x80
    [<00000000b1a0d479>] el0_svc+0x8/0xc
    [<0000000056c62a0f>] 0xffffffffffffffff

This patch removes the original refcount_inc(&lsp->ls_count) that was
paired with the memcpy() lock copying.

Fixes: 7b587e1a5a ("NFS: use locks_copy_lock() to copy locks.")
Cc: <stable@vger.kernel.org> # 5.0.x-
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2019-03-18 13:14:24 -04:00
..
blocklayout NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. 2018-12-19 13:52:46 -05:00
filelayout
flexfilelayout NFS/flexfiles: Clean up mirror DS initialisation 2019-03-01 22:37:39 -05:00
cache_lib.c
cache_lib.h
callback_proc.c NFSv4.2 copy do not allocate memory under the lock 2018-11-22 13:54:46 -05:00
callback_xdr.c NFS: Remove print_overflow_msg() 2019-02-13 11:53:45 -05:00
callback.c nfs: fixed broken compilation in nfs_callback_up_net() 2018-12-31 11:25:16 -05:00
callback.h
client.c NFS/SUNRPC: don't lookup machine credential until rpcauth_bindcred(). 2018-12-19 13:52:45 -05:00
delegation.c NFS: Fix a soft lockup in the delegation recovery code 2019-02-21 14:51:25 -05:00
delegation.h NFS: Fix a soft lockup in the delegation recovery code 2019-02-21 14:51:25 -05:00
dir.c NFS: Fix typo in comments of nfs_readdir_alloc_pages() 2019-02-20 17:33:55 -05:00
direct.c NFS: Pass error information to the pgio error cleanup routine 2019-02-20 15:14:20 -05:00
dns_resolve.c
dns_resolve.h
export.c
file.c pNFS: Avoid read/modify/write when it is not necessary 2019-02-20 17:33:55 -05:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
internal.h NFS: readdirplus optimization by cache mechanism 2019-02-20 17:33:55 -05:00
io.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
iostat.h
Kconfig
Makefile
mount_clnt.c
namespace.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
netns.h
nfs.h
nfs2super.c
nfs2xdr.c NFS: Account for XDR pad of buf->pages 2019-02-14 10:13:49 -05:00
nfs3_fs.h
nfs3acl.c nfs: fix xfstest generic/099 failed on nfsv3 2019-02-20 17:33:55 -05:00
nfs3client.c
nfs3proc.c NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. 2018-12-19 13:52:46 -05:00
nfs3super.c
nfs3xdr.c NFS: Account for XDR pad of buf->pages 2019-02-14 10:13:49 -05:00
nfs4_fs.h sunrpc: Add xprt after nfs4_test_session_trunk() 2019-01-02 12:05:19 -05:00
nfs4client.c NFS: drop useless LIST_HEAD 2019-02-20 17:33:55 -05:00
nfs4file.c NFSv4.2 fix unnecessary retry in nfs4_copy_file_range 2019-01-15 11:24:49 -05:00
nfs4getroot.c
nfs4idmap.c keys: Fix dependency loop between construction record and auth key 2019-02-15 14:12:09 -08:00
nfs4idmap.h
nfs4namespace.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
nfs4proc.c NFS: Fix nfs4_lock_state refcounting in nfs4_alloc_{lock,unlock}data() 2019-03-18 13:14:24 -04:00
nfs4renewd.c NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. 2018-12-19 13:52:46 -05:00
nfs4session.c NFSv4.1: Avoid false retries when RPC calls are interrupted 2019-02-21 13:22:43 -05:00
nfs4session.h NFSv4.1: Bump the default callback session slot count to 16 2019-03-02 16:25:26 -05:00
nfs4state.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
nfs4super.c
nfs4sysctl.c
nfs4trace.c
nfs4trace.h NFS: Add trace events to report non-zero NFS status codes 2019-02-13 12:03:21 -05:00
nfs4xdr.c NFSv4.2: Add client support for the generic 'layouterror' RPC call 2019-03-01 16:20:16 -05:00
nfs42.h NFSv4.2: Add client support for the generic 'layouterror' RPC call 2019-03-01 16:20:16 -05:00
nfs42proc.c NFSv4.2: Add client support for the generic 'layouterror' RPC call 2019-03-01 16:20:16 -05:00
nfs42xdr.c NFSv4.2: Add client support for the generic 'layouterror' RPC call 2019-03-01 16:20:16 -05:00
nfsroot.c
nfstrace.c NFS: Add trace events to report non-zero NFS status codes 2019-02-13 12:03:21 -05:00
nfstrace.h NFS: Add trace events to report non-zero NFS status codes 2019-02-13 12:03:21 -05:00
pagelist.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
pnfs_dev.c NFS/flexfiles: Speed up read failover when DSes are down 2019-03-01 22:37:38 -05:00
pnfs_nfs.c NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. 2018-12-19 13:52:46 -05:00
pnfs.c pNFS: Fix a typo in pnfs_update_layout 2019-03-12 16:04:51 -04:00
pnfs.h NFS/flexfiles: Speed up read failover when DSes are down 2019-03-01 22:37:38 -05:00
proc.c NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'. 2018-12-19 13:52:46 -05:00
read.c NFS: Pass error information to the pgio error cleanup routine 2019-02-20 15:14:20 -05:00
super.c fs/nfs: Fix nfs_parse_devname to not modify it's argument 2019-02-20 17:33:55 -05:00
symlink.c
sysctl.c
unlink.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00
write.c NFS: Fix up documentation warnings 2019-02-20 15:14:21 -05:00