Parcourir la source

MD: kick out journal disk if it's not fresh

When journal disk is faulty and we are reassemabling the raid array, the
journal disk is old. We don't allow the journal disk added to the raid
array. Since journal disk is missing in the array, the raid5 will mark
the array readonly.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Song Liu il y a 9 ans
Parent
commit
a3dfbdaadb
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      drivers/md/md.c

+ 2 - 1
drivers/md/md.c

@@ -1608,7 +1608,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
 		++ev1;
 		++ev1;
 		if (rdev->desc_nr >= 0 &&
 		if (rdev->desc_nr >= 0 &&
 		    rdev->desc_nr < le32_to_cpu(sb->max_dev) &&
 		    rdev->desc_nr < le32_to_cpu(sb->max_dev) &&
-		    le16_to_cpu(sb->dev_roles[rdev->desc_nr]) < MD_DISK_ROLE_MAX)
+		    (le16_to_cpu(sb->dev_roles[rdev->desc_nr]) < MD_DISK_ROLE_MAX ||
+		     le16_to_cpu(sb->dev_roles[rdev->desc_nr]) == MD_DISK_ROLE_JOURNAL))
 			if (ev1 < mddev->events)
 			if (ev1 < mddev->events)
 				return -EINVAL;
 				return -EINVAL;
 	} else if (mddev->bitmap) {
 	} else if (mddev->bitmap) {