]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: don't mark S_ISBLK async work as unbounded
authorJens Axboe <axboe@kernel.dk>
Thu, 1 Apr 2021 14:38:34 +0000 (08:38 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Apr 2021 14:56:28 +0000 (08:56 -0600)
S_ISBLK is marked as unbounded work for async preparation, because it
doesn't match S_ISREG. That is incorrect, as any read/write to a block
device is also a bounded operation. Fix it up and ensure that S_ISBLK
isn't marked unbounded.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 6d7a1b69712bd93d6c167f2e32a1b83380ecf36f..a16b7df934d149ce2eed26a227f3840a6395b42a 100644 (file)
@@ -1213,7 +1213,7 @@ static void io_prep_async_work(struct io_kiocb *req)
        if (req->flags & REQ_F_ISREG) {
                if (def->hash_reg_file || (ctx->flags & IORING_SETUP_IOPOLL))
                        io_wq_hash_work(&req->work, file_inode(req->file));
-       } else {
+       } else if (!req->file || !S_ISBLK(file_inode(req->file)->i_mode)) {
                if (def->unbound_nonreg_file)
                        req->work.flags |= IO_WQ_WORK_UNBOUND;
        }