linux/fs/nfs
Benjamin Coddington f30cb757f6 NFS: Always wait for I/O completion before unlock
NFS attempts to wait for read and write completion before unlocking in
order to ensure that the data returned was protected by the lock.  When
this waiting is interrupted by a signal, the unlock may be skipped, and
messages similar to the following are seen in the kernel ring buffer:

[20.167876] Leaked locks on dev=0x0:0x2b ino=0x8dd4c3:
[20.168286] POSIX: fl_owner=ffff880078b06940 fl_flags=0x1 fl_type=0x0 fl_pid=20183
[20.168727] POSIX: fl_owner=ffff880078b06680 fl_flags=0x1 fl_type=0x0 fl_pid=20185

For NFSv3, the missing unlock will cause the server to refuse conflicting
locks indefinitely.  For NFSv4, the leftover lock will be removed by the
server after the lease timeout.

This patch fixes this issue by skipping the usual wait in
nfs_iocounter_wait if the FL_CLOSE flag is set when signaled.  Instead, the
wait happens in the unlock RPC task on the NFS UOC rpc_waitqueue.

For NFSv3, use lockd's new nlmclnt_operations along with
nfs_async_iocounter_wait to defer NLM's unlock task until the lock
context's iocounter reaches zero.

For NFSv4, call nfs_async_iocounter_wait() directly from unlock's
current rpc_call_prepare.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
2017-04-21 10:45:01 -04:00
..
blocklayout lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
filelayout NFS client fixes for 4.11 (part 2) 2017-03-31 12:29:03 -07:00
flexfilelayout pNFS/flexfiles: Check the result of nfs4_pnfs_ds_connect 2017-04-20 14:37:37 -04:00
cache_lib.c sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail 2017-02-08 17:02:45 -05:00
cache_lib.h
callback_proc.c NFS: Remove extra dprintk()s from callback_proc.c 2017-04-20 13:39:32 -04:00
callback_xdr.c NFS: Remove extra dprintk()s from callback_xdr.c 2017-04-20 13:39:33 -04:00
callback.c NFS client fixes for 4.11 2017-03-17 14:16:22 -07:00
callback.h nfs: add handling for CB_NOTIFY_LOCK in client 2016-09-22 13:56:04 -04:00
client.c lockd: Introduce nlmclnt_operations 2017-04-21 10:45:01 -04:00
delegation.c NFSv4: Optimise away forced revalidation when we know the attributes are OK 2016-12-01 17:21:37 -05:00
delegation.h NFSv4: nfs_inode_find_state_and_recover() should check all stateids 2016-09-27 14:34:35 -04:00
dir.c NFS: switch back to to ->iterate() 2017-04-20 13:33:09 -04:00
direct.c NFS: Clean up nfs_direct_commit_complete() 2017-04-20 13:39:33 -04:00
dns_resolve.c
dns_resolve.h
file.c NFS: Always wait for I/O completion before unlock 2017-04-21 10:45:01 -04:00
fscache-index.c
fscache.c
fscache.h
getroot.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
inode.c Merge branch 'rebased-statx' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-03-03 11:38:56 -08:00
internal.h pNFS: return status from nfs4_pnfs_ds_connect 2017-03-17 16:07:10 -04:00
io.c NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
iostat.h
Kconfig nfs: remove the objlayout driver 2017-04-20 15:51:23 -04:00
Makefile nfs: remove the objlayout driver 2017-04-20 15:51:23 -04:00
mount_clnt.c
namespace.c NFS: Remove extra dprintk()s from namespace.c 2017-04-20 13:39:34 -04:00
netns.h netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
nfs3client.c NFS: Remove unused authflavour parameter from nfs_get_client() 2016-12-01 17:46:32 -05:00
nfs3proc.c NFS: Always wait for I/O completion before unlock 2017-04-21 10:45:01 -04:00
nfs3super.c
nfs3xdr.c
nfs4_fs.h NFS: Use nfs4_setup_sequence() everywhere 2017-01-30 13:14:50 -05:00
nfs4client.c NFS: Remove extra dprintk()s from nfs4client.c 2017-04-20 13:39:35 -04:00
nfs4file.c NFSv4: add flock_owner to open context 2016-12-01 17:57:27 -05:00
nfs4getroot.c NFS: Clean up nfs4_get_rootfh() 2017-04-20 13:39:35 -04:00
nfs4idmap.c KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload() 2017-03-02 10:09:00 +11:00
nfs4idmap.h
nfs4namespace.c NFS: Remove extra dprintk()s from nfs4namespace.c 2017-04-20 13:39:35 -04:00
nfs4proc.c NFS: Always wait for I/O completion before unlock 2017-04-21 10:45:01 -04:00
nfs4renewd.c NFSv4: Set the connection timeout to match the lease period 2017-02-09 14:15:16 -05:00
nfs4session.c NFSv4.1: Fix regression in callback retry handling 2016-12-01 17:21:38 -05:00
nfs4session.h NFS: Make trace_nfs4_setup_sequence() available to NFS v4.0 2017-01-30 13:14:50 -05:00
nfs4state.c NFSv4: Fix warning for using 0 as NULL 2017-01-30 13:14:51 -05:00
nfs4super.c
nfs4sysctl.c nfs: do not initialise statics to 0 2015-12-28 09:57:15 -05:00
nfs4trace.c pNFS: Modify pnfs_update_layout tracepoints to use layout stateid 2015-12-28 09:57:14 -05:00
nfs4trace.h NFS: Make trace_nfs4_setup_sequence() available to NFS v4.0 2017-01-30 13:14:50 -05:00
nfs4xdr.c pNFS: Remove unused layout driver callbacks 2017-04-20 16:48:14 -04:00
nfs42.h NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs42proc.c NFS: Clean up nfs42_layoutstat_done() 2017-04-20 13:39:34 -04:00
nfs42xdr.c pNFS/flexfiles: Minor refactoring before adding iostats to layoutreturn 2016-12-03 15:37:45 -05:00
nfs.h
nfsroot.c
nfstrace.c
nfstrace.h NFS client updates for Linux 4.8 2016-07-30 16:33:25 -07:00
pagelist.c NFS: Add an iocounter wait function for async RPC tasks 2017-04-21 10:45:01 -04:00
pnfs_dev.c
pnfs_nfs.c pNFS: unexport nfs4_pnfs_v3_ds_connect_unload 2017-04-20 16:58:50 -04:00
pnfs.c pNFS: Unexport pnfs_put_lseg_locked and _pnfs_return_layout 2017-04-20 16:53:58 -04:00
pnfs.h pNFS: Remove unused layout driver callbacks 2017-04-20 16:48:14 -04:00
proc.c lockd: Introduce nlmclnt_operations 2017-04-21 10:45:01 -04:00
read.c NFS: move rw_mode to nfs_pageio_header 2017-04-20 14:00:41 -04:00
super.c NFS: tidy up nfs_show_mountd_netid 2017-01-30 13:14:50 -05:00
symlink.c vfs: remove ".readlink = generic_readlink" assignments 2016-12-09 16:45:04 +01:00
sysctl.c
unlink.c qstr: constify instances in nfs 2016-07-20 23:30:06 -04:00
write.c NFS: move rw_mode to nfs_pageio_header 2017-04-20 14:00:41 -04:00