knfsd: LOOKUP can return an illegal error value
Subsystems (3)
[email protected]
maintainerPATCH 1/2 knfsd: LOOKUP can return an illegal error value
From: Trond Myklebust <[email protected]>
The 'NFS error' NFSERR_OPNOTSUPP is not described by any of the official NFS related RFCs, but appears to have snuck into some older .x files for NFSv2.
Either way, it is not in RFC1094, RFC1813 or any of the NFSv4 RFCs, so should not be returned by the knfsd server, and particularly not by the "LOOKUP" operation.
Instead, let's return NFSERR_STALE, which is more appropriate if the filesystem encodes the filehandle as FILEID_INVALID.
--- fs/nfsd/nfsfh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsfh.c +2 -2
@@ -572,7 +572,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,_fh_update (fhp, exp, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) {fh_put (fhp); -return nfserr_opnotsupp; +return nfserr_stale; }return 0 ;
@@ -598,7 +598,7 @@ fh_update(struct svc_fh *fhp)_fh_update (fhp, fhp->fh_export, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) -return nfserr_opnotsupp; +return nfserr_stale;return 0 ; out_bad:printk (KERN_ERR "fh_update: fh not verified!\n" );
Signature · 1 line
2.45.0
[email protected]
maintainerPATCH 2/2 NFS/knfsd: Remove the invalid NFS error 'NFSERR_OPNOTSUPP'
From: Trond Myklebust <[email protected]>
NFSERR_OPNOTSUPP is not described by any RFC, and should not be used.
--- fs/nfsd/nfsd.h | 1 - include/trace/misc/nfs.h | 2 -- include/uapi/linux/nfs.h | 1 - 3 files changed, 4 deletions(-)
fs/nfsd/nfsd.h +0 -1
@@ -229,7 +229,6 @@ void nfsd_lockd_shutdown(void);#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)#define nfserr_mlink cpu_to_be32(NFSERR_MLINK) -#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
include/trace/misc/nfs.h +0 -2
@@ -28,7 +28,6 @@ TRACE_DEFINE_ENUM(NFSERR_FBIG);TRACE_DEFINE_ENUM (NFSERR_NOSPC );TRACE_DEFINE_ENUM (NFSERR_ROFS );TRACE_DEFINE_ENUM (NFSERR_MLINK ); -TRACE_DEFINE_ENUM (NFSERR_OPNOTSUPP );TRACE_DEFINE_ENUM (NFSERR_NAMETOOLONG );TRACE_DEFINE_ENUM (NFSERR_NOTEMPTY );TRACE_DEFINE_ENUM (NFSERR_DQUOT );
@@ -64,7 +63,6 @@ TRACE_DEFINE_ENUM(NFSERR_JUKEBOX); { NFSERR_NOSPC, "NOSPC" }, \ { NFSERR_ROFS, "ROFS" }, \ { NFSERR_MLINK, "MLINK" }, \ - { NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \ { NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \ { NFSERR_NOTEMPTY, "NOTEMPTY" }, \ { NFSERR_DQUOT, "DQUOT" }, \
include/uapi/linux/nfs.h +0 -1
@@ -61,7 +61,6 @@NFSERR_NOSPC =28 ,/* v2 v3 v4 */ NFSERR_ROFS =30 ,/* v2 v3 v4 */ NFSERR_MLINK =31 ,/* v3 v4 */ -NFSERR_OPNOTSUPP =45 ,/* v2 v3 */ NFSERR_NAMETOOLONG =63 ,/* v2 v3 v4 */ NFSERR_NOTEMPTY =66 ,/* v2 v3 v4 */ NFSERR_DQUOT = 69, /* v2 v3 v4 */
Signature · 1 line
2.45.0
Quoted 9 lines · On Mon, May 06, 2024 at 12:30:04PM -0400, [email protected] wrote:
From: Trond Myklebust <[email protected]>
The 'NFS error'
NFSERR_OPNOTSUPPis not described by any of the official NFS related RFCs, but appears to have snuck into some older .x files for NFSv2.
Either way, it is not in RFC1094, RFC1813 or any of the NFSv4 RFCs, so should not be returned by the knfsd server, and particularly not by the "LOOKUP" operation.
Quoted 8 lines
Instead, let's return
NFSERR_STALE, which is more appropriate if the filesystem encodes the filehandle asFILEID_INVALID.Signed-off-by Trond Myklebust <[email protected]>--- fs/nfsd/nfsfh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Hi, both applied to nfsd-next (for v6.10). Thanks!
Quoted 25 lines
fs/nfsd/nfsfh.c +2
-2@@ -572,7 +572,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,_fh_update (fhp, exp, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) {fh_put (fhp); -return nfserr_opnotsupp; +return nfserr_stale; }return 0 ;@@ -598,7 +598,7 @@ fh_update(struct svc_fh *fhp)_fh_update (fhp, fhp->fh_export, dentry);if (fhp->fh_handle.fh_fileid_type ==FILEID_INVALID ) -return nfserr_opnotsupp; +return nfserr_stale;return 0 ; out_bad:printk (KERN_ERR "fh_update: fh not verified!\n" );Signature · 1 line
2.45.0
Signature · 1 line
Chuck Lever