diff options
author | Adam Kwolek <adam.kwolek@intel.com> | 2011-06-14 12:42:22 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-06-14 12:42:22 +1000 |
commit | d1877f697d8084755c80079bc3a8ee7f93788833 (patch) | |
tree | fa3f2d523ce32585f3d1ea40920e95e59ea9159b | |
parent | b66e591b145c84d59270410a34abcd5136caa24f (diff) | |
download | mdadm-d1877f697d8084755c80079bc3a8ee7f93788833.tar.gz |
imsm: FIX: Raid5 data corruption data recovering from backup
Sporadicaly when Raid5's data are restored from backup area,
corruption occurs.
It doesn't happen if reshape process is beyond critical section.
Root cause of the problem is passing wrong starting point in
restore_stripes(). It was hard coded to 0 so far.
This causes that parity disks position in first stripe was always set
to the last raid disk. This position should depend on data position in array.
Proper start position was set and pointer for restoring data
(copy area address) is adjusted to passed start parameter.
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | super-intel.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c index d8464b7..65d1f1b 100644 --- a/super-intel.c +++ b/super-intel.c @@ -7710,6 +7710,8 @@ int save_backup_imsm(struct supertype *st, int new_disks = map_dest->num_members; int dest_layout = 0; int dest_chunk; + unsigned long long start; + int data_disks = imsm_num_data_members(dev, 0); targets = malloc(new_disks * sizeof(int)); if (!targets) @@ -7719,10 +7721,15 @@ int save_backup_imsm(struct supertype *st, if (!target_offsets) goto abort; + start = info->reshape_progress * 512; for (i = 0; i < new_disks; i++) { targets[i] = -1; target_offsets[i] = (unsigned long long) __le32_to_cpu(super->migr_rec->ckpt_area_pba) * 512; + /* move back copy area adderss, it will be moved forward + * in restore_stripes() using start input variable + */ + target_offsets[i] -= start/data_disks; } if (open_backup_targets(info, new_disks, targets)) @@ -7740,7 +7747,7 @@ int save_backup_imsm(struct supertype *st, -1, /* source backup file descriptor */ 0, /* input buf offset * always 0 buf is already offseted */ - 0, + start, length, buf) != 0) { fprintf(stderr, Name ": Error restoring stripes\n"); |