瀏覽代碼

md/raid5: add a missing 'continue' in a loop.

As the comment says, the tail of this loop only applies to devices
that are not fully in sync, so if In_sync was set, we should avoid
the rest of the loop.

This bug will hardly ever cause an actual problem.  The worst it
can do is allow an array to be assembled that is dirty and degraded,
which is not generally a good idea (without warning the sysadmin
first).

This will only happen if the array is RAID4 or a RAID5/6 in an
intermediate state during a reshape and so has one drive that is
all 'parity' - no data - while some other device has failed.

This is certainly possible, but not at all common.

Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown 15 年之前
父節點
當前提交
2f11588249
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/md/raid5.c

+ 3 - 1
drivers/md/raid5.c

@@ -5057,8 +5057,10 @@ static int run(mddev_t *mddev)
 	list_for_each_entry(rdev, &mddev->disks, same_set) {
 	list_for_each_entry(rdev, &mddev->disks, same_set) {
 		if (rdev->raid_disk < 0)
 		if (rdev->raid_disk < 0)
 			continue;
 			continue;
-		if (test_bit(In_sync, &rdev->flags))
+		if (test_bit(In_sync, &rdev->flags)) {
 			working_disks++;
 			working_disks++;
+			continue;
+		}
 		/* This disc is not fully in-sync.  However if it
 		/* This disc is not fully in-sync.  However if it
 		 * just stored parity (beyond the recovery_offset),
 		 * just stored parity (beyond the recovery_offset),
 		 * when we don't need to be concerned about the
 		 * when we don't need to be concerned about the