[PATCH 1/2] nfsd: return NFS4ERR_SERVERFAULT from PUTROOTFH when path in /etc/exports not found

Benny Halevy bhalevy at panasas.com
Sun Jan 20 11:23:52 EST 2008


Currently, when /etc/exports refers to a non-existing path, e.g.:
/foo     *(fsid=0,rw,sync,no_subtree_check,no_root_squash,insecure)

nfsd4_putrootfh returns NFS4ERR_PERM which is not a valid nfsv4 error return
for PUTROOTFH (nor in nfsv4.1).

NFSv4 allows the following errors for PUTROOTFH:
      NFS4ERR_RESOURCE
      NFS4ERR_SERVERFAULT
      NFS4ERR_WRONGSEC
amongst which, NFS4ERR_SERVERFAULT seems to make the most sense in this case.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfsd/export.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 66d0aeb..b8b8818 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1357,10 +1357,8 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
 	mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
 
 	exp = rqst_exp_find(rqstp, FSID_NUM, fsidv);
-	if (PTR_ERR(exp) == -ENOENT)
-		return nfserr_perm;
 	if (IS_ERR(exp))
-		return nfserrno(PTR_ERR(exp));
+		return nfserr_serverfault;
 	rv = fh_compose(fhp, exp, exp->ex_dentry, NULL);
 	if (rv)
 		goto out;
-- 
1.5.3.3



More information about the NFSv4 mailing list