WORKAROUND: mdadm hangs during reshape

During reshape when reshape is finished in md, progress_reshape() hangs
on select().
This is because 'sync_completed' is reset to zero before 'sync_action'
becomes 'idle', and we don't look for notification on 'sync_action'.

So if completed becomes zero after reshape_progress has made some
progress, then deduce that reshape has finished.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Adam Kwolek 2011-01-27 07:56:21 +11:00 committed by NeilBrown
parent 16d4d84e5d
commit 26d6e1574a
1 changed files with 11 additions and 0 deletions

11
Grow.c
View File

@ -2425,6 +2425,17 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
action, 20) <= 0 ||
strncmp(action, "reshape", 7) != 0)
break;
/* Some kernels reset 'sync_completed' to zero
* before setting 'sync_action' to 'idle'.
* So we need these extra tests.
*/
if (completed == 0 && advancing
&& info->reshape_progress > 0)
break;
if (completed == 0 && !advancing
&& info->reshape_progress < (info->component_size
* reshape->after.data_disks))
break;
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
select(fd+1, NULL, NULL, &rfds, NULL);