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 <[email protected]>
> ---
>  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."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to