From: David Howells <dhowells@redhat.com>
To: torvalds@linux-foundation.org
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@redhat.com>,
linux-kernel@vger.kernel.org, linux-cachefs@redhat.com,
Milosz Tanski <milosz@adfin.com>,
Yacine Belkadi <yacine.belkadi.1@gmail.com>
Subject: [PATCH] Fix __wait_on_atomic_t() to call the action func if the counter != 0
Date: Tue, 23 Jul 2013 16:49:24 +0100 [thread overview]
Message-ID: <20130723154924.24306.42326.stgit@warthog.procyon.org.uk> (raw)
Fix __wait_on_atomic_t() so that it calls the action func if the counter != 0
rather than if the counter is 0 so as to be analogous to __wait_on_bit().
Thanks to Yacine who found this by visual inspection.
This will affect FS-Cache in that it will could fail to sleep correctly when
trying to clean up after a netfs cookie is withdrawn.
Reported-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Yacine Belkadi <yacine.belkadi.1@gmail.com>
cc: Milosz Tanski <milosz@adfin.com>
cc: Jeff Layton <jlayton@redhat.com>
---
kernel/wait.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/wait.c b/kernel/wait.c
index ce0daa3..dec68bd 100644
--- a/kernel/wait.c
+++ b/kernel/wait.c
@@ -333,7 +333,8 @@ int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q,
prepare_to_wait(wq, &q->wait, mode);
val = q->key.flags;
if (atomic_read(val) == 0)
- ret = (*action)(val);
+ break;
+ ret = (*action)(val);
} while (!ret && atomic_read(val) != 0);
finish_wait(wq, &q->wait);
return ret;
next reply other threads:[~2013-07-23 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 15:49 David Howells [this message]
2013-07-23 16:02 ` [PATCH] Fix __wait_on_atomic_t() to call the action func if the counter != 0 Jeff Layton
2013-07-23 16:15 ` David Howells
2013-07-23 16:26 ` Jeff Layton
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=20130723154924.24306.42326.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=milosz@adfin.com \
--cc=torvalds@linux-foundation.org \
--cc=yacine.belkadi.1@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).