[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130723120258.01024e81@tlielax.poochiereds.net>
Date: Tue, 23 Jul 2013 12:02:58 -0400
From: Jeff Layton <jlayton@...hat.com>
To: David Howells <dhowells@...hat.com>
Cc: torvalds@...ux-foundation.org, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-cachefs@...hat.com,
Milosz Tanski <milosz@...in.com>,
Yacine Belkadi <yacine.belkadi.1@...il.com>
Subject: Re: [PATCH] Fix __wait_on_atomic_t() to call the action func if the
counter != 0
On Tue, 23 Jul 2013 16:49:24 +0100
David Howells <dhowells@...hat.com> wrote:
> 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@...il.com>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Yacine Belkadi <yacine.belkadi.1@...il.com>
> cc: Milosz Tanski <milosz@...in.com>
> cc: Jeff Layton <jlayton@...hat.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);
nit: can you now eliminate the check for "val" in the while condition?
It doesn't look like it harms anything, but eliminating it would
probably simplify the code slightly...
> finish_wait(wq, &q->wait);
> return ret;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jeff Layton <jlayton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists