2009-03-19 00:37:48

by Ni Wenjuan

[permalink] [raw]
Subject: [PATCH] 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_NOTEMPTY. RFC says if the target is a
directory but not empty, the server will return the error, NFS4ERR_EXIST.

Signed-off-by:Ni Wenjuan <[email protected]>

---
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) &&
--



2009-03-18 23:10:04

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

On Wed, Mar 18, 2009 at 09:55:47AM +0800, Ni Wenjuan wrote:
> Ni Wenjuan =E5=86=99=E9=81=93:
> > 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.
> >=20
> > Signed-off-by:Ni Wenjuan <[email protected]>
> >=20
> > ---
> > fs/nfsd/nfs4proc.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >=20
> > 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,
> >=20
> > /* the underlying filesystem returns different error's than requi=
red
> > * by NFSv4. both save_fh and current_fh have been verified.. */
> > - if (status =3D=3D nfserr_isdir)
> > + if (status =3D=3D nfserr_isdir || status =3D=3D nfserr_notempty)
> > status =3D nfserr_exist;
> > else if ((status =3D=3D nfserr_notdir) &&
> > (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_m=
ode) &&
>=20
> Bruce ,do you think this patch is ok ? Can it be accepted?

OK. Did you already post this patch? Sorry, I can't seem to find it.
Could you repost in the standard format?

--b.

2009-03-19 19:47:24

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

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.

>
> Signed-off-by:Ni Wenjuan <[email protected]>
>
> ---
> 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) &&
> --
>

2009-03-20 03:59:38

by Ni Wenjuan

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

J. Bruce Fields =E5=86=99=E9=81=93:
> On Thu, Mar 19, 2009 at 08:37:05AM +0800, Ni Wenjuan wrote:
>> Fix a test in rename operation. rename dir1 into existing,nonempty d=
ir2 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_E=
XIST.
>=20
> On a second look: could you double-check the client behavior?:
> Currently
>=20
> mkdir subdir
> mkdir -p todir/subdir
> touch todir/subdir/foo
> mv subdir todir/
>=20
> results (as in the local case) in "Directory not empty". What happen=
s
> after applying this patch?
>=20
> --b.

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

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


>=20
>> Signed-off-by:Ni Wenjuan <[email protected]>
>>
>> ---
>> 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 requir=
ed
>> * by NFSv4. both save_fh and current_fh have been verified.. */
>> - if (status =3D=3D nfserr_isdir)
>> + if (status =3D=3D nfserr_isdir || status =3D=3D nfserr_notempty)
>> status =3D nfserr_exist;
>> else if ((status =3D=3D nfserr_notdir) &&
>> (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mo=
de) &&
>> --=20
>>
>=20
>=20



2009-03-18 01:56:30

by Ni Wenjuan

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

Ni Wenjuan =D0=B4=B5=C0:
> Fix a test in rename operation. rename dir1 into existing,nonempty di=
r2 should
> return NFS4ERR_EXIST instead got NFS4ERR_NOTEMPTY. RFC says if the t=
arget is a
> directory but not empty, the server will return the error, NFS4ERR_EX=
IST.
>=20
> Signed-off-by:Ni Wenjuan <[email protected]>
>=20
> ---
> fs/nfsd/nfs4proc.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>=20
> 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,
>=20
> /* the underlying filesystem returns different error's than require=
d
> * by NFSv4. both save_fh and current_fh have been verified.. */
> - if (status =3D=3D nfserr_isdir)
> + if (status =3D=3D nfserr_isdir || status =3D=3D nfserr_notempty)
> status =3D nfserr_exist;
> else if ((status =3D=3D nfserr_notdir) &&
> (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mod=
e) &&

Bruce ,do you think this patch is ok ? Can it be accepted?


2009-03-11 23:46:15

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

On Tue, Mar 10, 2009 at 04:22:47PM +0800, Yang Hongyang wrote:
> Ni Wenjuan wrote:
> > 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.

>
> > ------
> > fs/nfsd/nfs4proc.c | 2 +-
> > 1 files changed, 1 insertion(+) ,1 deletion (-)
> >
> > diff -Nurp fs/nfsd/nfs4proc_orig.c fs/nfsd/nfs4proc.c
> > --- fs/nfsd/nfs4proc_orig.c 2009-02-23 20:28:56.000000000 +0800
> > +++ fs/nfsd/nfs4proc.c 2009-03-05 16:56:56.000000000 +0800
> >
> > @@ -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
> >
> >
>
>
> --
> 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

2009-04-03 05:24:49

by Ni Wenjuan

[permalink] [raw]
Subject: Re: [PATCH] Replace NFS4ERR_NOTEMPY with NFS4ERR_EXIST

> J. Bruce Fields =E5=86=99=E9=81=93:
>> 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 happe=
ns
>> 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'.
>=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 .
>=20
>=20


Bruce , is there any other problems about this patch?

>>
>>> Signed-off-by:Ni Wenjuan <[email protected]>
>>>
>>> ---
>>> 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 re=
quired
>>> * by NFSv4. both save_fh and current_fh have been verified.. =
*/
>>> - if (status =3D=3D nfserr_isdir)
>>> + if (status =3D=3D nfserr_isdir || status =3D=3D nfserr_notempt=
y)
>>> status =3D nfserr_exist;
>>> else if ((status =3D=3D nfserr_notdir) &&
>>> (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_m=
ode) &&
>>> --=20
>>>
>>
>>