All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] NFS: Zero-stateid SETATTR should first return delegation
@ 2020-08-29 17:16 Chuck Lever
  2020-08-29 21:17 ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2020-08-29 17:16 UTC (permalink / raw)
  To: trondmy, anna.schumaker; +Cc: linux-nfs

If a write delegation isn't available, the Linux NFS client uses
a zero-stateid when performing a SETATTR.

NFSv4.0 provides no mechanism for an NFS server to match such a
request to a particular client. It recalls all delegations for that
file, even delegations held by the client issuing the request. If
that client happens to hold a read delegation, the server will
recall it immediately, resulting in an NFS4ERR_DELAY/CB_RECALL/
DELEGRETURN sequence.

Optimize out this pipeline bubble by having the client return any
delegations it may hold on a file before it issues a
SETATTR(zero-stateid) on that file.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/nfs4proc.c |    2 ++
 1 file changed, 2 insertions(+)

Changes since v1:
- Return the delegation only for NFSv4.0 mounts

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index dbd01548335b..bca7245f1e78 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3314,6 +3314,8 @@ static int _nfs4_do_setattr(struct inode *inode,
 			goto zero_stateid;
 	} else {
 zero_stateid:
+		if (server->nfs_client->cl_minorversion == 0)
+			nfs4_inode_return_delegation(inode);
 		nfs4_stateid_copy(&arg->stateid, &zero_stateid);
 	}
 	if (delegation_cred)



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-29 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29 17:16 [PATCH v2] NFS: Zero-stateid SETATTR should first return delegation Chuck Lever
2020-08-29 21:17 ` Trond Myklebust
2020-08-29 22:28   ` Chuck Lever

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.