]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ublk: consolidate UBLK_IO_FLAG_{ACTIVE,OWNED_BY_SRV} checks
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 20 Jun 2025 15:10:00 +0000 (09:10 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 30 Jun 2025 22:02:46 +0000 (16:02 -0600)
UBLK_IO_FLAG_ACTIVE and UBLK_IO_FLAG_OWNED_BY_SRV are mutually
exclusive. So just check that UBLK_IO_FLAG_OWNED_BY_SRV is set in
__ublk_ch_uring_cmd(); that implies UBLK_IO_FLAG_ACTIVE is unset.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250620151008.3976463-7-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c

index d8985d49a05bf589ebf6da5e58ae70635e468e81..9ea7cd698d20f5a1da02bfa5b0de4112bf8d1756 100644 (file)
@@ -2228,14 +2228,11 @@ static int __ublk_ch_uring_cmd(struct io_uring_cmd *cmd,
                goto out;
 
        /* there is pending io cmd, something must be wrong */
-       if (io->flags & UBLK_IO_FLAG_ACTIVE) {
+       if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV)) {
                ret = -EBUSY;
                goto out;
        }
 
-       if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
-               goto out;
-
        /*
         * ensure that the user issues UBLK_IO_NEED_GET_DATA
         * iff the driver have set the UBLK_IO_FLAG_NEED_GET_DATA.