Message ID | 20240828021150.63240-3-xni@redhat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mdadm tests fix | expand |
Context | Check | Description |
---|---|---|
mdraidci/vmtest-md-6_11-PR | fail | merge-conflict |
mdraidci/vmtest-md-6_12-PR | fail | merge-conflict |
On Wed, 28 Aug 2024 10:11:42 +0800 Xiao Ni <xni@redhat.com> wrote: > It tries to update data offset when kicking off reshape. If it can't > change data offset, it needs to use child_monitor to monitor reshape > progress and do back up job. And it needs to update reshape_progress > to need_back when reshape finishes. If not, it will be in a infinite > loop. > > Signed-off-by: Xiao Ni <xni@redhat.com> > --- > Grow.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/Grow.c b/Grow.c > index 97e48d86a33f..6b621aea4ecc 100644 > --- a/Grow.c > +++ b/Grow.c > @@ -4142,8 +4142,7 @@ int progress_reshape(struct mdinfo *info, struct > reshape *reshape, > * waiting forever on a dead array > */ > char action[SYSFS_MAX_BUF_SIZE]; > - if (sysfs_get_str(info, NULL, "sync_action", action, > sizeof(action)) <= 0 || > - strncmp(action, "reshape", 7) != 0) > + if (sysfs_get_str(info, NULL, "sync_action", action, > sizeof(action)) <= 0) break; There must be empty line after declaration. > /* Some kernels reset 'sync_completed' to zero > * before setting 'sync_action' to 'idle'. > @@ -4151,12 +4150,18 @@ int progress_reshape(struct mdinfo *info, struct > reshape *reshape, */ > if (completed == 0 && advancing && > strncmp(action, "idle", 4) == 0 && > - info->reshape_progress > 0) > + info->reshape_progress > 0) { > + info->reshape_progress = need_backup; > break; > + } > if (completed == 0 && !advancing && > strncmp(action, "idle", 4) == 0 && > info->reshape_progress < > - (info->component_size * reshape->after.data_disks)) > + (info->component_size * reshape->after.data_disks)) { > + info->reshape_progress = need_backup; > + break; This look weird to assign need_backup (suggests boolean field) to reshape_progress but it is not your code so you have my ack. Thanks, Mariusz > + } > + if (strncmp(action, "reshape", 7) != 0) > break; > sysfs_wait(fd, NULL); > if (sysfs_fd_get_ll(fd, &completed) < 0)
diff --git a/Grow.c b/Grow.c index 97e48d86a33f..6b621aea4ecc 100644 --- a/Grow.c +++ b/Grow.c @@ -4142,8 +4142,7 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape, * waiting forever on a dead array */ char action[SYSFS_MAX_BUF_SIZE]; - if (sysfs_get_str(info, NULL, "sync_action", action, sizeof(action)) <= 0 || - strncmp(action, "reshape", 7) != 0) + if (sysfs_get_str(info, NULL, "sync_action", action, sizeof(action)) <= 0) break; /* Some kernels reset 'sync_completed' to zero * before setting 'sync_action' to 'idle'. @@ -4151,12 +4150,18 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape, */ if (completed == 0 && advancing && strncmp(action, "idle", 4) == 0 && - info->reshape_progress > 0) + info->reshape_progress > 0) { + info->reshape_progress = need_backup; break; + } if (completed == 0 && !advancing && strncmp(action, "idle", 4) == 0 && info->reshape_progress < - (info->component_size * reshape->after.data_disks)) + (info->component_size * reshape->after.data_disks)) { + info->reshape_progress = need_backup; + break; + } + if (strncmp(action, "reshape", 7) != 0) break; sysfs_wait(fd, NULL); if (sysfs_fd_get_ll(fd, &completed) < 0)
It tries to update data offset when kicking off reshape. If it can't change data offset, it needs to use child_monitor to monitor reshape progress and do back up job. And it needs to update reshape_progress to need_back when reshape finishes. If not, it will be in a infinite loop. Signed-off-by: Xiao Ni <xni@redhat.com> --- Grow.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)