From: Adam Kwolek Date: Wed, 26 Jan 2011 20:56:21 +0000 (+1100) Subject: WORKAROUND: mdadm hangs during reshape X-Git-Tag: mdadm-3.2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26d6e1574a1673d98a4cdd5a76d9c6f7de72e9d4;p=thirdparty%2Fmdadm.git 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 Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index 27488b16..b14d6381 100644 --- a/Grow.c +++ b/Grow.c @@ -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);