remarkable-linux/fs/nfs
Jeff Layton 183d9e7b11 pnfs: rework LAYOUTGET retry handling
There are several problems in the way a stateid is selected for a
LAYOUTGET operation:

We pick a stateid to use in the RPC prepare op, but that makes
it difficult to serialize LAYOUTGETs that use the open stateid. That
serialization is done in pnfs_update_layout, which occurs well before
the rpc_prepare operation.

Between those two events, the i_lock is dropped and reacquired.
pnfs_update_layout can find that the list has lsegs in it and not do any
serialization, but then later pnfs_choose_layoutget_stateid ends up
choosing the open stateid.

This patch changes the client to select the stateid to use in the
LAYOUTGET earlier, when we're searching for a usable layout segment.
This way we can do it all while holding the i_lock the first time, and
ensure that we serialize any LAYOUTGET call that uses a non-layout
stateid.

This also means a rework of how LAYOUTGET replies are handled, as we
must now get the latest stateid if we want to retransmit in response
to a retryable error.

Most of those errors boil down to the fact that the layout state has
changed in some fashion. Thus, what we really want to do is to re-search
for a layout when it fails with a retryable error, so that we can avoid
reissuing the RPC at all if possible.

While the LAYOUTGET RPC is async, the initiating thread always waits for
it to complete, so it's effectively synchronous anyway. Currently, when
we need to retry a LAYOUTGET because of an error, we drive that retry
via the rpc state machine.

This means that once the call has been submitted, it runs until it
completes. So, we must move the error handling for this RPC out of the
rpc_call_done operation and into the caller.

In order to handle errors like NFS4ERR_DELAY properly, we must also
pass a pointer to the sliding timeout, which is now moved to the stack
in pnfs_update_layout.

The complicating errors are -NFS4ERR_RECALLCONFLICT and
-NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give
up and return NULL back to the caller. So, there is some special
handling for those errors to ensure that the layers driving the retries
can handle that appropriately.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-05-17 15:48:12 -04:00
..
blocklayout mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
filelayout NFS: Save struct inode * inside nfs_commit_info to clarify usage of i_lock 2016-05-09 09:05:40 -04:00
flexfilelayout flexfiles: add kerneldoc header to nfs4_ff_layout_prepare_ds 2016-05-17 15:48:11 -04:00
objlayout mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
cache_lib.c
cache_lib.h
callback.c
callback.h NFSv4.x: Allow multiple callbacks in flight 2016-01-25 09:36:21 -05:00
callback_proc.c pnfs: only tear down lsegs that precede seqid in LAYOUTRETURN args 2016-05-17 15:48:10 -04:00
callback_xdr.c NFSv4: Label stateids with the type 2016-05-17 15:48:06 -04:00
client.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
delegation.c NFSv4: Use the right stateid for delegations in setattr, read and write 2016-05-17 15:48:07 -04:00
delegation.h NFSv4: Use the right stateid for delegations in setattr, read and write 2016-05-17 15:48:07 -04:00
dir.c These changes contains a fix for overlayfs interacting with some 2016-04-07 17:22:20 -07:00
direct.c NFS: Save struct inode * inside nfs_commit_info to clarify usage of i_lock 2016-05-09 09:05:40 -04:00
dns_resolve.c
dns_resolve.h
file.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
fscache-index.c
fscache.c
fscache.h
getroot.c
inode.c These changes contains a fix for overlayfs interacting with some 2016-04-07 17:22:20 -07:00
internal.h NFS: Add nfs_commit_file() 2016-05-17 15:47:55 -04:00
iostat.h
Kconfig
Makefile
mount_clnt.c
namespace.c
netns.h
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c posix acls: Remove duplicate xattr name definitions 2015-12-06 21:25:17 -05:00
nfs3client.c
nfs3proc.c
nfs3super.c
nfs3xdr.c
nfs4_fs.h NFSv4: Use the right stateid for delegations in setattr, read and write 2016-05-17 15:48:07 -04:00
nfs4client.c nfs4: start callback_ident at idr 1 2015-11-23 21:59:42 -05:00
nfs4file.c NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs4getroot.c
nfs4idmap.c
nfs4idmap.h
nfs4namespace.c
nfs4proc.c pnfs: rework LAYOUTGET retry handling 2016-05-17 15:48:12 -04:00
nfs4renewd.c
nfs4session.c NFSv4.x: Allow multiple callbacks in flight 2016-01-25 09:36:21 -05:00
nfs4session.h NFSv4.x: Allow multiple callbacks in flight 2016-01-25 09:36:21 -05:00
nfs4state.c NFSv4: Use the right stateid for delegations in setattr, read and write 2016-05-17 15:48:07 -04: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 pnfs: rework LAYOUTGET retry handling 2016-05-17 15:48:12 -04:00
nfs4xdr.c NFSv4: Label stateids with the type 2016-05-17 15:48:06 -04:00
nfs42.h NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs42proc.c pnfs: only tear down lsegs that precede seqid in LAYOUTRETURN args 2016-05-17 15:48:10 -04:00
nfs42xdr.c NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfsroot.c
nfstrace.c
nfstrace.h NFS: Allow multiple commit requests in flight per file 2015-12-31 13:53:48 -05:00
pagelist.c NFS: Add nfs_commit_file() 2016-05-17 15:47:55 -04:00
pnfs.c pnfs: rework LAYOUTGET retry handling 2016-05-17 15:48:12 -04:00
pnfs.h pnfs: rework LAYOUTGET retry handling 2016-05-17 15:48:12 -04:00
pnfs_dev.c
pnfs_nfs.c NFS: Save struct inode * inside nfs_commit_info to clarify usage of i_lock 2016-05-09 09:05:40 -04:00
proc.c
read.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
super.c xprtrdma: Add rdma6 option to support NFS/RDMA IPv6 2016-05-17 15:47:56 -04:00
symlink.c switch ->get_link() to delayed_call, kill ->put_link() 2015-12-30 13:01:03 -05:00
sysctl.c
unlink.c
write.c NFS: Reclaim writes via writepage are opportunistic 2016-05-17 15:48:07 -04:00