Commit 70bb57ee authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] md: Move the test in preferred_minor to where it is used.

From: NeilBrown <neilb@cse.unsw.edu.au>

A RAID superblock can indicate which minor number the array should be
assembled under.  As this is only meaningful when doing auto-start, we move
the test for it being in the valid range to the place where auto-start
happens.  When an array is started any other way, it doesn't matter what
value is here.
parent 588d6141
...@@ -512,11 +512,6 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version ...@@ -512,11 +512,6 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
goto abort; goto abort;
} }
if (sb->md_minor >= MAX_MD_DEVS) {
printk(KERN_ERR "md: %s: invalid raid minor (%x)\n",
b, sb->md_minor);
goto abort;
}
if (sb->raid_disks <= 0) if (sb->raid_disks <= 0)
goto abort; goto abort;
...@@ -1829,7 +1824,7 @@ static void autorun_devices(void) ...@@ -1829,7 +1824,7 @@ static void autorun_devices(void)
"md: md%d already running, cannot run %s\n", "md: md%d already running, cannot run %s\n",
mdidx(mddev), bdevname(rdev0->bdev,b)); mdidx(mddev), bdevname(rdev0->bdev,b));
mddev_unlock(mddev); mddev_unlock(mddev);
} else { } else if (rdev0->preferred_minor >= 0 && rdev0->preferred_minor < MAX_MD_DEVS) {
printk(KERN_INFO "md: created md%d\n", mdidx(mddev)); printk(KERN_INFO "md: created md%d\n", mdidx(mddev));
ITERATE_RDEV_GENERIC(candidates,rdev,tmp) { ITERATE_RDEV_GENERIC(candidates,rdev,tmp) {
list_del_init(&rdev->same_set); list_del_init(&rdev->same_set);
...@@ -1838,7 +1833,9 @@ static void autorun_devices(void) ...@@ -1838,7 +1833,9 @@ static void autorun_devices(void)
} }
autorun_array(mddev); autorun_array(mddev);
mddev_unlock(mddev); mddev_unlock(mddev);
} } else
printk(KERN_WARNING "md: %s had invalid preferred minor %d\n",
bdevname(rdev->bdev, b), rdev0->preferred_minor);
/* on success, candidates will be empty, on error /* on success, candidates will be empty, on error
* it won't... * it won't...
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment