[PATCH 03/21] imsm: FIX: Verify if migration record is loaded correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Migration compatibility can be checked when general migration record
is present.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 super-intel.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 01ffcc8..269cb0a 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3038,8 +3038,8 @@ static int load_imsm_mpb(int fd, struct intel_super *super, char *devname)
 
 	if (lseek64(fd, dsize - (512 * 2), SEEK_SET) < 0) {
 		if (devname)
-			fprintf(stderr,
-				Name ": Cannot seek to anchor block on %s: %s\n",
+			fprintf(stderr, Name
+				": Cannot seek to anchor block on %s: %s\n",
 				devname, strerror(errno));
 		return 1;
 	}
@@ -3836,16 +3836,17 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
 	}
 
 	/* load migration record */
-	load_imsm_migr_rec(super, NULL);
-
-	/* Check for unsupported migration features */
-	if (check_mpb_migr_compatibility(super) != 0) {
-		fprintf(stderr, Name ": Unsupported migration detected");
-		if (devname)
-			fprintf(stderr, " on %s\n", devname);
-		else
-			fprintf(stderr, " (IMSM).\n");
-		return 3;
+	if (load_imsm_migr_rec(super, NULL) == 0) {
+		/* Check for unsupported migration features */
+		if (check_mpb_migr_compatibility(super) != 0) {
+			fprintf(stderr,
+				Name ": Unsupported migration detected");
+			if (devname)
+				fprintf(stderr, " on %s\n", devname);
+			else
+				fprintf(stderr, " (IMSM).\n");
+			return 3;
+		}
 	}
 
 	return 0;
@@ -7763,7 +7764,12 @@ abort:
 int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state)
 {
 	struct intel_super *super = st->sb;
-	load_imsm_migr_rec(super, info);
+	if (load_imsm_migr_rec(super, info) != 0) {
+		dprintf("imsm: ERROR: Cannot read migration record "
+			"for checkpoint save.\n");
+		return 1;
+	}
+
 	if (__le32_to_cpu(super->migr_rec->blocks_per_unit) == 0) {
 		dprintf("ERROR: blocks_per_unit = 0!!!\n");
 		return 1;

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux