io_uring: account fixed file references correctly in batch
authorJens Axboe <axboe@kernel.dk>
Thu, 9 Jan 2020 14:52:28 +0000 (07:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jan 2020 00:04:06 +0000 (17:04 -0700)
commit10fef4bebf979bb705feed087611293d5864adfe
treeca1295794fd2ddf0d8be6fdd83d5950bbfcf6b3c
parent354420f705ccd0aa2d41249f3bb55b4afbed1873
io_uring: account fixed file references correctly in batch

We can't assume that the whole batch has fixed files in it. If it's a
mix, or none at all, then we can end up doing a ref put that either
messes up accounting, or causes an oops if we have no fixed files at
all.

Also ensure we free requests properly between inflight accounted and
normal requests.

Fixes: 82c721577011 ("io_uring: extend batch freeing to cover more cases")
Reported-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Tested-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c