Skip to content

Commit 9d9e88a

Browse files
committed
io_uring: polled fixed file must go through free iteration
When we changed the file registration handling, it became important to iterate the bulk request freeing list for fixed files as well, or we miss dropping the fixed file reference. If not, we're leaking references, and we'll get a kworker stuck waiting for file references to disappear. This also means we can remove the special casing of fixed vs non-fixed files, we need to iterate for both and we can just rely on __io_req_aux_free() doing io_put_file() instead of doing it manually. Fixes: 0558955 ("io_uring: refactor file register/unregister/update handling") Signed-off-by: Jens Axboe <[email protected]>
1 parent c968742 commit 9d9e88a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/io_uring.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,6 @@ static void io_free_req_many(struct io_ring_ctx *ctx, struct req_batch *rb)
13941394
for (i = 0; i < rb->to_free; i++) {
13951395
struct io_kiocb *req = rb->reqs[i];
13961396

1397-
if (req->flags & REQ_F_FIXED_FILE) {
1398-
req->file = NULL;
1399-
percpu_ref_put(req->fixed_file_refs);
1400-
}
14011397
if (req->flags & REQ_F_INFLIGHT)
14021398
inflight++;
14031399
__io_req_aux_free(req);
@@ -1670,7 +1666,7 @@ static inline bool io_req_multi_free(struct req_batch *rb, struct io_kiocb *req)
16701666
if ((req->flags & REQ_F_LINK_HEAD) || io_is_fallback_req(req))
16711667
return false;
16721668

1673-
if (!(req->flags & REQ_F_FIXED_FILE) || req->io)
1669+
if (req->file || req->io)
16741670
rb->need_iter++;
16751671

16761672
rb->reqs[rb->to_free++] = req;

0 commit comments

Comments
 (0)