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)
commit1a417f4e618e05fba29ba222f1e8555c302376ce
tree24b6070b4400fe2f5bb3220e170cb28a860bf4c8
parent9250f9ee194dc3dcee28a42a1533fa2cc0edd215
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