]> 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)
commitb22d9c509d5bb189c73b213c2f2ff1e32f0973f0
tree24b6070b4400fe2f5bb3220e170cb28a860bf4c8
parent73dfb2895f275f05c4c58b0b3ae1059ce9841d24
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