diff options
author | Jan Kara <[email protected]> | 2011-02-25 14:44:27 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2011-02-25 15:07:37 -0800 |
commit | 7137c6bd455234bcb7560fd829e6ee49cae5fed6 (patch) | |
tree | 7b463cfaf8a051fd6bc2bd2aaf4141659c982ee5 /tools/perf/util/trace-event-scripting.c | |
parent | 3bd9a5d734c7cc7533b27abf451416c7f50095a7 (diff) |
aio: fix race between io_destroy() and io_submit()
A race can occur when io_submit() races with io_destroy():
CPU1 CPU2
io_submit()
do_io_submit()
...
ctx = lookup_ioctx(ctx_id);
io_destroy()
Now do_io_submit() holds the last reference to ctx.
...
queue new AIO
put_ioctx(ctx) - frees ctx with active AIOs
We solve this issue by checking whether ctx is being destroyed in AIO
submission path after adding new AIO to ctx. Then we are guaranteed that
either io_destroy() waits for new AIO or we see that ctx is being
destroyed and bail out.
Cc: Nick Piggin <[email protected]>
Reviewed-by: Jeff Moyer <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions