From: Jeff Moyer <jmoyer@redhat.com>
To: Roland Dreier <roland@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-aio@kvack.org, linux-kernel@vger.kernel.org,
Benjamin LaHaise <bcrl@kvack.org>
Subject: Re: [PATCH] aio: Wake all waiters when destroying ctx
Date: Fri, 11 Mar 2011 09:21:46 -0500 [thread overview]
Message-ID: <x49fwqthh51.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <1299822937-6522-1-git-send-email-roland@kernel.org> (Roland Dreier's message of "Thu, 10 Mar 2011 21:55:37 -0800")
Roland Dreier <roland@kernel.org> writes:
> From: Roland Dreier <roland@purestorage.com>
>
> The test program below will hang because io_getevents() uses
> add_wait_queue_exclusive(), which means the wake_up() in io_destroy()
> only wakes up one of the threads. Fix this by using wake_up_all() in
> the aio code paths where we want to make sure no one gets stuck.
[snip]
> Cc: <stable@kernel.org>
> Signed-off-by: Roland Dreier <roland@purestorage.com>
> ---
> fs/aio.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 26869cd..88f0ed5 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -520,7 +520,7 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
> ctx->reqs_active--;
>
> if (unlikely(!ctx->reqs_active && ctx->dead))
> - wake_up(&ctx->wait);
> + wake_up_all(&ctx->wait);
> }
>
> static void aio_fput_routine(struct work_struct *data)
> @@ -1229,7 +1229,7 @@ static void io_destroy(struct kioctx *ioctx)
> * by other CPUs at this point. Right now, we rely on the
> * locking done by the above calls to ensure this consistency.
> */
> - wake_up(&ioctx->wait);
> + wake_up_all(&ioctx->wait);
> put_ioctx(ioctx); /* once for the lookup */
> }
>
Thanks, Roland, this looks good.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
next prev parent reply other threads:[~2011-03-11 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 5:55 Roland Dreier
2011-03-11 14:21 ` Jeff Moyer [this message]
2011-03-12 0:19 ` Andrew Morton
2011-03-12 5:01 ` Roland Dreier
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=x49fwqthh51.fsf@segfault.boston.devel.redhat.com \
--to=jmoyer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®