]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
restripe: fix data block order in raid6_2_data_recov
authorNeilBrown <neilb@suse.de>
Mon, 20 Jul 2015 07:15:13 +0000 (17:15 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 20 Jul 2015 07:15:13 +0000 (17:15 +1000)
... rather than relying on the caller getting them in the
correct order.
This is better engineering and fixes a bug, but because the
failed_slotX numbers are used later with assumption that
they weren't swapped

Signed-off-by: NeilBrown <neilb@suse.de>
raid6check.c
restripe.c

index f01944053cda6505a9c091b3a5f6609fbbb50ffe..b2e173233ca6ef2853acb298661b27a4ff3d7f04 100644 (file)
@@ -271,11 +271,6 @@ int manual_repair(int chunk_size, int syndrome_disks,
                                          failed_data, (uint8_t**)blocks, 1);
                } else {
                        printf("Repairing D and D\n");
-                       if (failed_slot1 > failed_slot2) {
-                               int t = failed_slot1;
-                               failed_slot1 = failed_slot2;
-                               failed_slot2 = t;
-                       }
                        raid6_2data_recov(syndrome_disks+2, chunk_size,
                                          failed_slot1, failed_slot2,
                                          (uint8_t**)blocks, 1);
index 1c859a3058a417467f18aa2597e5d0d6b984df95..4d921904b5e99197504469166fff44891bf29da2 100644 (file)
@@ -354,6 +354,12 @@ void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
        const uint8_t *pbmul;   /* P multiplier table for B data */
        const uint8_t *qmul;            /* Q multiplier table (for both) */
 
+       if (faila > failb) {
+               int t = faila;
+               faila = failb;
+               failb = t;
+       }
+
        if (neg_offset) {
                p = ptrs[-1];
                q = ptrs[-2];
@@ -651,11 +657,6 @@ int save_stripes(int *source, unsigned long long *offsets,
                                raid6_datap_recov(syndrome_disks+2, chunk_size,
                                                  fdisk[0], bufs, 0);
                        else {
-                               if (fdisk[0] > fdisk[1]) {
-                                       int t = fdisk[0];
-                                       fdisk[0] = fdisk[1];
-                                       fdisk[1] = t;
-                               }
                                /* Two data blocks failed, P,Q OK */
                                raid6_2data_recov(syndrome_disks+2, chunk_size,
                                                  fdisk[0], fdisk[1], bufs, 0);