[PATCH][MD] raid : fix raid recoverying all data corruption, when j=0(sectors) interrupted by "echo idle > /sys/block/md0/md/sync_action"

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

 



Hi, Neil

I find a problem unintentionally: Raid5 is recovering, interrupted by
"echo idle  > /sys/block/md0/md/sync_action", at this point,
j=0(sector), after a while,  recovery thread is wake up, now j = 3
because when j=0, mddev->curr_resync = 3 by kernel code, so recovery
thread will start on the basic of j=3, which will lead all data
corruption. To avoid the problem,can we amend variable j by 8 sectors
alignment? as shown below:
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 709755f..fe4a5f9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7400,7 +7400,7 @@ void md_do_sync(struct md_thread *thread)
        if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
            break;

-       sectors = mddev->pers->sync_request(mddev, j, &skipped,
+       sectors = mddev->pers->sync_request(mddev, (j &
~((sector_t)STRIPE_SECTORS-1)), &skipped,
                          currspeed < speed_min(mddev));
        if (sectors == 0) {
            set_bit(MD_RECOVERY_INTR, &mddev->recovery);
--
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