]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: don't punt files update to io-wq unconditionally
authorJens Axboe <axboe@kernel.dk>
Fri, 24 Sep 2021 14:43:54 +0000 (08:43 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Sep 2021 16:24:34 +0000 (10:24 -0600)
There's no reason to punt it unconditionally, we just need to ensure that
the submit lock grabbing is conditional.

Fixes: 617803dc1ab8 ("io_uring: avoid ring quiesce for fixed file set unregister and update")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 01e49d01fe740449067269a443a94bd4bebfd7dd..c6139ace11faea70405ddd35fed51fa6374b1d17 100644 (file)
@@ -6340,19 +6340,16 @@ static int io_files_update(struct io_kiocb *req, unsigned int issue_flags)
        struct io_uring_rsrc_update2 up;
        int ret;
 
-       if (issue_flags & IO_URING_F_NONBLOCK)
-               return -EAGAIN;
-
        up.offset = req->rsrc_update.offset;
        up.data = req->rsrc_update.arg;
        up.nr = 0;
        up.tags = 0;
        up.resv = 0;
 
-       mutex_lock(&ctx->uring_lock);
+       io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
        ret = __io_register_rsrc_update(ctx, IORING_RSRC_FILE,
                                        &up, req->rsrc_update.nr_args);
-       mutex_unlock(&ctx->uring_lock);
+       io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
 
        if (ret < 0)
                req_set_fail(req);