diff options
author | Yu Kuai <yukuai3@huawei.com> | 2023-07-31 10:28:00 +0800 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2023-08-15 09:39:48 -0700 |
commit | 892da88d1cd93426e9c6d7717876ca705fe2b9fa (patch) | |
tree | 0c092b9d48b16939ffa2b6b8e4d81f78463155d5 /drivers/md | |
parent | 8b0472b50bcf0f19a5119b00a53b63579c8e1e4d (diff) |
md/raid10: fix a 'conf->barrier' leakage in raid10_takeover()
After commit b39f35ebe86d ("md: don't quiesce in mddev_suspend()"),
'conf->barrier' will be leaked in the case that raid10 takeover raid0:
level_store
pers->takeover -> raid10_takeover
raid10_takeover_raid0
WRITE_ONCE(conf->barrier, 1)
mddev_suspend
// still raid0
mddev->pers = pers
// switch to raid10
mddev_resume
// resume without suspend
After the above commit, mddev_resume() will not decrease 'conf->barrier'
that is set in raid10_takeover_raid0().
Fix this problem by not setting 'conf->barrier' in raid10_takeover_raid0().
By the way, this problem is found while I'm trying to make
mddev_suspend/resume() to be independent from raid personalities. raid10
is the only personality to use reference count in the quiesce() callback
and this problem is only related to raid10.
Fixes: b39f35ebe86d ("md: don't quiesce in mddev_suspend()")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://lore.kernel.org/r/20230731022800.1424902-1-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid10.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 16aa9d735880..7704a4c7f469 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4417,7 +4417,6 @@ static void *raid10_takeover_raid0(struct mddev *mddev, sector_t size, int devs) rdev->new_raid_disk = rdev->raid_disk * 2; rdev->sectors = size; } - WRITE_ONCE(conf->barrier, 1); } return conf; |