All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: NFS <linux-nfs@vger.kernel.org>
Subject: [PATCH/RFC] remove incorrect "Lock reclaim failed" warning when delegation is in force.
Date: Thu, 8 Aug 2013 12:59:37 +1000	[thread overview]
Message-ID: <20130808125937.126d8ef1@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]


Hi,
 I'm trying to track down a strange problem with state ids going bad
 (possibly linked to ntp changing the system time on the non-Linux server)
 and am still learning about how the state management works.

 But I've come across an error where I don't think there should be one.

 For whatever reason the client gets a BAD_STATEID on a file that it has a
 lock on.  The open gets a write delegation so that when it runs
 nfs4_reclaim_locks(), nfs4_lock_reclaim aborts early without doing anything
 (it doesn't need to because there is a delegation).
 But the code below then checks that NFS_LOCK_INITIALIZED is set on all lock
 states.  But it isn't because nfs4_clear_open_state cleared it and
 nfs4_lock_reclaim didn't bother setting it.

 So I think the error should only be printed if there is no delegated state,
 hence this patch.

 Does it look right, or have I misunderstood something?

Thanks,
NeilBrown


diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 1fab140..1876ee7 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1444,14 +1444,16 @@ restart:
 		if (status >= 0) {
 			status = nfs4_reclaim_locks(state, ops);
 			if (status >= 0) {
-				spin_lock(&state->state_lock);
-				list_for_each_entry(lock, &state->lock_states, ls_locks) {
-					if (!test_bit(NFS_LOCK_INITIALIZED, &lock->ls_flags))
-						pr_warn_ratelimited("NFS: "
-							"%s: Lock reclaim "
-							"failed!\n", __func__);
+				if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) {
+					spin_lock(&state->state_lock);
+					list_for_each_entry(lock, &state->lock_states, ls_locks) {
+						if (!test_bit(NFS_LOCK_INITIALIZED, &lock->ls_flags))
+							pr_warn_ratelimited("NFS: "
+									    "%s: Lock reclaim "
+									    "failed!\n", __func__);
+					}
+					spin_unlock(&state->state_lock);
 				}
-				spin_unlock(&state->state_lock);
 				nfs4_put_open_state(state);
 				spin_lock(&sp->so_lock);
 				goto restart;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

             reply	other threads:[~2013-08-08  2:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08  2:59 NeilBrown [this message]
2013-08-08 15:51 ` [PATCH/RFC] remove incorrect "Lock reclaim failed" warning when delegation is in force Myklebust, Trond
2013-08-12  6:53   ` NeilBrown

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=20130808125937.126d8ef1@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.