summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_sb.h
diff options
context:
space:
mode:
authorAnatol Pomozov2014-04-15 20:31:33 +0200
committerBenjamin LaHaise2014-04-16 19:38:04 +0200
commite02ba72aabfade4c9cd6e3263e9b57bf890ad25c (patch)
tree153f7763591a0cb4497d3b72d9ca644d2f3d4aae /fs/xfs/xfs_sb.h
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (diff)
downloadkernel-qcow2-linux-e02ba72aabfade4c9cd6e3263e9b57bf890ad25c.tar.gz
kernel-qcow2-linux-e02ba72aabfade4c9cd6e3263e9b57bf890ad25c.tar.xz
kernel-qcow2-linux-e02ba72aabfade4c9cd6e3263e9b57bf890ad25c.zip
aio: block io_destroy() until all context requests are completed
deletes aio context and all resources related to. It makes sense that no IO operations connected to the context should be running after the context is destroyed. As we removed io_context we have no chance to get requests status or call io_getevents(). man page for io_destroy says that this function may block until all context's requests are completed. Before kernel 3.11 io_destroy() blocked indeed, but since aio refactoring in 3.11 it is not true anymore. Here is a pseudo-code that shows a testcase for a race condition discovered in 3.11: initialize io_context io_submit(read to buffer) io_destroy() // context is destroyed so we can free the resources free(buffers); // if the buffer is allocated by some other user he'll be surprised // to learn that the buffer still filled by an outstanding operation // from the destroyed io_context The fix is straight-forward - add a completion struct and wait on it in io_destroy, complete() should be called when number of in-fligh requests reaches zero. If two or more io_destroy() called for the same context simultaneously then only the first one waits for IO completion, other calls behaviour is undefined. Tested: ran http://pastebin.com/LrPsQ4RL testcase for several hours and do not see the race condition anymore. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Diffstat (limited to 'fs/xfs/xfs_sb.h')
0 files changed, 0 insertions, 0 deletions