All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][MD] raid : fix raid recoverying all data corruption, when j=0(sectors) interrupted by "echo idle > /sys/block/md0/md/sync_action"
@ 2014-12-27  8:20 董杨
  0 siblings, 0 replies; only message in thread
From: 董杨 @ 2014-12-27  8:20 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-27  8:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27  8:20 [PATCH][MD] raid : fix raid recoverying all data corruption, when j=0(sectors) interrupted by "echo idle > /sys/block/md0/md/sync_action" 董杨

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.