Commit 155a3bed authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

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: 8443e208 ("ublk: add UBLK_F_NO_AUTO_PART_SCAN feature flag")
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 25966fc0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4440,6 +4440,8 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub,

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