diff options
author | NeilBrown <neilb@suse.de> | 2012-07-03 01:56:52 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-07-03 01:56:52 -0400 |
commit | 0232605d987d8230b254aa139805bbb56a7ca30c (patch) | |
tree | 18537d016ecc0f12b41b4589818b4c047cd58bcf /drivers | |
parent | 055d3747dbf00ce85c6872ecca4d466638e80c22 (diff) |
md: make 'name' arg to md_register_thread non-optional.
Having the 'name' arg optional and defaulting to the current
personality name is no necessary and leads to errors, as when
changing the level of an array we can end up using the
name of the old level instead of the new one.
So make it non-optional and always explicitly pass the name
of the level that the array will be.
Reported-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/md.c | 2 | ||||
-rw-r--r-- | drivers/md/multipath.c | 3 | ||||
-rw-r--r-- | drivers/md/raid1.c | 2 | ||||
-rw-r--r-- | drivers/md/raid10.c | 2 | ||||
-rw-r--r-- | drivers/md/raid5.c | 4 |
5 files changed, 8 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 973aa8459e98..c601c4be77c7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -6751,7 +6751,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev | |||
6751 | thread->tsk = kthread_run(md_thread, thread, | 6751 | thread->tsk = kthread_run(md_thread, thread, |
6752 | "%s_%s", | 6752 | "%s_%s", |
6753 | mdname(thread->mddev), | 6753 | mdname(thread->mddev), |
6754 | name ?: mddev->pers->name); | 6754 | name); |
6755 | if (IS_ERR(thread->tsk)) { | 6755 | if (IS_ERR(thread->tsk)) { |
6756 | kfree(thread); | 6756 | kfree(thread); |
6757 | return NULL; | 6757 | return NULL; |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 9339e67fcc79..61a1833ebaf3 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev) | |||
474 | } | 474 | } |
475 | 475 | ||
476 | { | 476 | { |
477 | mddev->thread = md_register_thread(multipathd, mddev, NULL); | 477 | mddev->thread = md_register_thread(multipathd, mddev, |
478 | "multipath"); | ||
478 | if (!mddev->thread) { | 479 | if (!mddev->thread) { |
479 | printk(KERN_ERR "multipath: couldn't allocate thread" | 480 | printk(KERN_ERR "multipath: couldn't allocate thread" |
480 | " for %s\n", mdname(mddev)); | 481 | " for %s\n", mdname(mddev)); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a9c7981ddd24..39b2a8aa3b23 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2621,7 +2621,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2621 | goto abort; | 2621 | goto abort; |
2622 | } | 2622 | } |
2623 | err = -ENOMEM; | 2623 | err = -ENOMEM; |
2624 | conf->thread = md_register_thread(raid1d, mddev, NULL); | 2624 | conf->thread = md_register_thread(raid1d, mddev, "raid1"); |
2625 | if (!conf->thread) { | 2625 | if (!conf->thread) { |
2626 | printk(KERN_ERR | 2626 | printk(KERN_ERR |
2627 | "md/raid1:%s: couldn't allocate thread\n", | 2627 | "md/raid1:%s: couldn't allocate thread\n", |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index ae73e29298b2..edc1088a1320 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3427,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
3427 | spin_lock_init(&conf->resync_lock); | 3427 | spin_lock_init(&conf->resync_lock); |
3428 | init_waitqueue_head(&conf->wait_barrier); | 3428 | init_waitqueue_head(&conf->wait_barrier); |
3429 | 3429 | ||
3430 | conf->thread = md_register_thread(raid10d, mddev, NULL); | 3430 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); |
3431 | if (!conf->thread) | 3431 | if (!conf->thread) |
3432 | goto out; | 3432 | goto out; |
3433 | 3433 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 62b6b3a83abf..a5135e595866 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -4840,6 +4840,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4840 | int raid_disk, memory, max_disks; | 4840 | int raid_disk, memory, max_disks; |
4841 | struct md_rdev *rdev; | 4841 | struct md_rdev *rdev; |
4842 | struct disk_info *disk; | 4842 | struct disk_info *disk; |
4843 | char pers_name[6]; | ||
4843 | 4844 | ||
4844 | if (mddev->new_level != 5 | 4845 | if (mddev->new_level != 5 |
4845 | && mddev->new_level != 4 | 4846 | && mddev->new_level != 4 |
@@ -4963,7 +4964,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
4963 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", | 4964 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", |
4964 | mdname(mddev), memory); | 4965 | mdname(mddev), memory); |
4965 | 4966 | ||
4966 | conf->thread = md_register_thread(raid5d, mddev, NULL); | 4967 | sprintf(pers_name, "raid%d", mddev->new_level); |
4968 | conf->thread = md_register_thread(raid5d, mddev, pers_name); | ||
4967 | if (!conf->thread) { | 4969 | if (!conf->thread) { |
4968 | printk(KERN_ERR | 4970 | printk(KERN_ERR |
4969 | "md/raid:%s: couldn't allocate thread.\n", | 4971 | "md/raid:%s: couldn't allocate thread.\n", |