]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix sporadic double CQE entry for close
authorJens Axboe <axboe@kernel.dk>
Sat, 1 Feb 2020 00:16:48 +0000 (17:16 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Feb 2020 00:27:47 +0000 (17:27 -0700)
commit7df54e749e8f5c02684cf0ab3ea0595a66179c8a
tree24b6070b4400fe2f5bb3220e170cb28a860bf4c8
parent8fbd3f051672f1520a2cff8b3e6caeeab19b778e
io_uring: fix sporadic double CQE entry for close

We punt close to async for the final fput(), but we log the completion
even before that even in that case. We rely on the request not having
a files table assigned to detect what the final async close should do.
However, if we punt the async queue to __io_queue_sqe(), we'll get
->files assigned and this makes io_close_finish() think it should both
close the filp again (which does no harm) AND log a new CQE event for
this request. This causes duplicate CQEs.

Queue the request up for async manually so we don't grab files
needlessly and trigger this condition.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c