Skip to content

Commit

Permalink
md: make 'name' arg to md_register_thread non-optional.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
neilbrown committed Jul 3, 2012
1 parent 055d374 commit 0232605
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -6751,7 +6751,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev
thread->tsk = kthread_run(md_thread, thread,
"%s_%s",
mdname(thread->mddev),
name ?: mddev->pers->name);
name);
if (IS_ERR(thread->tsk)) {
kfree(thread);
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion drivers/md/multipath.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev)
}

{
mddev->thread = md_register_thread(multipathd, mddev, NULL);
mddev->thread = md_register_thread(multipathd, mddev,
"multipath");
if (!mddev->thread) {
printk(KERN_ERR "multipath: couldn't allocate thread"
" for %s\n", mdname(mddev));
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
goto abort;
}
err = -ENOMEM;
conf->thread = md_register_thread(raid1d, mddev, NULL);
conf->thread = md_register_thread(raid1d, mddev, "raid1");
if (!conf->thread) {
printk(KERN_ERR
"md/raid1:%s: couldn't allocate thread\n",
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
spin_lock_init(&conf->resync_lock);
init_waitqueue_head(&conf->wait_barrier);

conf->thread = md_register_thread(raid10d, mddev, NULL);
conf->thread = md_register_thread(raid10d, mddev, "raid10");
if (!conf->thread)
goto out;

Expand Down
4 changes: 3 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -4840,6 +4840,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
int raid_disk, memory, max_disks;
struct md_rdev *rdev;
struct disk_info *disk;
char pers_name[6];

if (mddev->new_level != 5
&& mddev->new_level != 4
Expand Down Expand Up @@ -4963,7 +4964,8 @@ static struct r5conf *setup_conf(struct mddev *mddev)
printk(KERN_INFO "md/raid:%s: allocated %dkB\n",
mdname(mddev), memory);

conf->thread = md_register_thread(raid5d, mddev, NULL);
sprintf(pers_name, "raid%d", mddev->new_level);
conf->thread = md_register_thread(raid5d, mddev, pers_name);
if (!conf->thread) {
printk(KERN_ERR
"md/raid:%s: couldn't allocate thread.\n",
Expand Down

0 comments on commit 0232605

Please sign in to comment.