aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-05-06 16:31:33 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-05-14 13:37:57 -0400
commit30f2f0eb4bd2c43d10a8b0d872c6e5ad8f31c9a0 (patch)
treedeb8d2a749cd737d9abead1b4cc8321d00dbaee4 /block/genhd.c
parent9604006d283fb67dda5ee9e0e15b7cc6c62e1557 (diff)
block: do_mounts - accept root=<non-existant partition>
Some devices, like md, may create partitions only at first access, so allow root= to be set to a valid non-existant partition of an existing disk. This applies only to non-initramfs root mounting. This fixes a regression from 2.6.24 which did allow this to happen and broke some users machines :( Acked-by: Neil Brown <neilb@suse.de> Tested-by: Joao Luis Meloni Assirati <assirati@nonada.if.usp.br> Cc: stable <stable@kernel.org> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c
index fda9c7a63c29..129ad939f9dd 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -653,7 +653,7 @@ void genhd_media_change_notify(struct gendisk *disk)
653EXPORT_SYMBOL_GPL(genhd_media_change_notify); 653EXPORT_SYMBOL_GPL(genhd_media_change_notify);
654#endif /* 0 */ 654#endif /* 0 */
655 655
656dev_t blk_lookup_devt(const char *name) 656dev_t blk_lookup_devt(const char *name, int part)
657{ 657{
658 struct device *dev; 658 struct device *dev;
659 dev_t devt = MKDEV(0, 0); 659 dev_t devt = MKDEV(0, 0);
@@ -661,7 +661,11 @@ dev_t blk_lookup_devt(const char *name)
661 mutex_lock(&block_class_lock); 661 mutex_lock(&block_class_lock);
662 list_for_each_entry(dev, &block_class.devices, node) { 662 list_for_each_entry(dev, &block_class.devices, node) {
663 if (strcmp(dev->bus_id, name) == 0) { 663 if (strcmp(dev->bus_id, name) == 0) {
664 devt = dev->devt; 664 struct gendisk *disk = dev_to_disk(dev);
665
666 if (part < disk->minors)
667 devt = MKDEV(MAJOR(dev->devt),
668 MINOR(dev->devt) + part);
665 break; 669 break;
666 } 670 }
667 } 671 }
@@ -669,7 +673,6 @@ dev_t blk_lookup_devt(const char *name)
669 673
670 return devt; 674 return devt;
671} 675}
672
673EXPORT_SYMBOL(blk_lookup_devt); 676EXPORT_SYMBOL(blk_lookup_devt);
674 677
675struct gendisk *alloc_disk(int minors) 678struct gendisk *alloc_disk(int minors)