linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] NFS: handle NFSv4.1 server that doesn't support NFS4_OPEN_CLAIM_DELEG_CUR_FH
@ 2019-12-18 22:47 NeilBrown
  2019-12-18 23:47 ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: NeilBrown @ 2019-12-18 22:47 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1610 bytes --]


If an NFSv4.1 server doesn't support NFS4_OPEN_CLAIM_DELEG_CUR_FH
(e.g. Linux 3.0), and a newer NFS client tries to use it to claim
an open before returning a delegation, the server might return
NFS4ERR_BADXDR.
That is what Linux 3.0 does, though the RFC doesn't seem to be explicit
on which flags must be supported, and what error can be returned for
unsupported flags.

When NFS_CAP_ATOMIC_OPEN_V1 support was added in Commit 49f9a0fafd84
("NFSv4.1: Enable open-by-filehandle"), fall-back for non-supporting
servers was added for various open types, but not for delegation recall.

The code pattern for delegation recall is a little different to the
other open types, so I cannot simply copy the same approach.

I think the below patch should do the right thing, but I haven't tested
yet.

Does this look reasonable?  Is there a cleaner way to do it?  Should
we check other errors?

Thanks,
NeilBrown

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index caacf5e7f5e1..14f958d16648 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2174,6 +2174,13 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *sta
 static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, struct file_lock *fl, int err)
 {
 	switch (err) {
+		case -NFS4ERR_BADXDR: {
+			struct nfs4_exception exception;
+			if (nfs4_clear_cap_atomic_open_v1(server, -EINVAL,
+							  &exception))
+				return -EAGAIN;
+		}
+			/* fallthrough */
 		default:
 			printk(KERN_ERR "NFS: %s: unhandled error "
 					"%d.\n", __func__, err);

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2020-01-07 23:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 22:47 [PATCH/RFC] NFS: handle NFSv4.1 server that doesn't support NFS4_OPEN_CLAIM_DELEG_CUR_FH NeilBrown
2019-12-18 23:47 ` Trond Myklebust
2019-12-19  2:56   ` NeilBrown
2019-12-19  5:12     ` Trond Myklebust
2019-12-19  5:39       ` NeilBrown
2019-12-19 13:24         ` Trond Myklebust
2019-12-20  5:19           ` NeilBrown
2020-01-07 16:15             ` J. Bruce Fields
2020-01-07 16:53               ` J. Bruce Fields
2020-01-07 23:16               ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).