]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ublk_drv: return flag of UBLK_F_URING_CMD_COMP_IN_TASK in case of module
authorMing Lei <ming.lei@redhat.com>
Sat, 29 Oct 2022 01:04:29 +0000 (09:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:17:29 +0000 (18:17 +0100)
[ Upstream commit 224e858f215a3d6304f95a92357a1753475ca9cf ]

UBLK_F_URING_CMD_COMP_IN_TASK needs to be set and returned to userspace
if ublk driver is built as module, otherwise userspace may get wrong
flags shown.

Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: ZiyangZhang <ZiyangZhang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20221029010432.598367-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/ublk_drv.c

index 6a4a94b4cdf42fa1d56d79d28d73c53aef941391..31a8715d3a4d374162892f2e718e8f81f9e94ab6 100644 (file)
@@ -1507,6 +1507,9 @@ static int ublk_ctrl_add_dev(struct io_uring_cmd *cmd)
         */
        ub->dev_info.flags &= UBLK_F_ALL;
 
+       if (!IS_BUILTIN(CONFIG_BLK_DEV_UBLK))
+               ub->dev_info.flags |= UBLK_F_URING_CMD_COMP_IN_TASK;
+
        /* We are not ready to support zero copy */
        ub->dev_info.flags &= ~UBLK_F_SUPPORT_ZERO_COPY;