Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



J. Bruce Fields 写道:
On Thu, Mar 19, 2009 at 08:37:05AM +0800, Ni Wenjuan wrote:
Fix a test in rename operation. rename dir1 into existing,nonempty dir2 should
return  NFS4ERR_EXIST instead got NFS4ERR_NOTEMPTY. RFC says if the target is a
directory but not empty, the server will return the error, NFS4ERR_EXIST.

On a second look: could you double-check the client behavior?:
Currently

	mkdir subdir
	mkdir -p todir/subdir
	touch todir/subdir/foo
	mv subdir todir/

results (as in the local case) in "Directory not empty".  What happens
after applying this patch?

--b.

before patch, if you execute "mv subdir todir/" ,client (as in the local case) will notices you that cannot move 'subdir' to a subdirectory of itself ,'todir/subdie'.

after applying patch, if you execute "mv subdir todir/" ,it will notices you that can't move 'subdir to todir/subdir' :File exists .



Signed-off-by:Ni Wenjuan  <niwj@xxxxxxxxxxxxxx>

---
 fs/nfsd/nfs4proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 9fa60a3..c1e2e22 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -605,7 +605,7 @@ nfsd4_rename(struct svc_rqst *rqstp, struct
nfsd4_compound_state *cstate,

 	/* the underlying filesystem returns different error's than required
 	 * by NFSv4. both save_fh and current_fh have been verified.. */
-	if (status == nfserr_isdir)
+	if (status == nfserr_isdir || status == nfserr_notempty)
 		status = nfserr_exist;
 	else if ((status == nfserr_notdir) &&
                   (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) &&
--





--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux