Skip to content

Commit 155a3be

Browse files
Ming Leiaxboe
authored andcommitted
ublk: don't clear GD_SUPPRESS_PART_SCAN for unprivileged daemons
When UBLK_F_NO_AUTO_PART_SCAN is set, GD_SUPPRESS_PART_SCAN is cleared unconditionally, including for unprivileged daemons. Keep it consistent with the code block for setting GD_SUPPRESS_PART_SCAN by not clearing it for unprivileged daemons. In reality this isn't a problem because ioctl(BLKRRPART) requires CAP_SYS_ADMIN, but it is more reliable to not clear the bit. Cc: Alexander Atanasov <alex@zazolabs.com> Fixes: 8443e20 ("ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag") Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 25966fc commit 155a3be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/block/ublk_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4440,7 +4440,9 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub,
44404440

44414441
/* Skip partition scan if disabled by user */
44424442
if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN) {
4443-
clear_bit(GD_SUPPRESS_PART_SCAN, &disk->state);
4443+
/* Not clear for unprivileged daemons, see comment above */
4444+
if (!ub->unprivileged_daemons)
4445+
clear_bit(GD_SUPPRESS_PART_SCAN, &disk->state);
44444446
} else {
44454447
/* Schedule async partition scan for trusted daemons */
44464448
if (!ub->unprivileged_daemons)

0 commit comments

Comments
 (0)