Skip to contentSkip to conversation

Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

PATCH In review Ni Wenjuan 3 participants 4 messages Mar 10, 2009 – Apr 3, 2009

Subsystems (2)
lore
Share & tools
lore

Ni Wenjuan

author
#0 lore raw

PATCH 1/1 Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

Fix a test in rename operation. rename dir1 into existing,nonempty dir2 should return NFS4ERR_EXIST instead got NFS4ERR_NOTEMPY. RFC says if the target is a directory but not empty, the server will return the error, NFS4ERR_EXIST.

------
fs/nfsd/nfs4proc.c | 2 +-

1 files changed, 1 insertion(+) ,1 deletion (-)
nfsd/nfs4proc.c renamed from nfsd/nfs4proc_orig.c +0 -0
diff -Nurp fs/nfsd/nfs4proc_orig.c fs/nfsd/nfs4proc.c

@@ -585,10 +586,11 @@ nfsd4_rename(struct svc_rqst *rqstp, str
status = nfsd_rename(rqstp, save_fh, rename->rn_sname,
rename->rn_snamelen, current_fh, 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)
    +	if (status == nfserr_isdir || status == nfserr_notempty)
  		status = nfserr_exist;
  	else if ((status == nfserr_notdir) &&
                    (S_ISDIR(save_fh->fh_dentry->d_inode->i_mode) &&
#1 lore raw
Quoted 4 lines · Ni Wenjuan

Fix a test in rename operation. rename dir1 into existing,nonempty dir2 should return NFS4ERR_EXIST instead got NFS4ERR_NOTEMPY. RFC says if the target is a directory but not empty, the server will return the error, NFS4ERR_EXIST.

SOF && please use git to generate patch.

Quoted 28 lines

------
fs/nfsd/nfs4proc.c | 2 +-

1 files changed, 1 insertion(+) ,1 deletion (-)

diff -Nurp fs/nfsd/nfs4proc_orig.c fs/nfsd/nfs4proc.c

nfsd/nfs4proc.c renamed from nfsd/nfs4proc_orig.c +0 -1
@@ -585,10 +586,11 @@ nfsd4_rename(struct svc_rqst *rqstp, str
   	status = nfsd_rename(rqstp, save_fh, rename->rn_sname,
  			     rename->rn_snamelen, current_fh,
  			     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)
    +	if (status == nfserr_isdir || status == nfserr_notempty)
  		status = nfserr_exist;
  	else if ((status == nfserr_notdir) &&
                    (S_ISDIR(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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Regards
Yang Hongyang
#2 lore raw
Quoted 7 lines · Yang Hongyang
Quoted 4 lines · Ni Wenjuan

Fix a test in rename operation. rename dir1 into existing,nonempty dir2 should return NFS4ERR_EXIST instead got NFS4ERR_NOTEMPY. RFC says if the target is a directory but not empty, the server will return the error, NFS4ERR_EXIST.

SOF && please use git to generate patch.

Also, when you resend--could send any server patches to me (in addition to the linux-nfs list)?

The content of the patch looks ok, thanks.

--b.

Quoted 38 lines
Quoted 29 lines

------
fs/nfsd/nfs4proc.c | 2 +-

1 files changed, 1 insertion(+) ,1 deletion (-)

diff -Nurp fs/nfsd/nfs4proc_orig.c fs/nfsd/nfs4proc.c

nfsd/nfs4proc.c renamed from nfsd/nfs4proc_orig.c +0 -1
@@ -585,10 +586,11 @@ nfsd4_rename(struct svc_rqst *rqstp, str
   	status = nfsd_rename(rqstp, save_fh, rename->rn_sname,
  			     rename->rn_snamelen, current_fh,
  			     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)
    +	if (status == nfserr_isdir || status == nfserr_notempty)
  		status = nfserr_exist;
  	else if ((status == nfserr_notdir) &&
                    (S_ISDIR(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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Regards
Yang Hongyang
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#3 lore raw
Quoted 3 lines

J. Bruce Fields =E5=86=99=E9=81=93:

Quoted 2 lines · Ni Wenjuan
Quoted 1 line

Fix a test in rename operation. rename dir1 into existing,nonempty =

dir2 should

Quoted 1 line
Quoted 1 line
Quoted 1 line

return NFS4ERR_EXIST instead got NFS4ERR_NOTEMPTY. RFC says if the=

target is a

Quoted 1 line
Quoted 1 line
Quoted 1 line

directory but not empty, the server will return the error, NFS4ERR_=

EXIST.

Quoted 10 lines
Quoted 10 lines

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 happe=

ns

Quoted 5 lines
Quoted 3 lines

after applying this patch?

--b.

=20
before patch, if you execute "mv subdir todir/" ,client (as in the =

local case) will notices you that cannot move 'subdir' to a subdirector= y of itself ,'todir/subdie'.

Quoted 2 lines

=20
after applying patch, if you execute "mv subdir todir/" ,it will not=

ices you that can't move 'subdir to todir/subdir' :File exists .

Quoted 2 lines

=20
=20

Bruce , is there any other problems about this patch?

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

fs/nfsd/nfs4proc.c nfsd4_rename(struct svc_rqst *rqstp, struct · line 607

Quoted 8 lines
fs/nfsd/nfs4proc.c +0 -0
index 9fa60a3..c1e2e22 100644
@@ -605,7 +605,7 @@ nfsd4_rename(struct svc_rqst *rqstp, struct
 nfsd4_compound_state *cstate,
 
     /* the underlying filesystem returns different error's than re=

quired

Quoted 1 line
Quoted 1 line

fs/nfsd/nfs4proc.c nfsd4_rename(struct svc_rqst *rqstp, struct · line 608

Quoted 1 line
fs/nfsd/nfs4proc.c +0 -0
      * by NFSv4. both save_fh and current_fh have been verified.. =

*/

Quoted 2 lines
Quoted 2 lines

fs/nfsd/nfs4proc.c nfsd4_rename(struct svc_rqst *rqstp, struct · line 609

Quoted 2 lines
fs/nfsd/nfs4proc.c +1 -1
-    if (status =3D=3D nfserr_isdir)
+    if (status =3D=3D nfserr_isdir || status =3D=3D nfserr_notempt=

y)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
fs/nfsd/nfs4proc.c +0 -0
         status =3D nfserr_exist;
     else if ((status =3D=3D nfserr_notdir) &&
                   (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_m=

ode) &&

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

--=20