public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix bug nfslock request sending fail will be process as blocked
@ 2010-03-12 10:17 Mi Jinlong
  2010-03-12 13:42 ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Mi Jinlong @ 2010-03-12 10:17 UTC (permalink / raw)
  To: J. Bruce Fields, Chuck Lever, Trond.Myklebust, NFSv3 list


If local reason cause nfslock request send fail(means status < 0,
resp->status not be reset), the request will be process as blocked 
at first now.

This patch initialize resp->status to nlm_lck_denied_nolocks, it 
can make the following process correctly.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index c81249f..a631582 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -535,7 +535,7 @@ again:
 	 * Initialise resp->status to a valid non-zero value,
 	 * since 0 == nlm_lck_granted
 	 */
-	resp->status = nlm_lck_blocked;
+	resp->status = nlm_lck_denied_nolocks;
 	for(;;) {
 		/* Reboot protection */
 		fl->fl_u.nfs_fl.state = host->h_state;
-- 
1.6.5.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix bug nfslock request sending fail will be process as blocked
  2010-03-12 10:17 [PATCH] Fix bug nfslock request sending fail will be process as blocked Mi Jinlong
@ 2010-03-12 13:42 ` Trond Myklebust
       [not found]   ` <1268401329.3156.12.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2010-03-12 13:42 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: J. Bruce Fields, Chuck Lever, NFSv3 list

On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote: 
> If local reason cause nfslock request send fail(means status < 0,
> resp->status not be reset), the request will be process as blocked 
> at first now.
> 
> This patch initialize resp->status to nlm_lck_denied_nolocks, it 
> can make the following process correctly.
> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> ---
>  fs/lockd/clntproc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
> index c81249f..a631582 100644
> --- a/fs/lockd/clntproc.c
> +++ b/fs/lockd/clntproc.c
> @@ -535,7 +535,7 @@ again:
>  	 * Initialise resp->status to a valid non-zero value,
>  	 * since 0 == nlm_lck_granted
>  	 */
> -	resp->status = nlm_lck_blocked;
> +	resp->status = nlm_lck_denied_nolocks;
>  	for(;;) {
>  		/* Reboot protection */
>  		fl->fl_u.nfs_fl.state = host->h_state;

We _want_ to process it as being blocked if the RPC call was
interrupted. The above patch will cause the client to just abandon the
interrupted lock request without sending the CANCEL request...

Trond


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix bug nfslock request sending fail will be process as blocked
       [not found]   ` <1268401329.3156.12.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-03-16 10:20     ` Mi Jinlong
  2010-03-16 13:12       ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Mi Jinlong @ 2010-03-16 10:20 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: J. Bruce Fields, Chuck Lever, NFSv3 list



Trond Myklebust =E5=86=99=E9=81=93:
> On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20
>> If local reason cause nfslock request send fail(means status < 0,
>> resp->status not be reset), the request will be process as blocked=20
>> at first now.
>>
>> This patch initialize resp->status to nlm_lck_denied_nolocks, it=20
>> can make the following process correctly.
>>
>> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>> ---
>>  fs/lockd/clntproc.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
>> index c81249f..a631582 100644
>> --- a/fs/lockd/clntproc.c
>> +++ b/fs/lockd/clntproc.c
>> @@ -535,7 +535,7 @@ again:
>>  	 * Initialise resp->status to a valid non-zero value,
>>  	 * since 0 =3D=3D nlm_lck_granted
>>  	 */
>> -	resp->status =3D nlm_lck_blocked;
>> +	resp->status =3D nlm_lck_denied_nolocks;
>>  	for(;;) {
>>  		/* Reboot protection */
>>  		fl->fl_u.nfs_fl.state =3D host->h_state;
>=20
> We _want_ to process it as being blocked if the RPC call was
> interrupted. The above patch will cause the client to just abandon th=
e
> interrupted lock request without sending the CANCEL request...

  No, the above patch don't just abandon the interrupted lock request,
  when the RPC call was interrupted, client will send an UNLOCK request=
 for status < 0.
   ...
   583         if (status < 0)
   584                 goto out_unlock;
   ...

  And, I think an UNLOCK request is more advisable than a CANCEL reques=
t.
  If a LOCK request was succeed when CANCEL request coming, it's useles=
s;
  the lock should be unlocked.

  That's only my opinion.

thanks,
Mi Jinlong


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix bug nfslock request sending fail will be process as blocked
  2010-03-16 10:20     ` Mi Jinlong
@ 2010-03-16 13:12       ` Trond Myklebust
       [not found]         ` <1268745162.3155.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2010-03-16 13:12 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: J. Bruce Fields, Chuck Lever, NFSv3 list

On Tue, 2010-03-16 at 18:20 +0800, Mi Jinlong wrote:=20
>=20
> Trond Myklebust =E5=86=99=E9=81=93:
> > On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20
> >> If local reason cause nfslock request send fail(means status < 0,
> >> resp->status not be reset), the request will be process as blocked=
=20
> >> at first now.
> >>
> >> This patch initialize resp->status to nlm_lck_denied_nolocks, it=20
> >> can make the following process correctly.
> >>
> >> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> >> ---
> >>  fs/lockd/clntproc.c |    2 +-
> >>  1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
> >> index c81249f..a631582 100644
> >> --- a/fs/lockd/clntproc.c
> >> +++ b/fs/lockd/clntproc.c
> >> @@ -535,7 +535,7 @@ again:
> >>  	 * Initialise resp->status to a valid non-zero value,
> >>  	 * since 0 =3D=3D nlm_lck_granted
> >>  	 */
> >> -	resp->status =3D nlm_lck_blocked;
> >> +	resp->status =3D nlm_lck_denied_nolocks;
> >>  	for(;;) {
> >>  		/* Reboot protection */
> >>  		fl->fl_u.nfs_fl.state =3D host->h_state;
> >=20
> > We _want_ to process it as being blocked if the RPC call was
> > interrupted. The above patch will cause the client to just abandon =
the
> > interrupted lock request without sending the CANCEL request...
>=20
>   No, the above patch don't just abandon the interrupted lock request=
,
>   when the RPC call was interrupted, client will send an UNLOCK reque=
st for status < 0.
>    ...
>    583         if (status < 0)
>    584                 goto out_unlock;
>    ...
>=20
>   And, I think an UNLOCK request is more advisable than a CANCEL requ=
est.
>   If a LOCK request was succeed when CANCEL request coming, it's usel=
ess;
>   the lock should be unlocked.

An unlock does not guarantee that the server will cancel the blocked
lock request.

Trond


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix bug nfslock request sending fail will be process as blocked
       [not found]         ` <1268745162.3155.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-03-17 10:03           ` Mi Jinlong
  0 siblings, 0 replies; 5+ messages in thread
From: Mi Jinlong @ 2010-03-17 10:03 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: J. Bruce Fields, Chuck Lever, NFSv3 list



Trond Myklebust =E5=86=99=E9=81=93:
> On Tue, 2010-03-16 at 18:20 +0800, Mi Jinlong wrote:=20
>> Trond Myklebust =E5=86=99=E9=81=93:
>>> On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20
>>>> If local reason cause nfslock request send fail(means status < 0,
>>>> resp->status not be reset), the request will be process as blocked=
=20
>>>> at first now.
>>>>
>>>> This patch initialize resp->status to nlm_lck_denied_nolocks, it=20
>>>> can make the following process correctly.
>>>>
>>>> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>>>> ---
>>>>  fs/lockd/clntproc.c |    2 +-
>>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
>>>> index c81249f..a631582 100644
>>>> --- a/fs/lockd/clntproc.c
>>>> +++ b/fs/lockd/clntproc.c
>>>> @@ -535,7 +535,7 @@ again:
>>>>  	 * Initialise resp->status to a valid non-zero value,
>>>>  	 * since 0 =3D=3D nlm_lck_granted
>>>>  	 */
>>>> -	resp->status =3D nlm_lck_blocked;
>>>> +	resp->status =3D nlm_lck_denied_nolocks;
>>>>  	for(;;) {
>>>>  		/* Reboot protection */
>>>>  		fl->fl_u.nfs_fl.state =3D host->h_state;
>>> We _want_ to process it as being blocked if the RPC call was
>>> interrupted. The above patch will cause the client to just abandon =
the
>>> interrupted lock request without sending the CANCEL request...
>>   No, the above patch don't just abandon the interrupted lock reques=
t,
>>   when the RPC call was interrupted, client will send an UNLOCK requ=
est for status < 0.
>>    ...
>>    583         if (status < 0)
>>    584                 goto out_unlock;
>>    ...
>>
>>   And, I think an UNLOCK request is more advisable than a CANCEL req=
uest.
>>   If a LOCK request was succeed when CANCEL request coming, it's use=
less;
>>   the lock should be unlocked.
>=20
> An unlock does not guarantee that the server will cancel the blocked
> lock request.

  When server receive an UNLOCK request, it will try to cancel the lock=
 at first,
  codes as follows:
    ...
    567 nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
    568 {
    ....
    578         /* First, cancel any lock that might be there */
    579         nlmsvc_cancel_blocked(file, lock);
    ...

  Server don't process the nlmsvc_cancel_blocked's return value, is it =
the problem=20
  that you said above ? or some other reason?

  Server cannot cancel the blocked lock request, it's acceptable someti=
mes, IMO,
  but client should work strongly itself.

thanks,
Mi Jinlong


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-17 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 10:17 [PATCH] Fix bug nfslock request sending fail will be process as blocked Mi Jinlong
2010-03-12 13:42 ` Trond Myklebust
     [not found]   ` <1268401329.3156.12.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-16 10:20     ` Mi Jinlong
2010-03-16 13:12       ` Trond Myklebust
     [not found]         ` <1268745162.3155.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-17 10:03           ` Mi Jinlong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox