* [PATCH 0/3] nfsd: move error code mapping to per-version code
@ 2024-07-29 1:47 NeilBrown
2024-07-29 1:47 ` [PATCH 1/3] nfsd: Move error code mapping to per-version proc code NeilBrown
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: NeilBrown @ 2024-07-29 1:47 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton
Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
These three patches replace my earlier patch
[PATCH 3/6] nfsd: Move error code mapping to per-version xdr code.
The mapping is now in proc code, not xdr code.
NeilBrown
[PATCH 1/3] nfsd: Move error code mapping to per-version proc code.
[PATCH 2/3] nfsd: be more systematic about selecting error codes for
[PATCH 3/3] nfsd: move error choice for incorrect object types to
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] nfsd: Move error code mapping to per-version proc code.
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
@ 2024-07-29 1:47 ` NeilBrown
2024-07-29 15:04 ` Christoph Hellwig
2024-07-29 1:47 ` [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use NeilBrown
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: NeilBrown @ 2024-07-29 1:47 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton
Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
There is code scattered around nfsd which chooses an error status based
on the particular version of nfs being used. It is cleaner to have the
version specific choices in version specific code.
With this patch common code returns the most specific error code
possible and the version specific code maps that if necessary.
Both v2 (nfsproc.c) and v3 (nfs3proc.c) now have a "map_status()"
function which is called to map the resp->status before each non-trivial
nfsd_proc_* or nfsd3_proc_* function returns.
NFS4ERR_SYMLINK and NFS4ERR_WRONG_TYPE introduce extra complications and
are left for a later patch.
Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/nfsd/export.c | 2 +-
fs/nfsd/nfs3proc.c | 35 +++++++++++++++++++++++++++++++++++
fs/nfsd/nfsfh.c | 10 +++-------
fs/nfsd/nfsproc.c | 31 +++++++++++++++++++++++++++++++
fs/nfsd/vfs.c | 14 ++++----------
5 files changed, 74 insertions(+), 18 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 50b3135d07ac..08e3527062e8 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1121,7 +1121,7 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp)
return 0;
denied:
- return rqstp->rq_vers < 4 ? nfserr_acces : nfserr_wrongsec;
+ return nfserr_wrongsec;
}
/*
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index dfcc957e460d..31bd9bcf8687 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -28,6 +28,20 @@ static int nfs3_ftypes[] = {
S_IFIFO, /* NF3FIFO */
};
+static __be32 map_status(__be32 status)
+{
+ switch (status) {
+ case nfserr_nofilehandle:
+ status = nfserr_badhandle;
+ break;
+ case nfserr_wrongsec:
+ case nfserr_file_open:
+ status = nfserr_acces;
+ break;
+ }
+ return status;
+}
+
/*
* NULL call.
*/
@@ -57,6 +71,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -80,6 +95,7 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp)
if (argp->check_guard)
guardtime = &argp->guardtime;
resp->status = nfsd_setattr(rqstp, &resp->fh, &attrs, guardtime);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -103,6 +119,7 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp)
resp->status = nfsd_lookup(rqstp, &resp->dirfh,
argp->name, argp->len,
&resp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -122,6 +139,7 @@ nfsd3_proc_access(struct svc_rqst *rqstp)
fh_copy(&resp->fh, &argp->fh);
resp->access = argp->access;
resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -142,6 +160,7 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp)
resp->pages = rqstp->rq_next_page++;
resp->status = nfsd_readlink(rqstp, &resp->fh,
page_address(*resp->pages), &resp->len);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -179,6 +198,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
fh_copy(&resp->fh, &argp->fh);
resp->status = nfsd_read(rqstp, &resp->fh, argp->offset,
&resp->count, &resp->eof);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -212,6 +232,7 @@ nfsd3_proc_write(struct svc_rqst *rqstp)
rqstp->rq_vec, nvecs, &cnt,
resp->committed, resp->verf);
resp->count = cnt;
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -359,6 +380,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp)
newfhp = fh_init(&resp->fh, NFS3_FHSIZE);
resp->status = nfsd3_create_file(rqstp, dirfhp, newfhp, argp);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -384,6 +406,7 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp)
fh_init(&resp->fh, NFS3_FHSIZE);
resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
&attrs, S_IFDIR, 0, &resp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -424,6 +447,7 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp)
argp->flen, argp->tname, &attrs, &resp->fh);
kfree(argp->tname);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -465,6 +489,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len,
&attrs, type, rdev, &resp->fh);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -486,6 +511,7 @@ nfsd3_proc_remove(struct svc_rqst *rqstp)
fh_copy(&resp->fh, &argp->fh);
resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR,
argp->name, argp->len);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -506,6 +532,7 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp)
fh_copy(&resp->fh, &argp->fh);
resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR,
argp->name, argp->len);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -528,6 +555,7 @@ nfsd3_proc_rename(struct svc_rqst *rqstp)
fh_copy(&resp->tfh, &argp->tfh);
resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen,
&resp->tfh, argp->tname, argp->tlen);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -548,6 +576,7 @@ nfsd3_proc_link(struct svc_rqst *rqstp)
fh_copy(&resp->tfh, &argp->tfh);
resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen,
&resp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -600,6 +629,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)
/* Recycle only pages that were part of the reply */
rqstp->rq_next_page = resp->xdr.page_ptr + 1;
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -644,6 +674,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
rqstp->rq_next_page = resp->xdr.page_ptr + 1;
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -661,6 +692,7 @@ nfsd3_proc_fsstat(struct svc_rqst *rqstp)
resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -704,6 +736,7 @@ nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
}
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -746,6 +779,7 @@ nfsd3_proc_pathconf(struct svc_rqst *rqstp)
}
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -773,6 +807,7 @@ nfsd3_proc_commit(struct svc_rqst *rqstp)
argp->count, resp->verf);
nfsd_file_put(nf);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 0b75305fb5f5..0130103833e5 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -162,10 +162,8 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
int len;
__be32 error;
- error = nfserr_stale;
- if (rqstp->rq_vers > 2)
- error = nfserr_badhandle;
- if (rqstp->rq_vers == 4 && fh->fh_size == 0)
+ error = nfserr_badhandle;
+ if (fh->fh_size == 0)
return nfserr_nofilehandle;
if (fh->fh_version != 1)
@@ -237,9 +235,7 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
/*
* Look up the dentry using the NFS file handle.
*/
- error = nfserr_stale;
- if (rqstp->rq_vers > 2)
- error = nfserr_badhandle;
+ error = nfserr_badhandle;
fileid_type = fh->fh_fileid_type;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index 36370b957b63..cb7099c6dc78 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -13,6 +13,22 @@
#define NFSDDBG_FACILITY NFSDDBG_PROC
+static __be32 map_status(__be32 status)
+{
+ switch (status) {
+ case nfserr_nofilehandle:
+ case nfserr_badhandle:
+ status = nfserr_stale;
+ break;
+ case nfserr_wrongsec:
+ case nfserr_xdev:
+ case nfserr_file_open:
+ status = nfserr_acces;
+ break;
+ }
+ return status;
+}
+
static __be32
nfsd_proc_null(struct svc_rqst *rqstp)
{
@@ -38,6 +54,7 @@ nfsd_proc_getattr(struct svc_rqst *rqstp)
goto out;
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -109,6 +126,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -143,6 +161,7 @@ nfsd_proc_lookup(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -164,6 +183,7 @@ nfsd_proc_readlink(struct svc_rqst *rqstp)
page_address(resp->page), &resp->len);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -200,6 +220,7 @@ nfsd_proc_read(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
else if (resp->status == nfserr_jukebox)
set_bit(RQ_DROPME, &rqstp->rq_flags);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -235,6 +256,7 @@ nfsd_proc_write(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
else if (resp->status == nfserr_jukebox)
set_bit(RQ_DROPME, &rqstp->rq_flags);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -403,6 +425,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
goto out;
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -419,6 +442,7 @@ nfsd_proc_remove(struct svc_rqst *rqstp)
resp->status = nfsd_unlink(rqstp, &argp->fh, -S_IFDIR,
argp->name, argp->len);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -437,6 +461,7 @@ nfsd_proc_rename(struct svc_rqst *rqstp)
&argp->tfh, argp->tname, argp->tlen);
fh_put(&argp->ffh);
fh_put(&argp->tfh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -457,6 +482,7 @@ nfsd_proc_link(struct svc_rqst *rqstp)
&argp->ffh);
fh_put(&argp->ffh);
fh_put(&argp->tfh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -495,6 +521,7 @@ nfsd_proc_symlink(struct svc_rqst *rqstp)
fh_put(&argp->ffh);
fh_put(&newfh);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -528,6 +555,7 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp)
resp->status = fh_getattr(&resp->fh, &resp->stat);
out:
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -545,6 +573,7 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp)
resp->status = nfsd_unlink(rqstp, &argp->fh, S_IFDIR,
argp->name, argp->len);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -590,6 +619,7 @@ nfsd_proc_readdir(struct svc_rqst *rqstp)
nfssvc_encode_nfscookie(resp, offset);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
@@ -607,6 +637,7 @@ nfsd_proc_statfs(struct svc_rqst *rqstp)
resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats,
NFSD_MAY_BYPASS_GSS_ON_ROOT);
fh_put(&argp->fh);
+ resp->status = map_status(resp->status);
return rpc_success;
}
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 29b1f3613800..b4f7b35cf0c0 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1767,10 +1767,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
if (!err)
err = nfserrno(commit_metadata(tfhp));
} else {
- if (host_err == -EXDEV && rqstp->rq_vers == 2)
- err = nfserr_acces;
- else
- err = nfserrno(host_err);
+ err = nfserrno(host_err);
}
dput(dnew);
out_drop_write:
@@ -1836,7 +1833,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen))
goto out;
- err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
+ err = nfserr_xdev;
if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
goto out;
if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
@@ -1851,7 +1848,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
trap = lock_rename(tdentry, fdentry);
if (IS_ERR(trap)) {
- err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
+ err = nfserr_xdev;
goto out_want_write;
}
err = fh_fill_pre_attrs(ffhp);
@@ -2020,10 +2017,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
/* name is mounted-on. There is no perfect
* error status.
*/
- if (nfsd_v4client(rqstp))
- err = nfserr_file_open;
- else
- err = nfserr_acces;
+ err = nfserr_file_open;
} else {
err = nfserrno(host_err);
}
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use.
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
2024-07-29 1:47 ` [PATCH 1/3] nfsd: Move error code mapping to per-version proc code NeilBrown
@ 2024-07-29 1:47 ` NeilBrown
2024-07-29 15:05 ` Christoph Hellwig
2024-07-29 1:47 ` [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code NeilBrown
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: NeilBrown @ 2024-07-29 1:47 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton
Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
Rather than using ad hoc values for internal errors (30000, 11000, ...)
use 'enum' to sequentially allocated numbers starting from the first
known available number - now visible as NFS4ERR_FIRST_FREE.
The goal is values that are distinct from all be32 error codes. To get
those we must first select integers that are not already used, then
convert them with cpu_to_be32().
Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/nfsd/nfsd.h | 23 ++++++++++++++++++-----
include/linux/nfs4.h | 17 ++++++++++-------
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 8f4f239d9f8a..593c34fd325a 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -326,17 +326,30 @@ void nfsd_lockd_shutdown(void);
#define nfserr_xattr2big cpu_to_be32(NFS4ERR_XATTR2BIG)
#define nfserr_noxattr cpu_to_be32(NFS4ERR_NOXATTR)
-/* error codes for internal use */
+/* Error codes for internal use. We use enum to choose numbers that are
+ * not already assigned, then covert to be32 resulting in a number that
+ * cannot conflict with any existing be32 nfserr value.
+ */
+enum {
+ NFSERR_DROPIT = NFS4ERR_FIRST_FREE,
/* if a request fails due to kmalloc failure, it gets dropped.
* Client should resend eventually
*/
-#define nfserr_dropit cpu_to_be32(30000)
+#define nfserr_dropit cpu_to_be32(NFSERR_DROPIT)
+
/* end-of-file indicator in readdir */
-#define nfserr_eof cpu_to_be32(30001)
+ NFSERR_EOF,
+#define nfserr_eof cpu_to_be32(NFSERR_EOF)
+
/* replay detected */
-#define nfserr_replay_me cpu_to_be32(11001)
+ NFSERR_REPLAY_ME,
+#define nfserr_replay_me cpu_to_be32(NFSERR_REPLAY_ME)
+
/* nfs41 replay detected */
-#define nfserr_replay_cache cpu_to_be32(11002)
+ NFSERR_REPLAY_CACHE,
+#define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
+
+};
/* Check for dir entries '.' and '..' */
#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 0d896ce296ce..1ad794f81747 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -281,15 +281,18 @@ enum nfsstat4 {
/* nfs42 */
NFS4ERR_PARTNER_NOTSUPP = 10088,
NFS4ERR_PARTNER_NO_AUTH = 10089,
- NFS4ERR_UNION_NOTSUPP = 10090,
- NFS4ERR_OFFLOAD_DENIED = 10091,
- NFS4ERR_WRONG_LFS = 10092,
- NFS4ERR_BADLABEL = 10093,
- NFS4ERR_OFFLOAD_NO_REQS = 10094,
+ NFS4ERR_UNION_NOTSUPP = 10090,
+ NFS4ERR_OFFLOAD_DENIED = 10091,
+ NFS4ERR_WRONG_LFS = 10092,
+ NFS4ERR_BADLABEL = 10093,
+ NFS4ERR_OFFLOAD_NO_REQS = 10094,
/* xattr (RFC8276) */
- NFS4ERR_NOXATTR = 10095,
- NFS4ERR_XATTR2BIG = 10096,
+ NFS4ERR_NOXATTR = 10095,
+ NFS4ERR_XATTR2BIG = 10096,
+
+ /* can be used for internal errors */
+ NFS4ERR_FIRST_FREE
};
/* error codes for internal client use */
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
2024-07-29 1:47 ` [PATCH 1/3] nfsd: Move error code mapping to per-version proc code NeilBrown
2024-07-29 1:47 ` [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use NeilBrown
@ 2024-07-29 1:47 ` NeilBrown
2024-07-29 15:06 ` Christoph Hellwig
2024-08-08 10:37 ` Jeff Layton
2024-07-29 12:36 ` [PATCH 0/3] nfsd: move error code mapping to per-version code Jeff Layton
2024-07-29 15:16 ` Chuck Lever
4 siblings, 2 replies; 14+ messages in thread
From: NeilBrown @ 2024-07-29 1:47 UTC (permalink / raw)
To: Chuck Lever, Jeff Layton
Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
If an NFS operation expect a particular sort of object (file, dir, link,
etc) but gets a file handle for a different sort of object, it must
return an error. The actual error varies among version in no-trivial
ways.
For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
INVAL is suitable.
For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
was found when not expected. This take precedence over NOTDIR.
For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
preference to EINVAL when none of the specific error codes apply.
When nfsd_mode_check() finds a symlink where it expect a directory it
needs to return an error code that can be converted to NOTDIR for v2 or
v3 but will be SYMLINK for v4. It must be different from the error
code returns when it finds a symlink but expects a regular file - that
must be converted to EINVAL or SYMLINK.
So we introduce an internal error code nfserr_symlink_not_dir which each
version converts as appropriate.
We also allow nfserr_wrong_type to be returned by
nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
behavioural change as nfsd_check_obj_is_reg() would previously return
nfserr_symiink for non-directory objects that aren't regular files. Now
it will return nfserr_wrong_type for objects that aren't regular,
directory, symlink (so char-special, block-special, sockets), which is
mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
behaviour is supported by RFCs.
As a result of these changes, nfsd_mode_check() doesn't need an rqstp
arg any more.
Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/nfsd/nfs3proc.c | 8 ++++++++
fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
fs/nfsd/nfsd.h | 5 +++++
fs/nfsd/nfsfh.c | 16 +++++++---------
fs/nfsd/nfsproc.c | 7 +++++++
5 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 31bd9bcf8687..ac7ee24415a3 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
case nfserr_file_open:
status = nfserr_acces;
break;
+
+ case nfserr_symlink_not_dir:
+ status = nfserr_notdir;
+ break;
+ case nfserr_symlink:
+ case nfserr_wrong_type:
+ status = nfserr_inval;
+ break;
}
return status;
}
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 46bd20fe5c0f..cc715438e77a 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
return nfs_ok;
if (S_ISDIR(mode))
return nfserr_isdir;
- /*
- * Using err_symlink as our catch-all case may look odd; but
- * there's no other obvious error for this case in 4.0, and we
- * happen to know that it will cause the linux v4 client to do
- * the right thing on attempts to open something other than a
- * regular file.
- */
- return nfserr_symlink;
+ if (S_ISLNK(mode))
+ return nfserr_symlink;
+ return nfserr_wrong_type;
}
static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
@@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
&resfh->fh_handle);
}
+static __be32 map_status(__be32 status, int minor)
+{
+ if (status == nfserr_wrong_type &&
+ minor == 0)
+ /* RFC5661 - 15.1.2.9 */
+ status = nfserr_inval;
+
+ if (status == nfserr_symlink_not_dir)
+ status = nfserr_symlink;
+ return status;
+}
static inline bool nfsd4_create_is_exclusive(int createmode)
{
return createmode == NFS4_CREATE_EXCLUSIVE ||
@@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
nfsd4_encode_replay(resp->xdr, op);
status = op->status = op->replay->rp_status;
} else {
+ op->status = map_status(op->status,
+ cstate->minorversion);
nfsd4_encode_operation(resp, op);
status = op->status;
}
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 593c34fd325a..3c8c8da063b0 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -349,6 +349,11 @@ enum {
NFSERR_REPLAY_CACHE,
#define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
+/* symlink found where dir expected - handled differently to
+ * other symlink found errors by NFSv3.
+ */
+ NFSERR_SYMLINK_NOT_DIR,
+#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
};
/* Check for dir entries '.' and '..' */
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 0130103833e5..8cd70f93827c 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
* the write call).
*/
static inline __be32
-nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
- umode_t requested)
+nfsd_mode_check(struct dentry *dentry, umode_t requested)
{
umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
@@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
}
return nfs_ok;
}
- /*
- * v4 has an error more specific than err_notdir which we should
- * return in preference to err_notdir:
- */
- if (rqstp->rq_vers == 4 && mode == S_IFLNK)
+ if (mode == S_IFLNK) {
+ if (requested == S_IFDIR)
+ return nfserr_symlink_not_dir;
return nfserr_symlink;
+ }
if (requested == S_IFDIR)
return nfserr_notdir;
if (mode == S_IFDIR)
return nfserr_isdir;
- return nfserr_inval;
+ return nfserr_wrong_type;
}
static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
@@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
if (error)
goto out;
- error = nfsd_mode_check(rqstp, dentry, type);
+ error = nfsd_mode_check(dentry, type);
if (error)
goto out;
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index cb7099c6dc78..3d65ab558091 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
case nfserr_file_open:
status = nfserr_acces;
break;
+ case nfserr_symlink_not_dir:
+ status = nfserr_notdir;
+ break;
+ case nfserr_symlink:
+ case nfserr_wrong_type:
+ status = nfserr_inval;
+ break;
}
return status;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] nfsd: move error code mapping to per-version code
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
` (2 preceding siblings ...)
2024-07-29 1:47 ` [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code NeilBrown
@ 2024-07-29 12:36 ` Jeff Layton
2024-07-29 15:16 ` Chuck Lever
4 siblings, 0 replies; 14+ messages in thread
From: Jeff Layton @ 2024-07-29 12:36 UTC (permalink / raw)
To: NeilBrown, Chuck Lever; +Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> These three patches replace my earlier patch
> [PATCH 3/6] nfsd: Move error code mapping to per-version xdr
> code.
>
> The mapping is now in proc code, not xdr code.
>
> NeilBrown
>
> [PATCH 1/3] nfsd: Move error code mapping to per-version proc code.
> [PATCH 2/3] nfsd: be more systematic about selecting error codes for
> [PATCH 3/3] nfsd: move error choice for incorrect object types to
Nice cleanup! Much cleaner than having all of this error handling
sprinkled all over the generic code.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] nfsd: Move error code mapping to per-version proc code.
2024-07-29 1:47 ` [PATCH 1/3] nfsd: Move error code mapping to per-version proc code NeilBrown
@ 2024-07-29 15:04 ` Christoph Hellwig
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-07-29 15:04 UTC (permalink / raw)
To: NeilBrown
Cc: Chuck Lever, Jeff Layton, linux-nfs, Olga Kornievskaia, Dai Ngo,
Tom Talpey
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use.
2024-07-29 1:47 ` [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use NeilBrown
@ 2024-07-29 15:05 ` Christoph Hellwig
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-07-29 15:05 UTC (permalink / raw)
To: NeilBrown
Cc: Chuck Lever, Jeff Layton, linux-nfs, Olga Kornievskaia, Dai Ngo,
Tom Talpey
On Mon, Jul 29, 2024 at 11:47:23AM +1000, NeilBrown wrote:
> Rather than using ad hoc values for internal errors (30000, 11000, ...)
> use 'enum' to sequentially allocated numbers starting from the first
> known available number - now visible as NFS4ERR_FIRST_FREE.
>
> The goal is values that are distinct from all be32 error codes. To get
> those we must first select integers that are not already used, then
> convert them with cpu_to_be32().
>
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
> fs/nfsd/nfsd.h | 23 ++++++++++++++++++-----
> include/linux/nfs4.h | 17 ++++++++++-------
> 2 files changed, 28 insertions(+), 12 deletions(-)
>
> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> index 8f4f239d9f8a..593c34fd325a 100644
> --- a/fs/nfsd/nfsd.h
> +++ b/fs/nfsd/nfsd.h
> @@ -326,17 +326,30 @@ void nfsd_lockd_shutdown(void);
> #define nfserr_xattr2big cpu_to_be32(NFS4ERR_XATTR2BIG)
> #define nfserr_noxattr cpu_to_be32(NFS4ERR_NOXATTR)
>
> -/* error codes for internal use */
> +/* Error codes for internal use. We use enum to choose numbers that are
Nit: normal kernel style would be:
/*
* Error codes for internal use. We use enum to choose numbers that are
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-07-29 1:47 ` [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code NeilBrown
@ 2024-07-29 15:06 ` Christoph Hellwig
2024-08-08 10:37 ` Jeff Layton
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-07-29 15:06 UTC (permalink / raw)
To: NeilBrown
Cc: Chuck Lever, Jeff Layton, linux-nfs, Olga Kornievskaia, Dai Ngo,
Tom Talpey
Beside the comment style nit noted in the last patch this looks good
and is a nice cleanup indeed:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] nfsd: move error code mapping to per-version code
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
` (3 preceding siblings ...)
2024-07-29 12:36 ` [PATCH 0/3] nfsd: move error code mapping to per-version code Jeff Layton
@ 2024-07-29 15:16 ` Chuck Lever
4 siblings, 0 replies; 14+ messages in thread
From: Chuck Lever @ 2024-07-29 15:16 UTC (permalink / raw)
To: NeilBrown; +Cc: Jeff Layton, linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Mon, Jul 29, 2024 at 11:47:21AM +1000, NeilBrown wrote:
> These three patches replace my earlier patch
> [PATCH 3/6] nfsd: Move error code mapping to per-version xdr code.
>
> The mapping is now in proc code, not xdr code.
>
> NeilBrown
>
> [PATCH 1/3] nfsd: Move error code mapping to per-version proc code.
> [PATCH 2/3] nfsd: be more systematic about selecting error codes for
> [PATCH 3/3] nfsd: move error choice for incorrect object types to
The code duplication in fs/nfsd/{nfsproc,nfs3proc}.c is a little
jarring, but the trade-off is the code is easier to understand and
far less brittle in the face of major things like disabling or even
deprecating an NFS version.
I've made a few minor edits and optimizations and applied these
three, with Christoph's nits addressed, to nfsd-next (for v6.12).
Please check my work (it's been pushed git.kernel.org).
--
Chuck Lever
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-07-29 1:47 ` [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code NeilBrown
2024-07-29 15:06 ` Christoph Hellwig
@ 2024-08-08 10:37 ` Jeff Layton
2024-08-08 11:40 ` NeilBrown
1 sibling, 1 reply; 14+ messages in thread
From: Jeff Layton @ 2024-08-08 10:37 UTC (permalink / raw)
To: NeilBrown, Chuck Lever; +Cc: linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
[-- Attachment #1: Type: text/plain, Size: 7036 bytes --]
On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> If an NFS operation expect a particular sort of object (file, dir, link,
> etc) but gets a file handle for a different sort of object, it must
> return an error. The actual error varies among version in no-trivial
> ways.
>
> For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
> INVAL is suitable.
>
> For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
> was found when not expected. This take precedence over NOTDIR.
>
> For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
> preference to EINVAL when none of the specific error codes apply.
>
> When nfsd_mode_check() finds a symlink where it expect a directory it
> needs to return an error code that can be converted to NOTDIR for v2 or
> v3 but will be SYMLINK for v4. It must be different from the error
> code returns when it finds a symlink but expects a regular file - that
> must be converted to EINVAL or SYMLINK.
>
> So we introduce an internal error code nfserr_symlink_not_dir which each
> version converts as appropriate.
>
> We also allow nfserr_wrong_type to be returned by
> nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
> behavioural change as nfsd_check_obj_is_reg() would previously return
> nfserr_symiink for non-directory objects that aren't regular files. Now
> it will return nfserr_wrong_type for objects that aren't regular,
> directory, symlink (so char-special, block-special, sockets), which is
> mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
> behaviour is supported by RFCs.
>
> As a result of these changes, nfsd_mode_check() doesn't need an rqstp
> arg any more.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
> fs/nfsd/nfs3proc.c | 8 ++++++++
> fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
> fs/nfsd/nfsd.h | 5 +++++
> fs/nfsd/nfsfh.c | 16 +++++++---------
> fs/nfsd/nfsproc.c | 7 +++++++
> 5 files changed, 43 insertions(+), 17 deletions(-)
>
> diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> index 31bd9bcf8687..ac7ee24415a3 100644
> --- a/fs/nfsd/nfs3proc.c
> +++ b/fs/nfsd/nfs3proc.c
> @@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
> case nfserr_file_open:
> status = nfserr_acces;
> break;
> +
> + case nfserr_symlink_not_dir:
> + status = nfserr_notdir;
> + break;
> + case nfserr_symlink:
> + case nfserr_wrong_type:
> + status = nfserr_inval;
> + break;
> }
> return status;
> }
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 46bd20fe5c0f..cc715438e77a 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> return nfs_ok;
> if (S_ISDIR(mode))
> return nfserr_isdir;
> - /*
> - * Using err_symlink as our catch-all case may look odd; but
> - * there's no other obvious error for this case in 4.0, and we
> - * happen to know that it will cause the linux v4 client to do
> - * the right thing on attempts to open something other than a
> - * regular file.
> - */
> - return nfserr_symlink;
> + if (S_ISLNK(mode))
> + return nfserr_symlink;
> + return nfserr_wrong_type;
> }
>
> static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
> @@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
> &resfh->fh_handle);
> }
>
> +static __be32 map_status(__be32 status, int minor)
> +{
> + if (status == nfserr_wrong_type &&
> + minor == 0)
> + /* RFC5661 - 15.1.2.9 */
> + status = nfserr_inval;
> +
> + if (status == nfserr_symlink_not_dir)
> + status = nfserr_symlink;
> + return status;
> +}
> static inline bool nfsd4_create_is_exclusive(int createmode)
> {
> return createmode == NFS4_CREATE_EXCLUSIVE ||
> @@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
> nfsd4_encode_replay(resp->xdr, op);
> status = op->status = op->replay->rp_status;
> } else {
> + op->status = map_status(op->status,
> + cstate->minorversion);
> nfsd4_encode_operation(resp, op);
> status = op->status;
> }
> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> index 593c34fd325a..3c8c8da063b0 100644
> --- a/fs/nfsd/nfsd.h
> +++ b/fs/nfsd/nfsd.h
> @@ -349,6 +349,11 @@ enum {
> NFSERR_REPLAY_CACHE,
> #define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
>
> +/* symlink found where dir expected - handled differently to
> + * other symlink found errors by NFSv3.
> + */
> + NFSERR_SYMLINK_NOT_DIR,
> +#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
> };
>
> /* Check for dir entries '.' and '..' */
> diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> index 0130103833e5..8cd70f93827c 100644
> --- a/fs/nfsd/nfsfh.c
> +++ b/fs/nfsd/nfsfh.c
> @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> * the write call).
> */
> static inline __be32
> -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> - umode_t requested)
> +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> {
> umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
>
> @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> }
> return nfs_ok;
> }
> - /*
> - * v4 has an error more specific than err_notdir which we should
> - * return in preference to err_notdir:
> - */
> - if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> + if (mode == S_IFLNK) {
> + if (requested == S_IFDIR)
> + return nfserr_symlink_not_dir;
> return nfserr_symlink;
> + }
> if (requested == S_IFDIR)
> return nfserr_notdir;
> if (mode == S_IFDIR)
> return nfserr_isdir;
> - return nfserr_inval;
> + return nfserr_wrong_type;
> }
>
> static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> @@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> if (error)
> goto out;
>
> - error = nfsd_mode_check(rqstp, dentry, type);
> + error = nfsd_mode_check(dentry, type);
> if (error)
> goto out;
>
> diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
> index cb7099c6dc78..3d65ab558091 100644
> --- a/fs/nfsd/nfsproc.c
> +++ b/fs/nfsd/nfsproc.c
> @@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
> case nfserr_file_open:
> status = nfserr_acces;
> break;
> + case nfserr_symlink_not_dir:
> + status = nfserr_notdir;
> + break;
> + case nfserr_symlink:
> + case nfserr_wrong_type:
> + status = nfserr_inval;
> + break;
> }
> return status;
> }
Hi Neil,
I'm seeing a set of failures in pynfs with this patch (json results
attached). I haven't looked in detail yet, but we should probably drop
this one for now.
--
Jeff Layton <jlayton@kernel.org>
[-- Attachment #2: 6.11.0-rc2-g1c134bcd2ef0-v4.0.json --]
[-- Type: application/json, Size: 122987 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-08-08 10:37 ` Jeff Layton
@ 2024-08-08 11:40 ` NeilBrown
2024-08-08 12:01 ` Jeff Layton
0 siblings, 1 reply; 14+ messages in thread
From: NeilBrown @ 2024-08-08 11:40 UTC (permalink / raw)
To: Jeff Layton
Cc: Chuck Lever, linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Thu, 08 Aug 2024, Jeff Layton wrote:
> On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> > If an NFS operation expect a particular sort of object (file, dir, link,
> > etc) but gets a file handle for a different sort of object, it must
> > return an error. The actual error varies among version in no-trivial
> > ways.
> >
> > For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
> > INVAL is suitable.
> >
> > For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
> > was found when not expected. This take precedence over NOTDIR.
> >
> > For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
> > preference to EINVAL when none of the specific error codes apply.
> >
> > When nfsd_mode_check() finds a symlink where it expect a directory it
> > needs to return an error code that can be converted to NOTDIR for v2 or
> > v3 but will be SYMLINK for v4. It must be different from the error
> > code returns when it finds a symlink but expects a regular file - that
> > must be converted to EINVAL or SYMLINK.
> >
> > So we introduce an internal error code nfserr_symlink_not_dir which each
> > version converts as appropriate.
> >
> > We also allow nfserr_wrong_type to be returned by
> > nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
> > behavioural change as nfsd_check_obj_is_reg() would previously return
> > nfserr_symiink for non-directory objects that aren't regular files. Now
> > it will return nfserr_wrong_type for objects that aren't regular,
> > directory, symlink (so char-special, block-special, sockets), which is
> > mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
> > behaviour is supported by RFCs.
> >
> > As a result of these changes, nfsd_mode_check() doesn't need an rqstp
> > arg any more.
> >
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > ---
> > fs/nfsd/nfs3proc.c | 8 ++++++++
> > fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
> > fs/nfsd/nfsd.h | 5 +++++
> > fs/nfsd/nfsfh.c | 16 +++++++---------
> > fs/nfsd/nfsproc.c | 7 +++++++
> > 5 files changed, 43 insertions(+), 17 deletions(-)
> >
> > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> > index 31bd9bcf8687..ac7ee24415a3 100644
> > --- a/fs/nfsd/nfs3proc.c
> > +++ b/fs/nfsd/nfs3proc.c
> > @@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
> > case nfserr_file_open:
> > status = nfserr_acces;
> > break;
> > +
> > + case nfserr_symlink_not_dir:
> > + status = nfserr_notdir;
> > + break;
> > + case nfserr_symlink:
> > + case nfserr_wrong_type:
> > + status = nfserr_inval;
> > + break;
> > }
> > return status;
> > }
> > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > index 46bd20fe5c0f..cc715438e77a 100644
> > --- a/fs/nfsd/nfs4proc.c
> > +++ b/fs/nfsd/nfs4proc.c
> > @@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> > return nfs_ok;
> > if (S_ISDIR(mode))
> > return nfserr_isdir;
> > - /*
> > - * Using err_symlink as our catch-all case may look odd; but
> > - * there's no other obvious error for this case in 4.0, and we
> > - * happen to know that it will cause the linux v4 client to do
> > - * the right thing on attempts to open something other than a
> > - * regular file.
> > - */
> > - return nfserr_symlink;
> > + if (S_ISLNK(mode))
> > + return nfserr_symlink;
> > + return nfserr_wrong_type;
> > }
> >
> > static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
> > @@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
> > &resfh->fh_handle);
> > }
> >
> > +static __be32 map_status(__be32 status, int minor)
> > +{
> > + if (status == nfserr_wrong_type &&
> > + minor == 0)
> > + /* RFC5661 - 15.1.2.9 */
> > + status = nfserr_inval;
> > +
> > + if (status == nfserr_symlink_not_dir)
> > + status = nfserr_symlink;
> > + return status;
> > +}
> > static inline bool nfsd4_create_is_exclusive(int createmode)
> > {
> > return createmode == NFS4_CREATE_EXCLUSIVE ||
> > @@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
> > nfsd4_encode_replay(resp->xdr, op);
> > status = op->status = op->replay->rp_status;
> > } else {
> > + op->status = map_status(op->status,
> > + cstate->minorversion);
> > nfsd4_encode_operation(resp, op);
> > status = op->status;
> > }
> > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> > index 593c34fd325a..3c8c8da063b0 100644
> > --- a/fs/nfsd/nfsd.h
> > +++ b/fs/nfsd/nfsd.h
> > @@ -349,6 +349,11 @@ enum {
> > NFSERR_REPLAY_CACHE,
> > #define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
> >
> > +/* symlink found where dir expected - handled differently to
> > + * other symlink found errors by NFSv3.
> > + */
> > + NFSERR_SYMLINK_NOT_DIR,
> > +#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
> > };
> >
> > /* Check for dir entries '.' and '..' */
> > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> > index 0130103833e5..8cd70f93827c 100644
> > --- a/fs/nfsd/nfsfh.c
> > +++ b/fs/nfsd/nfsfh.c
> > @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> > * the write call).
> > */
> > static inline __be32
> > -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > - umode_t requested)
> > +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> > {
> > umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
> >
> > @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > }
> > return nfs_ok;
> > }
> > - /*
> > - * v4 has an error more specific than err_notdir which we should
> > - * return in preference to err_notdir:
> > - */
> > - if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> > + if (mode == S_IFLNK) {
> > + if (requested == S_IFDIR)
> > + return nfserr_symlink_not_dir;
> > return nfserr_symlink;
> > + }
> > if (requested == S_IFDIR)
> > return nfserr_notdir;
> > if (mode == S_IFDIR)
> > return nfserr_isdir;
> > - return nfserr_inval;
> > + return nfserr_wrong_type;
> > }
> >
> > static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> > @@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> > if (error)
> > goto out;
> >
> > - error = nfsd_mode_check(rqstp, dentry, type);
> > + error = nfsd_mode_check(dentry, type);
> > if (error)
> > goto out;
> >
> > diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
> > index cb7099c6dc78..3d65ab558091 100644
> > --- a/fs/nfsd/nfsproc.c
> > +++ b/fs/nfsd/nfsproc.c
> > @@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
> > case nfserr_file_open:
> > status = nfserr_acces;
> > break;
> > + case nfserr_symlink_not_dir:
> > + status = nfserr_notdir;
> > + break;
> > + case nfserr_symlink:
> > + case nfserr_wrong_type:
> > + status = nfserr_inval;
> > + break;
> > }
> > return status;
> > }
>
> Hi Neil,
>
> I'm seeing a set of failures in pynfs with this patch (json results
> attached). I haven't looked in detail yet, but we should probably drop
> this one for now.
Most of the complaints are because pynfs is expecting the incorrect
error code that nfsd currently returns, rather than the correct one that
my patch makes it return.
There is one where the internal error code of 10101 leaks out. That is
NFSERR_SYMLNK_NOT_DIR.
That certainly requires investigation.
Thanks,
NeilBrown
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-08-08 11:40 ` NeilBrown
@ 2024-08-08 12:01 ` Jeff Layton
2024-08-08 22:00 ` NeilBrown
0 siblings, 1 reply; 14+ messages in thread
From: Jeff Layton @ 2024-08-08 12:01 UTC (permalink / raw)
To: NeilBrown; +Cc: Chuck Lever, linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Thu, 2024-08-08 at 21:40 +1000, NeilBrown wrote:
> On Thu, 08 Aug 2024, Jeff Layton wrote:
> > On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> > > If an NFS operation expect a particular sort of object (file, dir, link,
> > > etc) but gets a file handle for a different sort of object, it must
> > > return an error. The actual error varies among version in no-trivial
> > > ways.
> > >
> > > For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
> > > INVAL is suitable.
> > >
> > > For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
> > > was found when not expected. This take precedence over NOTDIR.
> > >
> > > For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
> > > preference to EINVAL when none of the specific error codes apply.
> > >
> > > When nfsd_mode_check() finds a symlink where it expect a directory it
> > > needs to return an error code that can be converted to NOTDIR for v2 or
> > > v3 but will be SYMLINK for v4. It must be different from the error
> > > code returns when it finds a symlink but expects a regular file - that
> > > must be converted to EINVAL or SYMLINK.
> > >
> > > So we introduce an internal error code nfserr_symlink_not_dir which each
> > > version converts as appropriate.
> > >
> > > We also allow nfserr_wrong_type to be returned by
> > > nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
> > > behavioural change as nfsd_check_obj_is_reg() would previously return
> > > nfserr_symiink for non-directory objects that aren't regular files. Now
> > > it will return nfserr_wrong_type for objects that aren't regular,
> > > directory, symlink (so char-special, block-special, sockets), which is
> > > mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
> > > behaviour is supported by RFCs.
> > >
> > > As a result of these changes, nfsd_mode_check() doesn't need an rqstp
> > > arg any more.
> > >
> > > Signed-off-by: NeilBrown <neilb@suse.de>
> > > ---
> > > fs/nfsd/nfs3proc.c | 8 ++++++++
> > > fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
> > > fs/nfsd/nfsd.h | 5 +++++
> > > fs/nfsd/nfsfh.c | 16 +++++++---------
> > > fs/nfsd/nfsproc.c | 7 +++++++
> > > 5 files changed, 43 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> > > index 31bd9bcf8687..ac7ee24415a3 100644
> > > --- a/fs/nfsd/nfs3proc.c
> > > +++ b/fs/nfsd/nfs3proc.c
> > > @@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
> > > case nfserr_file_open:
> > > status = nfserr_acces;
> > > break;
> > > +
> > > + case nfserr_symlink_not_dir:
> > > + status = nfserr_notdir;
> > > + break;
> > > + case nfserr_symlink:
> > > + case nfserr_wrong_type:
> > > + status = nfserr_inval;
> > > + break;
> > > }
> > > return status;
> > > }
> > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > > index 46bd20fe5c0f..cc715438e77a 100644
> > > --- a/fs/nfsd/nfs4proc.c
> > > +++ b/fs/nfsd/nfs4proc.c
> > > @@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> > > return nfs_ok;
> > > if (S_ISDIR(mode))
> > > return nfserr_isdir;
> > > - /*
> > > - * Using err_symlink as our catch-all case may look odd; but
> > > - * there's no other obvious error for this case in 4.0, and we
> > > - * happen to know that it will cause the linux v4 client to do
> > > - * the right thing on attempts to open something other than a
> > > - * regular file.
> > > - */
> > > - return nfserr_symlink;
> > > + if (S_ISLNK(mode))
> > > + return nfserr_symlink;
> > > + return nfserr_wrong_type;
> > > }
> > >
> > > static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
> > > @@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
> > > &resfh->fh_handle);
> > > }
> > >
> > > +static __be32 map_status(__be32 status, int minor)
> > > +{
> > > + if (status == nfserr_wrong_type &&
> > > + minor == 0)
> > > + /* RFC5661 - 15.1.2.9 */
> > > + status = nfserr_inval;
> > > +
> > > + if (status == nfserr_symlink_not_dir)
> > > + status = nfserr_symlink;
> > > + return status;
> > > +}
> > > static inline bool nfsd4_create_is_exclusive(int createmode)
> > > {
> > > return createmode == NFS4_CREATE_EXCLUSIVE ||
> > > @@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
> > > nfsd4_encode_replay(resp->xdr, op);
> > > status = op->status = op->replay->rp_status;
> > > } else {
> > > + op->status = map_status(op->status,
> > > + cstate->minorversion);
> > > nfsd4_encode_operation(resp, op);
> > > status = op->status;
> > > }
> > > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> > > index 593c34fd325a..3c8c8da063b0 100644
> > > --- a/fs/nfsd/nfsd.h
> > > +++ b/fs/nfsd/nfsd.h
> > > @@ -349,6 +349,11 @@ enum {
> > > NFSERR_REPLAY_CACHE,
> > > #define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
> > >
> > > +/* symlink found where dir expected - handled differently to
> > > + * other symlink found errors by NFSv3.
> > > + */
> > > + NFSERR_SYMLINK_NOT_DIR,
> > > +#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
> > > };
> > >
> > > /* Check for dir entries '.' and '..' */
> > > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> > > index 0130103833e5..8cd70f93827c 100644
> > > --- a/fs/nfsd/nfsfh.c
> > > +++ b/fs/nfsd/nfsfh.c
> > > @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> > > * the write call).
> > > */
> > > static inline __be32
> > > -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > - umode_t requested)
> > > +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> > > {
> > > umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
> > >
> > > @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > }
> > > return nfs_ok;
> > > }
> > > - /*
> > > - * v4 has an error more specific than err_notdir which we should
> > > - * return in preference to err_notdir:
> > > - */
> > > - if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> > > + if (mode == S_IFLNK) {
> > > + if (requested == S_IFDIR)
> > > + return nfserr_symlink_not_dir;
> > > return nfserr_symlink;
> > > + }
> > > if (requested == S_IFDIR)
> > > return nfserr_notdir;
> > > if (mode == S_IFDIR)
> > > return nfserr_isdir;
> > > - return nfserr_inval;
> > > + return nfserr_wrong_type;
> > > }
> > >
> > > static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> > > @@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> > > if (error)
> > > goto out;
> > >
> > > - error = nfsd_mode_check(rqstp, dentry, type);
> > > + error = nfsd_mode_check(dentry, type);
> > > if (error)
> > > goto out;
> > >
> > > diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
> > > index cb7099c6dc78..3d65ab558091 100644
> > > --- a/fs/nfsd/nfsproc.c
> > > +++ b/fs/nfsd/nfsproc.c
> > > @@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
> > > case nfserr_file_open:
> > > status = nfserr_acces;
> > > break;
> > > + case nfserr_symlink_not_dir:
> > > + status = nfserr_notdir;
> > > + break;
> > > + case nfserr_symlink:
> > > + case nfserr_wrong_type:
> > > + status = nfserr_inval;
> > > + break;
> > > }
> > > return status;
> > > }
> >
> > Hi Neil,
> >
> > I'm seeing a set of failures in pynfs with this patch (json results
> > attached). I haven't looked in detail yet, but we should probably drop
> > this one for now.
>
> Most of the complaints are because pynfs is expecting the incorrect
> error code that nfsd currently returns, rather than the correct one that
> my patch makes it return.
>
> There is one where the internal error code of 10101 leaks out. That is
> NFSERR_SYMLNK_NOT_DIR.
> That certainly requires investigation.
>
I'm not sure these error code changes are correct, now that I look. For
instance:
{
"classname": "st_readlink",
"code": "RDLK2r",
"failure": {
"err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_readlink.py\", line 29, in testFile\n check(res, NFS4ERR_INVAL, \"READLINK on non-symlink objects\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE\n",
"message": "READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE"
},
"name": "testFile",
"time": "0.003440380096435547"
},
Looking at RFC7530, the READLINK section (16.25.5) says:
The READLINK operation is only allowed on objects of type NF4LNK.
The server should return the error NFS4ERR_INVAL if the object is not
of type NF4LNK.
Several OPEN cases have errors similar to this one:
{
"classname": "st_open",
"code": "OPEN7s",
"failure": {
"err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_open.py\", line 183, in testSocket\n check(res, NFS4ERR_SYMLINK, \"Trying to OPEN socket\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL\n",
"message": "Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL"
},
"name": "testSocket",
"time": "0.006421566009521484"
},
RFC7530, 16.16.6:
If the component provided to OPEN resolves to something other than a
regular file (or a named attribute), an error will be returned to the
client. If it is a directory, NFS4ERR_ISDIR is returned; otherwise,
NFS4ERR_SYMLINK is returned. Note that NFS4ERR_SYMLINK is returned
for both symlinks and for special files of other types; NFS4ERR_INVAL
would be inappropriate, since the arguments provided by the client
were correct, and the client cannot necessarily know at the time it
sent the OPEN that the component would resolve to a non-regular file.
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-08-08 12:01 ` Jeff Layton
@ 2024-08-08 22:00 ` NeilBrown
2024-08-09 12:34 ` Jeff Layton
0 siblings, 1 reply; 14+ messages in thread
From: NeilBrown @ 2024-08-08 22:00 UTC (permalink / raw)
To: Jeff Layton
Cc: Chuck Lever, linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Thu, 08 Aug 2024, Jeff Layton wrote:
> On Thu, 2024-08-08 at 21:40 +1000, NeilBrown wrote:
> > On Thu, 08 Aug 2024, Jeff Layton wrote:
> > > On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> > > > If an NFS operation expect a particular sort of object (file, dir, link,
> > > > etc) but gets a file handle for a different sort of object, it must
> > > > return an error. The actual error varies among version in no-trivial
> > > > ways.
> > > >
> > > > For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
> > > > INVAL is suitable.
> > > >
> > > > For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
> > > > was found when not expected. This take precedence over NOTDIR.
> > > >
> > > > For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
> > > > preference to EINVAL when none of the specific error codes apply.
> > > >
> > > > When nfsd_mode_check() finds a symlink where it expect a directory it
> > > > needs to return an error code that can be converted to NOTDIR for v2 or
> > > > v3 but will be SYMLINK for v4. It must be different from the error
> > > > code returns when it finds a symlink but expects a regular file - that
> > > > must be converted to EINVAL or SYMLINK.
> > > >
> > > > So we introduce an internal error code nfserr_symlink_not_dir which each
> > > > version converts as appropriate.
> > > >
> > > > We also allow nfserr_wrong_type to be returned by
> > > > nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
> > > > behavioural change as nfsd_check_obj_is_reg() would previously return
> > > > nfserr_symiink for non-directory objects that aren't regular files. Now
> > > > it will return nfserr_wrong_type for objects that aren't regular,
> > > > directory, symlink (so char-special, block-special, sockets), which is
> > > > mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
> > > > behaviour is supported by RFCs.
> > > >
> > > > As a result of these changes, nfsd_mode_check() doesn't need an rqstp
> > > > arg any more.
> > > >
> > > > Signed-off-by: NeilBrown <neilb@suse.de>
> > > > ---
> > > > fs/nfsd/nfs3proc.c | 8 ++++++++
> > > > fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
> > > > fs/nfsd/nfsd.h | 5 +++++
> > > > fs/nfsd/nfsfh.c | 16 +++++++---------
> > > > fs/nfsd/nfsproc.c | 7 +++++++
> > > > 5 files changed, 43 insertions(+), 17 deletions(-)
> > > >
> > > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> > > > index 31bd9bcf8687..ac7ee24415a3 100644
> > > > --- a/fs/nfsd/nfs3proc.c
> > > > +++ b/fs/nfsd/nfs3proc.c
> > > > @@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
> > > > case nfserr_file_open:
> > > > status = nfserr_acces;
> > > > break;
> > > > +
> > > > + case nfserr_symlink_not_dir:
> > > > + status = nfserr_notdir;
> > > > + break;
> > > > + case nfserr_symlink:
> > > > + case nfserr_wrong_type:
> > > > + status = nfserr_inval;
> > > > + break;
> > > > }
> > > > return status;
> > > > }
> > > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > > > index 46bd20fe5c0f..cc715438e77a 100644
> > > > --- a/fs/nfsd/nfs4proc.c
> > > > +++ b/fs/nfsd/nfs4proc.c
> > > > @@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> > > > return nfs_ok;
> > > > if (S_ISDIR(mode))
> > > > return nfserr_isdir;
> > > > - /*
> > > > - * Using err_symlink as our catch-all case may look odd; but
> > > > - * there's no other obvious error for this case in 4.0, and we
> > > > - * happen to know that it will cause the linux v4 client to do
> > > > - * the right thing on attempts to open something other than a
> > > > - * regular file.
> > > > - */
> > > > - return nfserr_symlink;
> > > > + if (S_ISLNK(mode))
> > > > + return nfserr_symlink;
> > > > + return nfserr_wrong_type;
> > > > }
> > > >
> > > > static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
> > > > @@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
> > > > &resfh->fh_handle);
> > > > }
> > > >
> > > > +static __be32 map_status(__be32 status, int minor)
> > > > +{
> > > > + if (status == nfserr_wrong_type &&
> > > > + minor == 0)
> > > > + /* RFC5661 - 15.1.2.9 */
> > > > + status = nfserr_inval;
> > > > +
> > > > + if (status == nfserr_symlink_not_dir)
> > > > + status = nfserr_symlink;
> > > > + return status;
> > > > +}
> > > > static inline bool nfsd4_create_is_exclusive(int createmode)
> > > > {
> > > > return createmode == NFS4_CREATE_EXCLUSIVE ||
> > > > @@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
> > > > nfsd4_encode_replay(resp->xdr, op);
> > > > status = op->status = op->replay->rp_status;
> > > > } else {
> > > > + op->status = map_status(op->status,
> > > > + cstate->minorversion);
> > > > nfsd4_encode_operation(resp, op);
> > > > status = op->status;
> > > > }
> > > > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> > > > index 593c34fd325a..3c8c8da063b0 100644
> > > > --- a/fs/nfsd/nfsd.h
> > > > +++ b/fs/nfsd/nfsd.h
> > > > @@ -349,6 +349,11 @@ enum {
> > > > NFSERR_REPLAY_CACHE,
> > > > #define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
> > > >
> > > > +/* symlink found where dir expected - handled differently to
> > > > + * other symlink found errors by NFSv3.
> > > > + */
> > > > + NFSERR_SYMLINK_NOT_DIR,
> > > > +#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
> > > > };
> > > >
> > > > /* Check for dir entries '.' and '..' */
> > > > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> > > > index 0130103833e5..8cd70f93827c 100644
> > > > --- a/fs/nfsd/nfsfh.c
> > > > +++ b/fs/nfsd/nfsfh.c
> > > > @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> > > > * the write call).
> > > > */
> > > > static inline __be32
> > > > -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > > - umode_t requested)
> > > > +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> > > > {
> > > > umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
> > > >
> > > > @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > > }
> > > > return nfs_ok;
> > > > }
> > > > - /*
> > > > - * v4 has an error more specific than err_notdir which we should
> > > > - * return in preference to err_notdir:
> > > > - */
> > > > - if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> > > > + if (mode == S_IFLNK) {
> > > > + if (requested == S_IFDIR)
> > > > + return nfserr_symlink_not_dir;
> > > > return nfserr_symlink;
> > > > + }
> > > > if (requested == S_IFDIR)
> > > > return nfserr_notdir;
> > > > if (mode == S_IFDIR)
> > > > return nfserr_isdir;
> > > > - return nfserr_inval;
> > > > + return nfserr_wrong_type;
> > > > }
> > > >
> > > > static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> > > > @@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> > > > if (error)
> > > > goto out;
> > > >
> > > > - error = nfsd_mode_check(rqstp, dentry, type);
> > > > + error = nfsd_mode_check(dentry, type);
> > > > if (error)
> > > > goto out;
> > > >
> > > > diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
> > > > index cb7099c6dc78..3d65ab558091 100644
> > > > --- a/fs/nfsd/nfsproc.c
> > > > +++ b/fs/nfsd/nfsproc.c
> > > > @@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
> > > > case nfserr_file_open:
> > > > status = nfserr_acces;
> > > > break;
> > > > + case nfserr_symlink_not_dir:
> > > > + status = nfserr_notdir;
> > > > + break;
> > > > + case nfserr_symlink:
> > > > + case nfserr_wrong_type:
> > > > + status = nfserr_inval;
> > > > + break;
> > > > }
> > > > return status;
> > > > }
> > >
> > > Hi Neil,
> > >
> > > I'm seeing a set of failures in pynfs with this patch (json results
> > > attached). I haven't looked in detail yet, but we should probably drop
> > > this one for now.
> >
> > Most of the complaints are because pynfs is expecting the incorrect
> > error code that nfsd currently returns, rather than the correct one that
> > my patch makes it return.
> >
> > There is one where the internal error code of 10101 leaks out. That is
> > NFSERR_SYMLNK_NOT_DIR.
> > That certainly requires investigation.
> >
>
> I'm not sure these error code changes are correct, now that I look. For
> instance:
>
> {
> "classname": "st_readlink",
> "code": "RDLK2r",
> "failure": {
> "err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_readlink.py\", line 29, in testFile\n check(res, NFS4ERR_INVAL, \"READLINK on non-symlink objects\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE\n",
> "message": "READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE"
> },
> "name": "testFile",
> "time": "0.003440380096435547"
> },
>
>
> Looking at RFC7530, the READLINK section (16.25.5) says:
>
> The READLINK operation is only allowed on objects of type NF4LNK.
> The server should return the error NFS4ERR_INVAL if the object is not
> of type NF4LNK.
RFC7530 is for NFSv4.0 It doesn't have NFS4ERR_WRONG_TYPE. So if this
is a 4.0 test then that is indeed a bug. If the "nfs4.0" in the File
path the only hit that this was 4.0 rather than 4.1?
(RFC8881 declares this should be NFS4ERR_WRONG_TYPE for 4.1)
>
> Several OPEN cases have errors similar to this one:
>
> {
> "classname": "st_open",
> "code": "OPEN7s",
> "failure": {
> "err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_open.py\", line 183, in testSocket\n check(res, NFS4ERR_SYMLINK, \"Trying to OPEN socket\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL\n",
> "message": "Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL"
> },
> "name": "testSocket",
> "time": "0.006421566009521484"
> },
>
> RFC7530, 16.16.6:
>
> If the component provided to OPEN resolves to something other than a
> regular file (or a named attribute), an error will be returned to the
> client. If it is a directory, NFS4ERR_ISDIR is returned; otherwise,
> NFS4ERR_SYMLINK is returned. Note that NFS4ERR_SYMLINK is returned
> for both symlinks and for special files of other types; NFS4ERR_INVAL
> would be inappropriate, since the arguments provided by the client
> were correct, and the client cannot necessarily know at the time it
> sent the OPEN that the component would resolve to a non-regular file.
Ahhh - thanks. The comments in the code seemed to suggest that the RFC
wasn't specific. I guess I misread them.
Thanks for the more careful analysis. I'll aim to have an update on
Monday.
NeilBrown
>
> --
> Jeff Layton <jlayton@kernel.org>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code.
2024-08-08 22:00 ` NeilBrown
@ 2024-08-09 12:34 ` Jeff Layton
0 siblings, 0 replies; 14+ messages in thread
From: Jeff Layton @ 2024-08-09 12:34 UTC (permalink / raw)
To: NeilBrown; +Cc: Chuck Lever, linux-nfs, Olga Kornievskaia, Dai Ngo, Tom Talpey
On Fri, 2024-08-09 at 08:00 +1000, NeilBrown wrote:
> On Thu, 08 Aug 2024, Jeff Layton wrote:
> > On Thu, 2024-08-08 at 21:40 +1000, NeilBrown wrote:
> > > On Thu, 08 Aug 2024, Jeff Layton wrote:
> > > > On Mon, 2024-07-29 at 11:47 +1000, NeilBrown wrote:
> > > > > If an NFS operation expect a particular sort of object (file, dir, link,
> > > > > etc) but gets a file handle for a different sort of object, it must
> > > > > return an error. The actual error varies among version in no-trivial
> > > > > ways.
> > > > >
> > > > > For v2 and v3 there are ISDIR and NOTDIR errors, and for any else, only
> > > > > INVAL is suitable.
> > > > >
> > > > > For v4.0 there is also NFS4ERR_SYMLINK which should be used if a SYMLINK
> > > > > was found when not expected. This take precedence over NOTDIR.
> > > > >
> > > > > For v4.1+ there is also NFS4ERR_WRONG_TYPE which should be used in
> > > > > preference to EINVAL when none of the specific error codes apply.
> > > > >
> > > > > When nfsd_mode_check() finds a symlink where it expect a directory it
> > > > > needs to return an error code that can be converted to NOTDIR for v2 or
> > > > > v3 but will be SYMLINK for v4. It must be different from the error
> > > > > code returns when it finds a symlink but expects a regular file - that
> > > > > must be converted to EINVAL or SYMLINK.
> > > > >
> > > > > So we introduce an internal error code nfserr_symlink_not_dir which each
> > > > > version converts as appropriate.
> > > > >
> > > > > We also allow nfserr_wrong_type to be returned by
> > > > > nfsd_check_obj_is_reg() in nfsv4 code) and nfsd_mode_check(). This a
> > > > > behavioural change as nfsd_check_obj_is_reg() would previously return
> > > > > nfserr_symiink for non-directory objects that aren't regular files. Now
> > > > > it will return nfserr_wrong_type for objects that aren't regular,
> > > > > directory, symlink (so char-special, block-special, sockets), which is
> > > > > mapped to nfserr_inval for NFSv4.0. This should not be a problem as the
> > > > > behaviour is supported by RFCs.
> > > > >
> > > > > As a result of these changes, nfsd_mode_check() doesn't need an rqstp
> > > > > arg any more.
> > > > >
> > > > > Signed-off-by: NeilBrown <neilb@suse.de>
> > > > > ---
> > > > > fs/nfsd/nfs3proc.c | 8 ++++++++
> > > > > fs/nfsd/nfs4proc.c | 24 ++++++++++++++++--------
> > > > > fs/nfsd/nfsd.h | 5 +++++
> > > > > fs/nfsd/nfsfh.c | 16 +++++++---------
> > > > > fs/nfsd/nfsproc.c | 7 +++++++
> > > > > 5 files changed, 43 insertions(+), 17 deletions(-)
> > > > >
> > > > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
> > > > > index 31bd9bcf8687..ac7ee24415a3 100644
> > > > > --- a/fs/nfsd/nfs3proc.c
> > > > > +++ b/fs/nfsd/nfs3proc.c
> > > > > @@ -38,6 +38,14 @@ static __be32 map_status(__be32 status)
> > > > > case nfserr_file_open:
> > > > > status = nfserr_acces;
> > > > > break;
> > > > > +
> > > > > + case nfserr_symlink_not_dir:
> > > > > + status = nfserr_notdir;
> > > > > + break;
> > > > > + case nfserr_symlink:
> > > > > + case nfserr_wrong_type:
> > > > > + status = nfserr_inval;
> > > > > + break;
> > > > > }
> > > > > return status;
> > > > > }
> > > > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> > > > > index 46bd20fe5c0f..cc715438e77a 100644
> > > > > --- a/fs/nfsd/nfs4proc.c
> > > > > +++ b/fs/nfsd/nfs4proc.c
> > > > > @@ -166,14 +166,9 @@ static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
> > > > > return nfs_ok;
> > > > > if (S_ISDIR(mode))
> > > > > return nfserr_isdir;
> > > > > - /*
> > > > > - * Using err_symlink as our catch-all case may look odd; but
> > > > > - * there's no other obvious error for this case in 4.0, and we
> > > > > - * happen to know that it will cause the linux v4 client to do
> > > > > - * the right thing on attempts to open something other than a
> > > > > - * regular file.
> > > > > - */
> > > > > - return nfserr_symlink;
> > > > > + if (S_ISLNK(mode))
> > > > > + return nfserr_symlink;
> > > > > + return nfserr_wrong_type;
> > > > > }
> > > > >
> > > > > static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate, struct nfsd4_open *open, struct svc_fh *resfh)
> > > > > @@ -184,6 +179,17 @@ static void nfsd4_set_open_owner_reply_cache(struct nfsd4_compound_state *cstate
> > > > > &resfh->fh_handle);
> > > > > }
> > > > >
> > > > > +static __be32 map_status(__be32 status, int minor)
> > > > > +{
> > > > > + if (status == nfserr_wrong_type &&
> > > > > + minor == 0)
> > > > > + /* RFC5661 - 15.1.2.9 */
> > > > > + status = nfserr_inval;
> > > > > +
> > > > > + if (status == nfserr_symlink_not_dir)
> > > > > + status = nfserr_symlink;
> > > > > + return status;
> > > > > +}
> > > > > static inline bool nfsd4_create_is_exclusive(int createmode)
> > > > > {
> > > > > return createmode == NFS4_CREATE_EXCLUSIVE ||
> > > > > @@ -2798,6 +2804,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
> > > > > nfsd4_encode_replay(resp->xdr, op);
> > > > > status = op->status = op->replay->rp_status;
> > > > > } else {
> > > > > + op->status = map_status(op->status,
> > > > > + cstate->minorversion);
> > > > > nfsd4_encode_operation(resp, op);
> > > > > status = op->status;
> > > > > }
> > > > > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> > > > > index 593c34fd325a..3c8c8da063b0 100644
> > > > > --- a/fs/nfsd/nfsd.h
> > > > > +++ b/fs/nfsd/nfsd.h
> > > > > @@ -349,6 +349,11 @@ enum {
> > > > > NFSERR_REPLAY_CACHE,
> > > > > #define nfserr_replay_cache cpu_to_be32(NFSERR_REPLAY_CACHE)
> > > > >
> > > > > +/* symlink found where dir expected - handled differently to
> > > > > + * other symlink found errors by NFSv3.
> > > > > + */
> > > > > + NFSERR_SYMLINK_NOT_DIR,
> > > > > +#define nfserr_symlink_not_dir cpu_to_be32(NFSERR_SYMLINK_NOT_DIR)
> > > > > };
> > > > >
> > > > > /* Check for dir entries '.' and '..' */
> > > > > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> > > > > index 0130103833e5..8cd70f93827c 100644
> > > > > --- a/fs/nfsd/nfsfh.c
> > > > > +++ b/fs/nfsd/nfsfh.c
> > > > > @@ -62,8 +62,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
> > > > > * the write call).
> > > > > */
> > > > > static inline __be32
> > > > > -nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > > > - umode_t requested)
> > > > > +nfsd_mode_check(struct dentry *dentry, umode_t requested)
> > > > > {
> > > > > umode_t mode = d_inode(dentry)->i_mode & S_IFMT;
> > > > >
> > > > > @@ -76,17 +75,16 @@ nfsd_mode_check(struct svc_rqst *rqstp, struct dentry *dentry,
> > > > > }
> > > > > return nfs_ok;
> > > > > }
> > > > > - /*
> > > > > - * v4 has an error more specific than err_notdir which we should
> > > > > - * return in preference to err_notdir:
> > > > > - */
> > > > > - if (rqstp->rq_vers == 4 && mode == S_IFLNK)
> > > > > + if (mode == S_IFLNK) {
> > > > > + if (requested == S_IFDIR)
> > > > > + return nfserr_symlink_not_dir;
> > > > > return nfserr_symlink;
> > > > > + }
> > > > > if (requested == S_IFDIR)
> > > > > return nfserr_notdir;
> > > > > if (mode == S_IFDIR)
> > > > > return nfserr_isdir;
> > > > > - return nfserr_inval;
> > > > > + return nfserr_wrong_type;
> > > > > }
> > > > >
> > > > > static bool nfsd_originating_port_ok(struct svc_rqst *rqstp, int flags)
> > > > > @@ -362,7 +360,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
> > > > > if (error)
> > > > > goto out;
> > > > >
> > > > > - error = nfsd_mode_check(rqstp, dentry, type);
> > > > > + error = nfsd_mode_check(dentry, type);
> > > > > if (error)
> > > > > goto out;
> > > > >
> > > > > diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
> > > > > index cb7099c6dc78..3d65ab558091 100644
> > > > > --- a/fs/nfsd/nfsproc.c
> > > > > +++ b/fs/nfsd/nfsproc.c
> > > > > @@ -25,6 +25,13 @@ static __be32 map_status(__be32 status)
> > > > > case nfserr_file_open:
> > > > > status = nfserr_acces;
> > > > > break;
> > > > > + case nfserr_symlink_not_dir:
> > > > > + status = nfserr_notdir;
> > > > > + break;
> > > > > + case nfserr_symlink:
> > > > > + case nfserr_wrong_type:
> > > > > + status = nfserr_inval;
> > > > > + break;
> > > > > }
> > > > > return status;
> > > > > }
> > > >
> > > > Hi Neil,
> > > >
> > > > I'm seeing a set of failures in pynfs with this patch (json results
> > > > attached). I haven't looked in detail yet, but we should probably drop
> > > > this one for now.
> > >
> > > Most of the complaints are because pynfs is expecting the incorrect
> > > error code that nfsd currently returns, rather than the correct one that
> > > my patch makes it return.
> > >
> > > There is one where the internal error code of 10101 leaks out. That is
> > > NFSERR_SYMLNK_NOT_DIR.
> > > That certainly requires investigation.
> > >
> >
> > I'm not sure these error code changes are correct, now that I look. For
> > instance:
> >
> > {
> > "classname": "st_readlink",
> > "code": "RDLK2r",
> > "failure": {
> > "err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_readlink.py\", line 29, in testFile\n check(res, NFS4ERR_INVAL, \"READLINK on non-symlink objects\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE\n",
> > "message": "READLINK on non-symlink objects should return NFS4ERR_INVAL, instead got NFS4ERR_WRONG_TYPE"
> > },
> > "name": "testFile",
> > "time": "0.003440380096435547"
> > },
> >
> >
> > Looking at RFC7530, the READLINK section (16.25.5) says:
> >
> > The READLINK operation is only allowed on objects of type NF4LNK.
> > The server should return the error NFS4ERR_INVAL if the object is not
> > of type NF4LNK.
>
> RFC7530 is for NFSv4.0 It doesn't have NFS4ERR_WRONG_TYPE. So if this
> is a 4.0 test then that is indeed a bug. If the "nfs4.0" in the File
> path the only hit that this was 4.0 rather than 4.1?
> (RFC8881 declares this should be NFS4ERR_WRONG_TYPE for 4.1)
>
This was a v4.0 pynfs run, so yes it appears this was leaking out
somewhere.
> >
> > Several OPEN cases have errors similar to this one:
> >
> > {
> > "classname": "st_open",
> > "code": "OPEN7s",
> > "failure": {
> > "err": "Traceback (most recent call last):\n File \"/data/pynfs/nfs4.0/lib/testmod.py\", line 234, in run\n self.runtest(self, environment)\n File \"/data/pynfs/nfs4.0/servertests/st_open.py\", line 183, in testSocket\n check(res, NFS4ERR_SYMLINK, \"Trying to OPEN socket\")\n File \"/data/pynfs/nfs4.0/servertests/environment.py\", line 270, in check\n raise testmod.FailureException(msg)\ntestmod.FailureException: Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL\n",
> > "message": "Trying to OPEN socket should return NFS4ERR_SYMLINK, instead got NFS4ERR_INVAL"
> > },
> > "name": "testSocket",
> > "time": "0.006421566009521484"
> > },
> >
> > RFC7530, 16.16.6:
> >
> > If the component provided to OPEN resolves to something other than a
> > regular file (or a named attribute), an error will be returned to the
> > client. If it is a directory, NFS4ERR_ISDIR is returned; otherwise,
> > NFS4ERR_SYMLINK is returned. Note that NFS4ERR_SYMLINK is returned
> > for both symlinks and for special files of other types; NFS4ERR_INVAL
> > would be inappropriate, since the arguments provided by the client
> > were correct, and the client cannot necessarily know at the time it
> > sent the OPEN that the component would resolve to a non-regular file.
>
> Ahhh - thanks. The comments in the code seemed to suggest that the RFC
> wasn't specific. I guess I misread them.
>
> Thanks for the more careful analysis. I'll aim to have an update on
> Monday.
>
Sounds great!
> >
> > --
> > Jeff Layton <jlayton@kernel.org>
> >
> >
>
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-08-09 12:34 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 1:47 [PATCH 0/3] nfsd: move error code mapping to per-version code NeilBrown
2024-07-29 1:47 ` [PATCH 1/3] nfsd: Move error code mapping to per-version proc code NeilBrown
2024-07-29 15:04 ` Christoph Hellwig
2024-07-29 1:47 ` [PATCH 2/3] nfsd: be more systematic about selecting error codes for internal use NeilBrown
2024-07-29 15:05 ` Christoph Hellwig
2024-07-29 1:47 ` [PATCH 3/3] nfsd: move error choice for incorrect object types to version-specific code NeilBrown
2024-07-29 15:06 ` Christoph Hellwig
2024-08-08 10:37 ` Jeff Layton
2024-08-08 11:40 ` NeilBrown
2024-08-08 12:01 ` Jeff Layton
2024-08-08 22:00 ` NeilBrown
2024-08-09 12:34 ` Jeff Layton
2024-07-29 12:36 ` [PATCH 0/3] nfsd: move error code mapping to per-version code Jeff Layton
2024-07-29 15:16 ` Chuck Lever
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox