diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-09-03 17:45:44 +0800 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-10-13 15:41:41 +0200 |
commit | 88e350c62c63bb4ae5887bfbbad88e3354e7ce6f (patch) | |
tree | 0e78bca90f3d121f60cd9d14a4ab88dddaf52313 | |
parent | 3386c069c54344797c4d2da55ebef2f555a7a4a3 (diff) | |
download | lwn-88e350c62c63bb4ae5887bfbbad88e3354e7ce6f.tar.gz lwn-88e350c62c63bb4ae5887bfbbad88e3354e7ce6f.zip |
aio: block exit_aio() until all context requests are completed
commit 6098b45b32e6baeacc04790773ced9340601d511 upstream.
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>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/aio.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -796,6 +796,9 @@ void exit_aio(struct mm_struct *mm) unsigned i = 0; while (1) { + struct completion requests_done = + COMPLETION_INITIALIZER_ONSTACK(requests_done); + rcu_read_lock(); table = rcu_dereference(mm->ioctx_table); @@ -823,7 +826,10 @@ void exit_aio(struct mm_struct *mm) */ 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); } } |