Skip to contentSkip to conversation

Failure to reread partition tables on non-busy devices

DISCUSSION Doug Ledford 3 participants 4 messages Nov 17, 2002 – Nov 18, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This patch (almost certainly wrong BTW) makes it work. Obviously, somewhere there should be a call to invalidate_bdev(); that doesn't exist. I'm not sure A) where that call should be and B) what checks there should be to avoid calling invalidate_bdev() on a device that is busy.

fs/partitions/check.c: 1.85 1.86 dledford 02/11/17 17:22:37 (modified, needs delta)

@@ -453,8 +453,8 @@ int rescan_partitions()
struct parsed_partitions *state;
int p, res;

- if (!bdev->bd_invalidated)
- return 0;
+ //if (!bdev->bd_invalidated)
+ // return 0;
if (bdev->bd_part_count)
return -EBUSY;
res = invalidate_device(dev, 1);

Signature · 4 lines
  Doug Ledford <[email protected]>     919-754-3700 x44233
         Red Hat, Inc. 
         1801 Varsity Dr.
         Raleigh, NC 27606
#1 lore raw

Doug,
Your patch below fixes the problem I was seeing with fdisk creating new partitions (on a scsi_debug ram disk) not being visible outside fdisk.

Doug Gilbert

Quoted 16 lines · Doug Ledford

This patch (almost certainly wrong BTW) makes it work. Obviously, somewhere there should be a call to invalidate_bdev(); that doesn't exist. I'm not sure A) where that call should be and B) what checks there should be to avoid calling invalidate_bdev() on a device that is busy.

fs/partitions/check.c: 1.85 1.86 dledford 02/11/17 17:22:37 (modified, needs delta)

(quoted diff) +2 -2
@@ -453,8 +453,8 @@ int rescan_partitions()
 	struct parsed_partitions *state;
 	int p, res;
 
-	if (!bdev->bd_invalidated)
-		return 0;
+	//if (!bdev->bd_invalidated)
+	//	return 0;
 	if (bdev->bd_part_count)
 		return -EBUSY;
 	res = invalidate_device(dev, 1);
#2 lore raw
In reply to Doug Ledford
Quoted 4 lines · Doug Ledford

This patch (almost certainly wrong BTW) makes it work. Obviously, somewhere there should be a call to invalidate_bdev(); that doesn't exist. I'm not sure A) where that call should be and B) what checks there should be to avoid calling invalidate_bdev() on a device that is busy.

Not really. Correct fix is:

	a) in fs/block_dev.c::full_check_disk_change() replace

	if (check_disk_change(bdev)) {
with
	if (check_disk_change(bdev) && bdev->bd_invalidated) {

	b) lost the check in rescan_partitions().

Other callers either do that check themselves or don't want that check to happen at all (BLKRRPART).

#3 lore raw
Quoted 11 lines · Alexander Viro

Not really. Correct fix is:

	a) in fs/block_dev.c::full_check_disk_change() replace

	if (check_disk_change(bdev)) {
with
	if (check_disk_change(bdev) && bdev->bd_invalidated) {

	b) lost the check in rescan_partitions().

Other callers either do that check themselves or don't want that check to happen at all (BLKRRPART).

Well, since you didn't attach the patch, here it is.

Signature · 4 lines
  Doug Ledford <[email protected]>     919-754-3700 x44233
         Red Hat, Inc. 
         1801 Varsity Dr.
         Raleigh, NC 27606

===== fs/block_dev.c 1.112 vs edited =====

fs/block_dev.c +1 -1
@@ -520,7 +520,7 @@
 	if (bdev->bd_contains != bdev)
 		BUG();
 	down(&bdev->bd_sem);
-	if (check_disk_change(bdev)) {
+	if (check_disk_change(bdev) && bdev->bd_invalidated) {
 		rescan_partitions(bdev->bd_disk, bdev);
 		res = 1;
 	}

===== fs/partitions/check.c 1.85 vs edited =====

fs/partitions/check.c +0 -2
@@ -453,8 +453,6 @@
 	struct parsed_partitions *state;
 	int p, res;
 
-	if (!bdev->bd_invalidated)
-		return 0;
 	if (bdev->bd_part_count)
 		return -EBUSY;
 	res = invalidate_device(dev, 1);