Skip to contentSkip to conversation

block: fix the exclusive open mask in disk_scan_partitions

PATCH Applied Christoph Hellwig 2 participants 2 messages Jun 21, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: fix the exclusive open mask in disk_scan_partitions

FMODE_EXEC has nothing to do with exclusive opens, and even is of the wrong type. We need to check for BLK_OPEN_EXCL here.

Fixes 985958b8584c ("block: fix wrong mode for blkdev_get_by_dev() from disk_scan_partitions()")
---
 block/genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/genhd.c +1 -1
index a94952ae9e396a..3d287b32d50dfd 100644
@@ -366,7 +366,7 @@ int disk_scan_partitions(struct gendisk *disk, blk_mode_t mode)
 	}
 
 	set_bit(GD_NEED_PART_SCAN, &disk->state);
-	bdev = blkdev_get_by_dev(disk_devt(disk), mode & ~FMODE_EXEC, NULL,
+	bdev = blkdev_get_by_dev(disk_devt(disk), mode & ~BLK_OPEN_EXCL, NULL,
 				 NULL);
 	if (IS_ERR(bdev))
 		ret =  PTR_ERR(bdev);
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Christoph Hellwig

FMODE_EXEC has nothing to do with exclusive opens, and even is of the wrong type. We need to check for BLK_OPEN_EXCL here.

Applied, thanks!

[1/1] block: fix the exclusive open mask in disk_scan_partitions

      commit: 56e71bdf324d6ab263eba1fc3fa1f3fd8bb5678e

Best regards,

Signature · 1 line
Jens Axboe