diff mbox

dm raid: fix degraded sync_ratio

Message ID ce8aa347b9ce44c5b854472e286a130cb8b849f2.1519764140.git.heinzm@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Heinz Mauelshagen Feb. 27, 2018, 8:58 p.m. UTC
Upstream commits 4102d9de6d375fc27ec70382c4068f4f9f62ce4f 
in combination with 7c29744eccecc2c74c9b4d1ea0a60b4d95229399
introduced a regression reporting wrong zero sync_ratio for
degraded raid sets through the targets status interface thus
causing lvm2 to fail to repair raid legs automatically.

Fix by identifying the degraded state checking the MD_RECOVERY_INTR
flag and returning mddev->recovery_cp in case it is set.

Fix passes automatic repair tests.


Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
---
 drivers/md/dm-raid.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 7ef469e902c6..c1d1034ff7b7 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3408,9 +3408,10 @@  static sector_t rs_get_progress(struct raid_set *rs, unsigned long recovery,
 		set_bit(RT_FLAG_RS_IN_SYNC, &rs->runtime_flags);
 
 	} else {
-		if (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
-		    test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
-		    test_bit(MD_RECOVERY_RUNNING, &recovery))
+		if (!test_bit(MD_RECOVERY_INTR, &recovery) &&
+		    (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
+		     test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
+		     test_bit(MD_RECOVERY_RUNNING, &recovery)))
 			r = mddev->curr_resync_completed;
 		else
 			r = mddev->recovery_cp;