[PATCH 1/2] nfsd: return NFS4ERR_SERVERFAULT from PUTROOTFH when path in /etc/exports not found
J. Bruce Fields
bfields at fieldses.org
Sun Jan 20 15:30:31 EST 2008
On Sun, Jan 20, 2008 at 06:23:52PM +0200, Benny Halevy wrote:
> 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.
If the most helpful error to return on the client side is actually
ENOENT, then returning NFS4ERR_SERVERFAULT and depending on the client
to map that to ENOENT seems a roundabout way to do it. Just returning
NFS4ERR_ENOENT would seem more in the spirit of interoperability even if
it violates the letter of the spec.
But perhaps there's also more we should do in mountd or exportfs to
avoid this situation in the first place.
--b.
>
> 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