[lkml]   [2012]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ 41/70] md/raid1: dont abort a resync on the first badblock.
    3.2-stable review patch.  If anyone has any objections, please let me know.


    From: NeilBrown <>

    commit b7219ccb33aa0df9949a60c68b5e9f712615e56f upstream.

    If a resync of a RAID1 array with 2 devices finds a known bad block
    one device it will neither read from, or write to, that device for
    this block offset.
    So there will be one read_target (The other device) and zero write
    This condition causes md/raid1 to abort the resync assuming that it
    has finished - without known bad blocks this would be true.

    When there are no write targets because of the presence of bad blocks
    we should only skip over the area covered by the bad block.
    RAID10 already gets this right, raid1 doesn't. Or didn't.

    As this can cause a 'sync' to abort early and appear to have succeeded
    it could lead to some data corruption, so it suitable for -stable.

    Reported-by: Alexander Lyakas <>
    Signed-off-by: NeilBrown <>
    Signed-off-by: Ben Hutchings <>
    drivers/md/raid1.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
    index 7aa958e..d2361b1 100644
    --- a/drivers/md/raid1.c
    +++ b/drivers/md/raid1.c
    @@ -2502,7 +2502,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
    /* There is nowhere to write, so all non-sync
    * drives must be failed - so we are finished
    - sector_t rv = max_sector - sector_nr;
    + sector_t rv;
    + if (min_bad > 0)
    + max_sector = sector_nr + min_bad;
    + rv = max_sector - sector_nr;
    *skipped = 1;
    return rv;

     \ /
      Last update: 2012-08-07 06:21    [W:0.028 / U:1.640 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site