mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
exportfs: be careful to only return expected errors.
When nfsd calls fh_to_dentry, it expect ESTALE or ENOMEM as errors. In particular it can be tempting to return ENOENT, but this is not handled well by nfsd. Rather than requiring strict adherence to error code code filesystems, treat all unexpected error codes the same as ESTALE. This is safest. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
7d22fc11c7
commit
09bb8bfffd
2 changed files with 13 additions and 10 deletions
|
@ -428,10 +428,10 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
|
|||
if (!nop || !nop->fh_to_dentry)
|
||||
return ERR_PTR(-ESTALE);
|
||||
result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type);
|
||||
if (!result)
|
||||
result = ERR_PTR(-ESTALE);
|
||||
if (IS_ERR(result))
|
||||
return result;
|
||||
if (PTR_ERR(result) == -ENOMEM)
|
||||
return ERR_CAST(result);
|
||||
if (IS_ERR_OR_NULL(result))
|
||||
return ERR_PTR(-ESTALE);
|
||||
|
||||
if (d_is_dir(result)) {
|
||||
/*
|
||||
|
@ -541,6 +541,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
|
|||
|
||||
err_result:
|
||||
dput(result);
|
||||
if (err != -ENOMEM)
|
||||
err = -ESTALE;
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(exportfs_decode_fh);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue