Skip to contentSkip to conversation

partitions: let partitions inherit policy from disk

PATCH/RFC Peter Oberparleiter 3 participants 3 messages Jul 3, 2006 – Jul 4, 2006

lore
Share & tools
lore
#0 lore raw

I'd like to suggest to change the partition code in fs/partitions/check.c to initialize a newly detected partition's policy field with that of the containing block device (see patch below).

My reasoning is that function set_disk_ro() in block/genhd.c modifies the policy field (read-only indicator) of a disk and all contained partitions. When a partition is detected after the call to set_disk_ro(), the policy field of this partition will currently not inherit the disk's policy field. This behavior poses a problem in cases where a block device can be 'logically de- and reactivated' like e.g. the s390 DASD driver because partition detection may run after the policy field has been modified.

From: Peter Oberparleiter <[email protected]>

Initialize the policy field of partitions with that of the containing block device.

---

fs/partitions/check.c +1 -0
diff -Naurp linux-2.6.17/fs/partitions/check.c linux-2.6.17b/fs/partitions/check.c
@@ -348,6 +348,7 @@ void add_partition(struct gendisk *disk,
 	p->start_sect = start;-
 	p->nr_sects = len;
 	p->partno = part;
+	p->policy = disk->policy;
 
 	devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part),
 			S_IFBLK|S_IRUSR|S_IWUSR,
#1 lore raw
Quoted 24 lines · Peter Oberparleiter

I'd like to suggest to change the partition code in fs/partitions/check.c to initialize a newly detected partition's policy field with that of the containing block device (see patch below).

My reasoning is that function set_disk_ro() in block/genhd.c modifies the policy field (read-only indicator) of a disk and all contained partitions. When a partition is detected after the call to set_disk_ro(), the policy field of this partition will currently not inherit the disk's policy field. This behavior poses a problem in cases where a block device can be 'logically de- and reactivated' like e.g. the s390 DASD driver because partition detection may run after the policy field has been modified.

From: Peter Oberparleiter <[email protected]>

Initialize the policy field of partitions with that of the containing block device.

---
diff -Naurp linux-2.6.17/fs/partitions/check.c linux-2.6.17b/fs/partitions/check.c

fs/partitions/check.c void add_partition(struct gendisk *disk, · line 354

Quoted 7 lines
fs/partitions/check.c +1 -0
@@ -348,6 +348,7 @@ void add_partition(struct gendisk *disk,
 	p->start_sect = start;-
 	p->nr_sects = len;
 	p->partno = part;
+	p->policy = disk->policy;
 
 	devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part),
 			S_IFBLK|S_IRUSR|S_IWUSR,

Makes sense to me, however I'll let Al ack this for inclusion. Al?

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 1 line

Makes sense to me, however I'll let Al ack this for inclusion. Al?

ACK, looks sane.