md/raid5: clear R5_NeedReplace when no longer needed.
authorNeilBrown <neilb@suse.com>
Fri, 17 Jul 2015 03:26:23 +0000 (13:26 +1000)
committerNeilBrown <neilb@suse.com>
Fri, 24 Jul 2015 03:38:04 +0000 (13:38 +1000)
This flag is currently never cleared, which can in rare cases
trigger a warn-on if it is still set but the block isn't
InSync.

So clear it when it isn't need, which includes if the replacement
device has failed.

Signed-off-by: NeilBrown <neilb@suse.com>
drivers/md/raid5.c

index 38300ee3c4e15f35f4e8eef9f6942a517407058d..643d217bfa13ac8caa3dee9f9dd65d57f165bbe8 100644 (file)
@@ -4066,8 +4066,10 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
                                 &first_bad, &bad_sectors))
                        set_bit(R5_ReadRepl, &dev->flags);
                else {
-                       if (rdev)
+                       if (rdev && !test_bit(Faulty, &rdev->flags))
                                set_bit(R5_NeedReplace, &dev->flags);
+                       else
+                               clear_bit(R5_NeedReplace, &dev->flags);
                        rdev = rcu_dereference(conf->disks[i].rdev);
                        clear_bit(R5_ReadRepl, &dev->flags);
                }