Commit e9361d50 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: correct rename error returns.

From: NeilBrown <neilb@cse.unsw.edu.au>

unlike v2/v3, nfsv4 returns nfserr_exist in some situations where the
underlying filesystem returns nfserr_isdir, nfserr_notdir.

on rename, nfsv4 returns nfserr_notdir instead of nfserr_symlink.
parent c4e92674
...@@ -476,6 +476,18 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, ...@@ -476,6 +476,18 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh,
status = nfsd_rename(rqstp, save_fh, rename->rn_sname, status = nfsd_rename(rqstp, save_fh, rename->rn_sname,
rename->rn_snamelen, current_fh, rename->rn_snamelen, current_fh,
rename->rn_tname, rename->rn_tnamelen); rename->rn_tname, rename->rn_tnamelen);
/* the underlying filesystem returns different error's than required
* by NFSv4. both save_fh and current_fh have been verified.. */
if (status == nfserr_isdir)
status = nfserr_exist;
else if ((status == nfserr_notdir) &&
(S_ISDIR(save_fh->fh_dentry->d_inode->i_mode) &&
S_ISDIR(current_fh->fh_dentry->d_inode->i_mode)))
status = nfserr_exist;
else if (status == nfserr_symlink)
status = nfserr_notdir;
if (!status) { if (!status) {
set_change_info(&rename->rn_sinfo, current_fh); set_change_info(&rename->rn_sinfo, current_fh);
set_change_info(&rename->rn_tinfo, save_fh); set_change_info(&rename->rn_tinfo, save_fh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment