From: Benjamin LaHaise <bcrl@kvack.org>
To: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: linux-aio@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] aio: block exit_aio() until all context requests are completed
Date: Wed, 3 Sep 2014 10:43:32 -0400 [thread overview]
Message-ID: <20140903144332.GU20066@kvack.org> (raw)
In-Reply-To: <1409737544-9392-1-git-send-email-guz.fnst@cn.fujitsu.com>
Hi Gu,
On Wed, Sep 03, 2014 at 05:45:44PM +0800, Gu Zheng wrote:
> It seems that exit_aio() also needs to wait for all iocbs to complete (like
> io_destroy), but we missed the wait step in current implemention, so fix
> it in the same way as we did in io_destroy.
I actually already have another version of this patch queued up that
checks the return value of kill_ioctx().
-ben
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> ---
> fs/aio.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 97bc62c..3e35b12 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -793,6 +793,8 @@ void exit_aio(struct mm_struct *mm)
>
> for (i = 0; i < table->nr; ++i) {
> struct kioctx *ctx = table->table[i];
> + struct completion requests_done =
> + COMPLETION_INITIALIZER_ONSTACK(requests_done);
>
> if (!ctx)
> continue;
> @@ -804,7 +806,10 @@ void exit_aio(struct mm_struct *mm)
> * that it needs to unmap the area, just set it to 0.
> */
> ctx->mmap_size = 0;
> - kill_ioctx(mm, ctx, NULL);
> + kill_ioctx(mm, ctx, &requests_done);
> +
> + /* Wait until all IO for the context are done. */
> + wait_for_completion(&requests_done);
> }
>
> RCU_INIT_POINTER(mm->ioctx_table, NULL);
> --
> 1.7.7
--
"Thought is the essence of where you are now."
next parent reply other threads:[~2014-09-03 14:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1409737544-9392-1-git-send-email-guz.fnst@cn.fujitsu.com>
2014-09-03 14:43 ` Benjamin LaHaise [this message]
2014-09-04 0:47 ` [PATCH] aio: block exit_aio() until all context requests are completed Gu Zheng
2014-09-04 20:58 ` Benjamin LaHaise
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=20140903144332.GU20066@kvack.org \
--to=bcrl@kvack.org \
--cc=guz.fnst@cn.fujitsu.com \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox