2023-05-27 10:30:10

by Li Nan

[permalink] [raw]
Subject: [PATCH] md/raid10: clean up md_add_new_disk()

From: Li Nan <[email protected]>

Commit 1a855a060665 ("md: fix bug with re-adding of partially recovered
device.") only add device which is set to In_sync. But it let devices
without metadata cannot be added when they should be.

Commit bf572541ab44 ("md: fix regression with re-adding devices to arrays
with no metadata") fix the above issue, it set device without metadata to
In_sync when add new disk.

However, after commit f466722ca614 ("md: Change handling of save_raid_disk
and metadata update during recovery.") deletes changes of the first patch,
setting In_sync for devcie without metadata is meanless because the flag
will be cleared soon and will not be used during this period. Clean it up.

Signed-off-by: Li Nan <[email protected]>
---
drivers/md/md.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8e344b4b3444..e5b67b2d2166 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6733,7 +6733,6 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
if (info->state & (1<<MD_DISK_SYNC) &&
info->raid_disk < mddev->raid_disks) {
rdev->raid_disk = info->raid_disk;
- set_bit(In_sync, &rdev->flags);
clear_bit(Bitmap_sync, &rdev->flags);
} else
rdev->raid_disk = -1;
--
2.31.1



2023-05-28 08:17:32

by Yu Kuai

[permalink] [raw]
Subject: Re: [PATCH] md/raid10: clean up md_add_new_disk()

?? 2023/05/27 18:18, [email protected] д??:
> From: Li Nan <[email protected]>
>
> Commit 1a855a060665 ("md: fix bug with re-adding of partially recovered
> device.") only add device which is set to In_sync. But it let devices
> without metadata cannot be added when they should be.
>
> Commit bf572541ab44 ("md: fix regression with re-adding devices to arrays
> with no metadata") fix the above issue, it set device without metadata to
> In_sync when add new disk.
>
> However, after commit f466722ca614 ("md: Change handling of save_raid_disk
> and metadata update during recovery.") deletes changes of the first patch,
> setting In_sync for devcie without metadata is meanless because the flag
> will be cleared soon and will not be used during this period. Clean it up.

LGME, feel free to add:

Reviewed-by: Yu Kuai <[email protected]>
>
> Signed-off-by: Li Nan <[email protected]>
> ---
> drivers/md/md.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 8e344b4b3444..e5b67b2d2166 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -6733,7 +6733,6 @@ int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
> if (info->state & (1<<MD_DISK_SYNC) &&
> info->raid_disk < mddev->raid_disks) {
> rdev->raid_disk = info->raid_disk;
> - set_bit(In_sync, &rdev->flags);
> clear_bit(Bitmap_sync, &rdev->flags);
> } else
> rdev->raid_disk = -1;
>


2023-05-30 22:41:28

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] md/raid10: clean up md_add_new_disk()

On Sun, May 28, 2023 at 12:49 AM Yu Kuai <[email protected]> wrote:
>
> 在 2023/05/27 18:18, [email protected] 写道:
> > From: Li Nan <[email protected]>
> >
> > Commit 1a855a060665 ("md: fix bug with re-adding of partially recovered
> > device.") only add device which is set to In_sync. But it let devices
> > without metadata cannot be added when they should be.
> >
> > Commit bf572541ab44 ("md: fix regression with re-adding devices to arrays
> > with no metadata") fix the above issue, it set device without metadata to
> > In_sync when add new disk.
> >
> > However, after commit f466722ca614 ("md: Change handling of save_raid_disk
> > and metadata update during recovery.") deletes changes of the first patch,
> > setting In_sync for devcie without metadata is meanless because the flag
> > will be cleared soon and will not be used during this period. Clean it up.
>
> LGME, feel free to add:
>
> Reviewed-by: Yu Kuai <[email protected]>
> >
> > Signed-off-by: Li Nan <[email protected]>

Applied to md-next.

Thanks,
Song