dm raid: fix nosync status
authorHeinz Mauelshagen <heinzm@redhat.com>
Fri, 16 Mar 2018 22:01:59 +0000 (23:01 +0100)
committerMike Snitzer <snitzer@redhat.com>
Tue, 3 Apr 2018 19:04:19 +0000 (15:04 -0400)
Fix a race for "nosync" activations providing "aa.." device health
characters and "0/N" sync ratio rather than "AA..." and "N/N".  Occurs
when status for the raid set is retrieved during resume before the MD
sync thread starts and clears the MD_RECOVERY_NEEDED flag.

Cc: stable@vger.kernel.org # 4.16+
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-raid.c

index b7a9c710ebecdbd770bb7dd908510cac523c1959..598c9e3e41a55031042a2f749b0ec1bfd5b8dedd 100644 (file)
@@ -3408,7 +3408,8 @@ 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_INTR, &recovery) &&
+               if (!test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags) &&
+                   !test_bit(MD_RECOVERY_INTR, &recovery) &&
                    (test_bit(MD_RECOVERY_NEEDED, &recovery) ||
                     test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
                     test_bit(MD_RECOVERY_RUNNING, &recovery)))