public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: "Trond.Myklebust" <trond.myklebust@fys.uio.no>
Cc: NFSv3 list <linux-nfs@vger.kernel.org>,
	"J. Bruce Fields" <bfields@fieldses.org>
Subject: [PATCH] Fix bug at nlmclnt_lock()
Date: Thu, 12 Nov 2009 17:40:19 +0800	[thread overview]
Message-ID: <4AFBD803.9080204@cn.fujitsu.com> (raw)

When testing NLM, i found a bug.

Test process:
step1: client open file.
step2: keep network partition.
step3: client call fcntl with SETLKW to get lock.
       (it will timeout and return -1)
step4: recover network.
step5: client try to get lock again, but it always fail.

At nlmclnt_lock(), resp->status is set to "nlm_lck_blocked" 
by default before call nlmclnt_call().

So at step3, when nlmclnt_call return error because network partition,
client will think the nlm_lck_blocked was replied from server, and it
just send cancel request not unlock.

Signed-off-by: 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.2

thanks,
Mi Jinlong


                 reply	other threads:[~2009-11-12  9:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AFBD803.9080204@cn.fujitsu.com \
    --to=mijinlong@cn.fujitsu.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox