Skip to content

Commit 799af94

Browse files
Christoph Hellwigaxboe
authored andcommitted
md/raid1: don't free conf on raid0_run failure
The core md code calls the ->free method which already frees conf. Fixes: 07f1a68 ("md/raid1: fail run raid1 array when active disk less than one") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d11854e commit 799af94

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/md/raid1.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,7 +3204,6 @@ static int raid1_set_limits(struct mddev *mddev)
32043204
return queue_limits_set(mddev->gendisk->queue, &lim);
32053205
}
32063206

3207-
static void raid1_free(struct mddev *mddev, void *priv);
32083207
static int raid1_run(struct mddev *mddev)
32093208
{
32103209
struct r1conf *conf;
@@ -3238,7 +3237,7 @@ static int raid1_run(struct mddev *mddev)
32383237
if (!mddev_is_dm(mddev)) {
32393238
ret = raid1_set_limits(mddev);
32403239
if (ret)
3241-
goto abort;
3240+
return ret;
32423241
}
32433242

32443243
mddev->degraded = 0;
@@ -3252,8 +3251,7 @@ static int raid1_run(struct mddev *mddev)
32523251
*/
32533252
if (conf->raid_disks - mddev->degraded < 1) {
32543253
md_unregister_thread(mddev, &conf->thread);
3255-
ret = -EINVAL;
3256-
goto abort;
3254+
return -EINVAL;
32573255
}
32583256

32593257
if (conf->raid_disks - mddev->degraded == 1)
@@ -3277,14 +3275,8 @@ static int raid1_run(struct mddev *mddev)
32773275
md_set_array_sectors(mddev, raid1_size(mddev, 0, 0));
32783276

32793277
ret = md_integrity_register(mddev);
3280-
if (ret) {
3278+
if (ret)
32813279
md_unregister_thread(mddev, &mddev->thread);
3282-
goto abort;
3283-
}
3284-
return 0;
3285-
3286-
abort:
3287-
raid1_free(mddev, conf);
32883280
return ret;
32893281
}
32903282

0 commit comments

Comments
 (0)