Skip to contentSkip to conversation

block: remove the bd_openers checks in blk_drop_partitions

PATCH Applied Christoph Hellwig 3 participants 4 messages Apr 28, 2020 – Apr 30, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: remove the bd_openers checks in blk_drop_partitions

When replacing the bd_super check with a bd_openers I followed a logical conclusion, which turns out to be utterly wrong. When a block device has bd_super sets it has a mount file system on it (although not every mounted file system sets bd_super), but that also implies it doesn't even have partitions to start with.

So instead of trying to come up with a logical check for all openers, just remove the check entirely.

Fixes d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
Fixes cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again")
---
 block/partitions/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/partitions/core.c +1 -1
index bc1ded1331b14..9ef48a8cff867 100644
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
 
 	if (!disk_part_scan_enabled(disk))
 		return 0;
-	if (bdev->bd_part_count || bdev->bd_openers > 1)
+	if (bdev->bd_part_count)
 		return -EBUSY;
 	res = invalidate_partition(disk, 0);
 	if (res)
Signature · 1 line
2.26.1
#1 lore raw

Hi.

Quoted 2 lines · Christoph Hellwig

So instead of trying to come up with a logical check for all openers, just remove the check entirely.

I ignored the original suppression patch and I just confirm that v5.7-rc3 has still broken partscan, whereas v5.7-rc3 + this patch works as expected.

Michal

#2 lore raw
In reply to Christoph Hellwig

Jens,

can you pick this one up?

Quoted 33 lines · Christoph Hellwig

When replacing the bd_super check with a bd_openers I followed a logical conclusion, which turns out to be utterly wrong. When a block device has bd_super sets it has a mount file system on it (although not every mounted file system sets bd_super), but that also implies it doesn't even have partitions to start with.

So instead of trying to come up with a logical check for all openers, just remove the check entirely.

Fixes d3ef5536274f ("block: fix busy device checking in blk_drop_partitions")
Fixes cb6b771b05c3 ("block: fix busy device checking in blk_drop_partitions again")
---
 block/partitions/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/partitions/core.c +1 -1
index bc1ded1331b14..9ef48a8cff867 100644
@@ -496,7 +496,7 @@ int blk_drop_partitions(struct gendisk *disk, struct block_device *bdev)
 
 	if (!disk_part_scan_enabled(disk))
 		return 0;
-	if (bdev->bd_part_count || bdev->bd_openers > 1)
+	if (bdev->bd_part_count)
 		return -EBUSY;
 	res = invalidate_partition(disk, 0);
 	if (res)
Signature · 1 line
2.26.1

---end quoted text---

maintainer Applied
#3 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

When replacing the bd_super check with a bd_openers I followed a logical conclusion, which turns out to be utterly wrong. When a block device has bd_super sets it has a mount file system on it (although not every mounted file system sets bd_super), but that also implies it doesn't even have partitions to start with.

So instead of trying to come up with a logical check for all openers, just remove the check entirely.

Applied, thanks.

Signature · 1 line
Jens Axboe