From: Caleb Sander Mateos Date: Fri, 20 Jun 2025 15:10:00 +0000 (-0600) Subject: ublk: consolidate UBLK_IO_FLAG_{ACTIVE,OWNED_BY_SRV} checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b53d4e994b934796b7376150130ab2b3577fa1e;p=thirdparty%2Fkernel%2Flinux.git ublk: consolidate UBLK_IO_FLAG_{ACTIVE,OWNED_BY_SRV} checks 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 Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20250620151008.3976463-7-csander@purestorage.com Signed-off-by: Jens Axboe --- diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index d8985d49a05bf..9ea7cd698d20f 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -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.