imsm: FIX: Verify if migration record is loaded correctly

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

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Adam Kwolek 2011-06-09 13:00:54 +10:00 committed by NeilBrown
parent 6b7a407dce
commit 2e062e8210
1 changed files with 19 additions and 13 deletions

View File

@ -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 (lseek64(fd, dsize - (512 * 2), SEEK_SET) < 0) {
if (devname) if (devname)
fprintf(stderr, fprintf(stderr, Name
Name ": Cannot seek to anchor block on %s: %s\n", ": Cannot seek to anchor block on %s: %s\n",
devname, strerror(errno)); devname, strerror(errno));
return 1; return 1;
} }
@ -3836,16 +3836,17 @@ static int load_super_imsm(struct supertype *st, int fd, char *devname)
} }
/* load migration record */ /* load migration record */
load_imsm_migr_rec(super, NULL); if (load_imsm_migr_rec(super, NULL) == 0) {
/* Check for unsupported migration features */
/* Check for unsupported migration features */ if (check_mpb_migr_compatibility(super) != 0) {
if (check_mpb_migr_compatibility(super) != 0) { fprintf(stderr,
fprintf(stderr, Name ": Unsupported migration detected"); Name ": Unsupported migration detected");
if (devname) if (devname)
fprintf(stderr, " on %s\n", devname); fprintf(stderr, " on %s\n", devname);
else else
fprintf(stderr, " (IMSM).\n"); fprintf(stderr, " (IMSM).\n");
return 3; return 3;
}
} }
return 0; return 0;
@ -7762,7 +7763,12 @@ abort:
int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state) int save_checkpoint_imsm(struct supertype *st, struct mdinfo *info, int state)
{ {
struct intel_super *super = st->sb; 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) { if (__le32_to_cpu(super->migr_rec->blocks_per_unit) == 0) {
dprintf("ERROR: blocks_per_unit = 0!!!\n"); dprintf("ERROR: blocks_per_unit = 0!!!\n");
return 1; return 1;