diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-09-03 05:45:44 -0400 |
---|---|---|
committer | Benjamin LaHaise <bcrl@kvack.org> | 2014-09-04 16:54:47 -0400 |
commit | 6098b45b32e6baeacc04790773ced9340601d511 (patch) | |
tree | ef7d685783dc69524d1512dd6273fac127c8962b /fs/aio.c | |
parent | 2ff396be602f10b5eab8e73b24f20348fa2de159 (diff) |
aio: block exit_aio() until all context requests are completed
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.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -793,6 +793,8 @@ void exit_aio(struct mm_struct *mm) | |||
793 | 793 | ||
794 | for (i = 0; i < table->nr; ++i) { | 794 | for (i = 0; i < table->nr; ++i) { |
795 | struct kioctx *ctx = table->table[i]; | 795 | struct kioctx *ctx = table->table[i]; |
796 | struct completion requests_done = | ||
797 | COMPLETION_INITIALIZER_ONSTACK(requests_done); | ||
796 | 798 | ||
797 | if (!ctx) | 799 | if (!ctx) |
798 | continue; | 800 | continue; |
@@ -804,7 +806,10 @@ void exit_aio(struct mm_struct *mm) | |||
804 | * that it needs to unmap the area, just set it to 0. | 806 | * that it needs to unmap the area, just set it to 0. |
805 | */ | 807 | */ |
806 | ctx->mmap_size = 0; | 808 | ctx->mmap_size = 0; |
807 | kill_ioctx(mm, ctx, NULL); | 809 | kill_ioctx(mm, ctx, &requests_done); |
810 | |||
811 | /* Wait until all IO for the context are done. */ | ||
812 | wait_for_completion(&requests_done); | ||
808 | } | 813 | } |
809 | 814 | ||
810 | RCU_INIT_POINTER(mm->ioctx_table, NULL); | 815 | RCU_INIT_POINTER(mm->ioctx_table, NULL); |