File 0065-Grow-be-even-more-careful-about-handing-a-0-complete.patch of Package mdadm.5365
From 3ee556f8b6d9aa8c843b9f83e88d90a976259f49 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 15 May 2015 15:11:48 +1000
Subject: [PATCH 092/359] Grow: be even more careful about handing a '0'
completed value.
References: bsc#1081910
Some old kernels set 'completed' to '0' too soon.
But modern kernels don't.
And when 'mdadm --stop' freezes and resume the grow,
'completed' goes back to zero briefly, which can confuse this
logic.
So only think '0' might be wrong from an old kernel when
the reshape has gone idle.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Coly Li <colyli@suse.de>
---
Grow.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index fe42b2b..f2cf46a 100644
--- a/Grow.c
+++ b/Grow.c
@@ -3844,9 +3844,11 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
* So we need these extra tests.
*/
if (completed == 0 && advancing
+ && strncmp(action, "idle", 4) == 0
&& info->reshape_progress > 0)
break;
if (completed == 0 && !advancing
+ && strncmp(action, "idle", 4) == 0
&& info->reshape_progress < (info->component_size
* reshape->after.data_disks))
break;
@@ -3863,7 +3865,7 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
char action[20];
if (sysfs_get_str(info, NULL, "sync_action",
action, 20) > 0 &&
- strncmp(action, "reshape", 7) == 0)
+ strncmp(action, "idle", 4) == 0)
completed = max_progress;
}
--
2.16.1