summaryrefslogtreecommitdiffstats
path: root/Documentation/dvb
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2014-04-15 11:31:33 -0700
committerBenjamin LaHaise <bcrl@kvack.org>2014-04-16 13:38:04 -0400
commite02ba72aabfade4c9cd6e3263e9b57bf890ad25c (patch)
tree153f7763591a0cb4497d3b72d9ca644d2f3d4aae /Documentation/dvb
parent10ec34fcb100412ab186c141a9c3557d1270effd (diff)
downloadop-kernel-dev-e02ba72aabfade4c9cd6e3263e9b57bf890ad25c.zip
op-kernel-dev-e02ba72aabfade4c9cd6e3263e9b57bf890ad25c.tar.gz
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 'Documentation/dvb')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud