diff options
| author | Yu Kuai <[email protected]> | 2023-08-25 03:09:50 +0000 |
|---|---|---|
| committer | Song Liu <[email protected]> | 2023-09-22 17:28:26 +0000 |
| commit | d58eff83bd3c6166944f6b159544438385d48549 (patch) | |
| tree | dca3c35f545f70bdfca369f679342dc784739a99 /drivers/md/dm-raid.c | |
| parent | md: delay remove_and_add_spares() for read only array to md_start_sync() (diff) | |
| download | kernel-d58eff83bd3c6166944f6b159544438385d48549.tar.gz kernel-d58eff83bd3c6166944f6b159544438385d48549.zip | |
md: initialize 'active_io' while allocating mddev
'active_io' is used for mddev_suspend() and it's initialized in
md_run(), this restrict that 'reconfig_mutex' must be held and
"mddev->pers" must be set before calling mddev_suspend().
Initialize 'active_io' early so that mddev_suspend() is safe to call
once mddev is allocated, this will be helpful to refactor
mddev_suspend() in following patches.
Signed-off-by: Yu Kuai <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/md/dm-raid.c')
| -rw-r--r-- | drivers/md/dm-raid.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 5f9991765f27..69805d37e113 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -749,7 +749,11 @@ static struct raid_set *raid_set_alloc(struct dm_target *ti, struct raid_type *r return ERR_PTR(-ENOMEM); } - mddev_init(&rs->md); + if (mddev_init(&rs->md)) { + kfree(rs); + ti->error = "Cannot initialize raid context"; + return ERR_PTR(-ENOMEM); + } rs->raid_disks = raid_devs; rs->delta_disks = 0; @@ -798,6 +802,7 @@ static void raid_set_free(struct raid_set *rs) dm_put_device(rs->ti, rs->dev[i].data_dev); } + mddev_destroy(&rs->md); kfree(rs); } |
