]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix async close() with f_op->flush()
authorPavel Begunkov <asml.silence@gmail.com>
Sat, 8 Feb 2020 11:04:34 +0000 (14:04 +0300)
committerJens Axboe <axboe@kernel.dk>
Sat, 8 Feb 2020 20:07:00 +0000 (13:07 -0700)
commitd7447959fd9d5448e3e130840a2d6028d0b7ef41
treef83839f6fc29190f8bf1515787daef8828ede9c1
parent185c09c4b01a8e722e0f59570351a0c7db2366b2
io_uring: fix async close() with f_op->flush()

First, io_close() misses filp_close() and io_cqring_add_event(), when
f_op->flush is defined. That's because in this case it will
io_queue_async_work() itself not grabbing files, so the corresponding
chunk in io_close_finish() won't be executed.

Second, when submitted through io_wq_submit_work(), it will do
filp_close() and *_add_event() twice: first inline in io_close(),
and the second one in call to io_close_finish() from io_close().
The second one will also fire, because it was submitted async through
generic path, and so have grabbed files.

And the last nice thing is to remove this weird pilgrimage with checking
work/old_work and casting it to nxt. Just use a helper instead.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c