Skip to contentSkip to conversation

NFSv4: Don't check for OPEN feature support in v4.1

PATCH In review Scott Mayhew 3 participants 4 messages Apr 30, 2025 – May 13, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4: Don't check for OPEN feature support in v4.1

fattr4_open_arguments is a v4.2 recommended attribute, so we shouldn't be sending it to v4.1 servers.

Fixes cb78f9b7d0c0 ("nfs: fix the fetch of FATTR4_OPEN_ARGUMENTS")
---
 fs/nfs/nfs4proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +3 -2
index 970f28dbf253..2eb2d750a5f1 100644
@@ -3967,8 +3967,9 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
 		     FATTR4_WORD0_CASE_INSENSITIVE |
 		     FATTR4_WORD0_CASE_PRESERVING;
 	if (minorversion)
-		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT |
-			     FATTR4_WORD2_OPEN_ARGUMENTS;
+		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
+	if (minorversion > 1)
+		bitmask[2] |= FATTR4_WORD2_OPEN_ARGUMENTS;
 
 	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
 	if (status == 0) {
Signature · 1 line
2.48.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Scott Mayhew

fattr4_open_arguments is a v4.2 recommended attribute, so we shouldn't be sending it to v4.1 servers.

Fixes cb78f9b7d0c0 ("nfs: fix the fetch of FATTR4_OPEN_ARGUMENTS")
---
 fs/nfs/nfs4proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index 970f28dbf253..2eb2d750a5f1 100644
@@ -3967,8 +3967,9 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
 		     FATTR4_WORD0_CASE_INSENSITIVE |

fs/nfs/nfs4proc.c static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f · line 3975

Quoted 10 lines
fs/nfs/nfs4proc.c +3 -2
 		     FATTR4_WORD0_CASE_PRESERVING;
 	if (minorversion)
-		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT |
-			     FATTR4_WORD2_OPEN_ARGUMENTS;
+		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
+	if (minorversion > 1)
+		bitmask[2] |= FATTR4_WORD2_OPEN_ARGUMENTS;
 
 	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
 	if (status == 0) {
maintainer
#3 lore raw
In reply to Scott Mayhew
Quoted 15 lines · Scott Mayhew

fattr4_open_arguments is a v4.2 recommended attribute, so we shouldn't be sending it to v4.1 servers.

Fixes cb78f9b7d0c0 ("nfs: fix the fetch of FATTR4_OPEN_ARGUMENTS")
---
 fs/nfs/nfs4proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index 970f28dbf253..2eb2d750a5f1 100644
@@ -3967,8 +3967,9 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
 		     FATTR4_WORD0_CASE_INSENSITIVE |

fs/nfs/nfs4proc.c static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f · line 3975

Quoted 10 lines
fs/nfs/nfs4proc.c +3 -2
 		     FATTR4_WORD0_CASE_PRESERVING;
 	if (minorversion)
-		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT |
-			     FATTR4_WORD2_OPEN_ARGUMENTS;
+		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
+	if (minorversion > 1)
+		bitmask[2] |= FATTR4_WORD2_OPEN_ARGUMENTS;
 
 	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
 	if (status == 0) {

I just want to point out that this _shouldn't_ be a problem with a properly functioning server. The server should just not return the attribute in the reply rather than returning a hard error or failing when it doesn't recognize the attribute.

If requesting this was causing a problem, then it's probably indicative of a server bug.

Signature · 1 line
Jeff Layton <[email protected]>