Skip to contentSkip to conversation

Fix bug nfslock request sending fail will be process as blocked

PATCH In review Mi Jinlong 2 participants 5 messages Mar 12, 2010 – Mar 17, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Mi Jinlong

author
#0 lore raw

PATCH 1/1 Fix bug nfslock request sending fail will be process as blocked

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.

---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/lockd/clntproc.c +1 -1
index c81249f..a631582 100644
@@ -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;
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 17 lines · Mi Jinlong

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.

---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/lockd/clntproc.c +0 -0
index c81249f..a631582 100644

fs/lockd/clntproc.c again: · line 541

Quoted 8 lines
fs/lockd/clntproc.c +1 -1
@@ -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

A message that is not in the archive (sent off-list or not yet received): 1268401329.3156.12.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

author
#3 lore raw

Trond Myklebust =E5=86=99=E9=81=93:

Quoted 13 lines

On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20

Quoted 12 lines

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.

---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines

fs/lockd/clntproc.c again: · line 541

Quoted 13 lines
fs/lockd/clntproc.c +1 -1
index c81249f..a631582 100644
@@ -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

Quoted 1 line

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

#4 lore raw

On Tue, 2010-03-16 at 18:20 +0800, Mi Jinlong wrote:=20

Quoted 5 lines

=20
Trond Myklebust =E5=86=99=E9=81=93:

Quoted 3 lines

On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20

Quoted 2 lines

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

=20

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

at first now.

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

---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
fs/lockd/clntproc.c +0 -0
index c81249f..a631582 100644
@@ -535,7 +535,7 @@ again:
 	 * Initialise resp->status to a valid non-zero value,
 	 * since 0 =3D=3D nlm_lck_granted
 	 */
Quoted 8 lines

fs/lockd/clntproc.c again: · line 541

Quoted 5 lines
fs/lockd/clntproc.c +1 -1
-	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

Quoted 3 lines
Quoted 1 line

interrupted lock request without sending the CANCEL request...

=20
No, the above patch don't just abandon the interrupted lock request=

,

Quoted 1 line

when the RPC call was interrupted, client will send an UNLOCK reque=

st for status < 0.

Quoted 6 lines
   ...
   583         if (status < 0)
   584                 goto out_unlock;
   ...

=20
And, I think an UNLOCK request is more advisable than a CANCEL requ=

est.

Quoted 1 line

If a LOCK request was succeed when CANCEL request coming, it's usel=

ess;

Quoted 1 line

the lock should be unlocked.

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

Trond

A message that is not in the archive (sent off-list or not yet received): 1268745162.3155.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

author
#6 lore raw

Trond Myklebust =E5=86=99=E9=81=93:

Quoted 5 lines

On Tue, 2010-03-16 at 18:20 +0800, Mi Jinlong wrote:=20

Quoted 4 lines

Trond Myklebust =E5=86=99=E9=81=93:

Quoted 3 lines

On Fri, 2010-03-12 at 18:17 +0800, Mi Jinlong wrote:=20

Quoted 2 lines

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

=20

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

at first now.

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

---
 fs/lockd/clntproc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
fs/lockd/clntproc.c +0 -0
index c81249f..a631582 100644
@@ -535,7 +535,7 @@ again:
 	 * Initialise resp->status to a valid non-zero value,
 	 * since 0 =3D=3D nlm_lck_granted
Quoted 8 lines
Quoted 8 lines

fs/lockd/clntproc.c again:

Quoted 6 lines
fs/lockd/clntproc.c +1 -1
 	 */
-	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

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

interrupted lock request without sending the CANCEL request...

No, the above patch don't just abandon the interrupted lock reques=

t,

Quoted 1 line
Quoted 1 line

when the RPC call was interrupted, client will send an UNLOCK requ=

est for status < 0.

Quoted 6 lines
Quoted 6 lines
   ...
   583         if (status < 0)
   584                 goto out_unlock;
   ...

And, I think an UNLOCK request is more advisable than a CANCEL req=

uest.

Quoted 1 line
Quoted 1 line

If a LOCK request was succeed when CANCEL request coming, it's use=

less;

Quoted 4 lines
Quoted 1 line

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