提交 a757e64c 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] md: remove a number of misleading calls to MD_BUG

The conditions that cause these calls to MD_BUG are not kernel bugs, just
oddities in what userspace is asking for.

Also convert analyze_sbs to return void, and the value it returned was
always 0.
Signed-off-by: NNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 d28446fe
...@@ -1387,7 +1387,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi ...@@ -1387,7 +1387,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
*/ */
static int analyze_sbs(mddev_t * mddev) static void analyze_sbs(mddev_t * mddev)
{ {
int i; int i;
struct list_head *tmp; struct list_head *tmp;
...@@ -1441,7 +1441,6 @@ static int analyze_sbs(mddev_t * mddev) ...@@ -1441,7 +1441,6 @@ static int analyze_sbs(mddev_t * mddev)
" -- starting background reconstruction\n", " -- starting background reconstruction\n",
mdname(mddev)); mdname(mddev));
return 0;
} }
int mdp_major = 0; int mdp_major = 0;
...@@ -1508,10 +1507,9 @@ static int do_md_run(mddev_t * mddev) ...@@ -1508,10 +1507,9 @@ static int do_md_run(mddev_t * mddev)
struct gendisk *disk; struct gendisk *disk;
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
if (list_empty(&mddev->disks)) { if (list_empty(&mddev->disks))
MD_BUG(); /* cannot run an array with no devices.. */
return -EINVAL; return -EINVAL;
}
if (mddev->pers) if (mddev->pers)
return -EBUSY; return -EBUSY;
...@@ -1519,10 +1517,8 @@ static int do_md_run(mddev_t * mddev) ...@@ -1519,10 +1517,8 @@ static int do_md_run(mddev_t * mddev)
/* /*
* Analyze all RAID superblock(s) * Analyze all RAID superblock(s)
*/ */
if (!mddev->raid_disks && analyze_sbs(mddev)) { if (!mddev->raid_disks)
MD_BUG(); analyze_sbs(mddev);
return -EINVAL;
}
chunk_size = mddev->chunk_size; chunk_size = mddev->chunk_size;
pnum = level_to_pers(mddev->level); pnum = level_to_pers(mddev->level);
...@@ -1548,7 +1544,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -1548,7 +1544,7 @@ static int do_md_run(mddev_t * mddev)
* chunk-size has to be a power of 2 and multiples of PAGE_SIZE * chunk-size has to be a power of 2 and multiples of PAGE_SIZE
*/ */
if ( (1 << ffz(~chunk_size)) != chunk_size) { if ( (1 << ffz(~chunk_size)) != chunk_size) {
MD_BUG(); printk(KERN_ERR "chunk_size of %d not valid\n", chunk_size);
return -EINVAL; return -EINVAL;
} }
if (chunk_size < PAGE_SIZE) { if (chunk_size < PAGE_SIZE) {
...@@ -1573,11 +1569,6 @@ static int do_md_run(mddev_t * mddev) ...@@ -1573,11 +1569,6 @@ static int do_md_run(mddev_t * mddev)
} }
} }
if (pnum >= MAX_PERSONALITY) {
MD_BUG();
return -EINVAL;
}
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!pers[pnum]) if (!pers[pnum])
{ {
...@@ -1762,10 +1753,8 @@ static void autorun_array(mddev_t *mddev) ...@@ -1762,10 +1753,8 @@ static void autorun_array(mddev_t *mddev)
struct list_head *tmp; struct list_head *tmp;
int err; int err;
if (list_empty(&mddev->disks)) { if (list_empty(&mddev->disks))
MD_BUG();
return; return;
}
printk(KERN_INFO "md: running: "); printk(KERN_INFO "md: running: ");
...@@ -3128,7 +3117,6 @@ int register_md_personality(int pnum, mdk_personality_t *p) ...@@ -3128,7 +3117,6 @@ int register_md_personality(int pnum, mdk_personality_t *p)
spin_lock(&pers_lock); spin_lock(&pers_lock);
if (pers[pnum]) { if (pers[pnum]) {
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
MD_BUG();
return -EBUSY; return -EBUSY;
} }
...@@ -3140,10 +3128,8 @@ int register_md_personality(int pnum, mdk_personality_t *p) ...@@ -3140,10 +3128,8 @@ int register_md_personality(int pnum, mdk_personality_t *p)
int unregister_md_personality(int pnum) int unregister_md_personality(int pnum)
{ {
if (pnum >= MAX_PERSONALITY) { if (pnum >= MAX_PERSONALITY)
MD_BUG();
return -EINVAL; return -EINVAL;
}
printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name); printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
spin_lock(&pers_lock); spin_lock(&pers_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册