Skip to content

Commit 0232605

Browse files
committed
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 <[email protected]> Signed-off-by: NeilBrown <[email protected]>
1 parent 055d374 commit 0232605

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

drivers/md/md.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6751,7 +6751,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev
67516751
thread->tsk = kthread_run(md_thread, thread,
67526752
"%s_%s",
67536753
mdname(thread->mddev),
6754-
name ?: mddev->pers->name);
6754+
name);
67556755
if (IS_ERR(thread->tsk)) {
67566756
kfree(thread);
67576757
return NULL;

drivers/md/multipath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev)
474474
}
475475

476476
{
477-
mddev->thread = md_register_thread(multipathd, mddev, NULL);
477+
mddev->thread = md_register_thread(multipathd, mddev,
478+
"multipath");
478479
if (!mddev->thread) {
479480
printk(KERN_ERR "multipath: couldn't allocate thread"
480481
" for %s\n", mdname(mddev));

drivers/md/raid1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2621,7 +2621,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
26212621
goto abort;
26222622
}
26232623
err = -ENOMEM;
2624-
conf->thread = md_register_thread(raid1d, mddev, NULL);
2624+
conf->thread = md_register_thread(raid1d, mddev, "raid1");
26252625
if (!conf->thread) {
26262626
printk(KERN_ERR
26272627
"md/raid1:%s: couldn't allocate thread\n",

drivers/md/raid10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3427,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
34273427
spin_lock_init(&conf->resync_lock);
34283428
init_waitqueue_head(&conf->wait_barrier);
34293429

3430-
conf->thread = md_register_thread(raid10d, mddev, NULL);
3430+
conf->thread = md_register_thread(raid10d, mddev, "raid10");
34313431
if (!conf->thread)
34323432
goto out;
34333433

drivers/md/raid5.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4840,6 +4840,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
48404840
int raid_disk, memory, max_disks;
48414841
struct md_rdev *rdev;
48424842
struct disk_info *disk;
4843+
char pers_name[6];
48434844

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

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);
49674969
if (!conf->thread) {
49684970
printk(KERN_ERR
49694971
"md/raid:%s: couldn't allocate thread.\n",

0 commit comments

Comments
 (0)