Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=64.215.233.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796067165; b=RJtRPUlkBEXP6jFeE7BU4nF+Wc09tKHivtPC7PvgM6f+CbSGmTLmFLlW+BT0EdNWqXou e/bZDBfEvPrsaskWSFRScB63Kxc4YG+nIBSVcs7M1MGvY2lrehgeS4G3jAKnOdPlylwwR ehjhToA61f8NhTDvvPbNh2fDrHuj1HWE9qWywSW3UJseScEGznpxTKKhwpR5kUfQF9WDX 8GvZw1nKBSPGrHdp71dSnPnFmBCI9IzIxGHLioCUJrnnV02y6tK3zLP18ND+TgR6S2X0s stJe4iAMRJkBaw/ad9+VmQRqva2+i6WFiGO6pnyOWdIHxX3jnkeFuLqFfvkSavWlXqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796067165; h=DMARC-Filter:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=1fd/3udI3ZaSV+jAPZ2bWGr07l2UzlTHbH4KU0AfYrE=; b=Gapx7iv0+DRlu5VcrcmMhkhqYuMejG4qaMFRk4fGw0rS7t7GMy3vrMgtQHJHB6SXgAL3 dF3n6xxLg4ElLp/KIQJpL24ZKdvJtxcwXTCrSl9kFe2IR3eWRkpjLhICd4vr8FRhN7aQe AXc60AU5gBRKf3LMbz8KQTVcwY4TL3PwXU2whLdBj7oFw7EgCYBVyi8TVRGL2jXScaUnT izYIowB7U2IyX0ar409ky4+wnPLyq5w+U9AEl1/NvgGAJS6C09Ju2vm2gFBhdp1eC+o5C WiLdUKDMslm/1Xm3gHJeLCdH0uT1rCDdmqqYqCDdP8dSosROyoVgAe9WhiNU7pHF3tg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=janestreet.com; spf=pass smtp.mailfrom=janestreet.com; dkim=pass header.d=janestreet.com header.i=@janestreet.com header.a=rsa-sha256 header.s=waixah header.b=EdDimryh; arc=none smtp.remote-ip=64.215.233.18 Received: from mxout5.mail.janestreet.com (mxout5.mail.janestreet.com [64.215.233.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7A91606A320 for ; Mon, 30 Nov 2026 19:32:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7A91606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=janestreet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=janestreet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=janestreet.com header.i=@janestreet.com header.a=rsa-sha256 header.s=waixah header.b=EdDimryh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1796067158; bh=1fd/3udI3ZaSV+jAPZ2bWGr07l2UzlTHbH4KU0AfYrE=; h=From:To:Cc:Subject:Date; b=EdDimryhiqCxsBkqEyljpr020ZLktLxNBym1FlDOFISimSjR5G+hcUB7ThtxVgpek sllZh0nYS2Pj3YbXuQRRLHtZAe4sTE0tFl/OzL41mkt37UB0YR7xCTQAGkmS1zbTFN VLLZ3pOjKNyoxIQjxa3vVtrDCbFGCiJJD3otYkDteByl4hXC7He12xJoUNePx/3F0Q F0LwQfeBKfhT3Nkq0TVB/M3nQLQ6rFftlOc2CQtSH2VxkjLiOKwZT9M55PPAXVbnLd zCTLY5ijJQD9L7OFFmHu7d0IMMV+3dRvAKLJZH8pGB/gmx68qB2NHDp2wskw1uo7Rr qcr9bPEmnaXLg== From: Eric Hagberg To: linux-raid@vger.kernel.org, Song Liu , Yu Kuai Cc: Li Nan , Xiao Ni , stable@vger.kernel.org, regressions@lists.linux.dev Subject: [REGRESSION] md/raid10: far-layout member left with stale data after bitmap re-add (6.11+, 6.12.y, 6.18.y) Date: Mon, 30 Nov 2026 14:31:23 -0500 Message-ID: <20261130193139.1401044-1-ehagberg@janestreet.com> X-Mailer: git-send-email 2.43.7 X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, On 6.12.y and 6.18.y, re-adding a member to a RAID10 array with the far layout and an internal bitmap can complete "successfully" ([UU]) while the re-added member still holds stale data for regions written while it was absent. 6.1.y is not affected. This was seen on 2-disk far=2 arrays (NVMe, internal bitmap, 64 MiB bitmap chunk) after a member dropped out and came back; filesystems on the arrays were corrupted and "check" reported non-zero mismatch_cnt. #regzbot introduced: bc49694a9e8f Reproducer (loop devices, 2 x 16 GiB zero-filled sparse files): mdadm --create /dev/md/r10 --run --assume-clean --metadata=1.2 \ --level=10 --raid-devices=2 --layout=f2 --chunk=512 \ --bitmap=internal --bitmap-chunk=65536 /dev/loopA /dev/loopB mdadm /dev/md/r10 --fail /dev/loopB --remove /dev/loopB # write a 64 MiB random payload with O_DIRECT to every third # 64 MiB bitmap chunk (85 regions) mdadm /dev/md/r10 --re-add /dev/loopB # bitmap-based recovery mdadm --wait /dev/md/r10 # until [UU] echo check > /sys/block/mdX/md/sync_action; mdadm --wait /dev/md/r10 cat /sys/block/mdX/md/mismatch_cnt mdadm /dev/md/r10 --fail /dev/loopA --remove /dev/loopA # read the 85 regions back (now served only by loopB) and compare Results ("OK" = mismatch_cnt 0 and every region read back correctly from the re-added member): kernel far=2 near=2 6.1 OK OK 6.12 CORRUPTION OK 6.18 CORRUPTION OK We have not yet tested 7.x. A full script is available on request. Our analysis, which we would appreciate having checked: Commit bc49694a9e8f ("md: pass in max_sectors for pers->sync_request()"), merged in v6.11, removed the recomputation of max_sector at the 'skipped:' label in raid10_sync_request(). The giveup path still shrinks max_sector to sector_nr + max_sync, advances sector_nr to it and jumps back to the label, where "sector_nr >= max_sector" is now true. The function then takes the end-of-sync branch and calls the bitmap's close_sync(), which clears RESYNC on every bitmap chunk whose sync has started, as if it had completed. During a bitmap-based recovery, every region that is clean in the bitmap takes the giveup path. With the far layout, the data covered by one bitmap chunk is split between the first and second halves of the recovering member. Once a clean region is skipped, chunks whose first half has been recovered are treated as done, their second half is skipped, and the member is marked In_sync with stale data. Near layouts recover each bitmap chunk contiguously, which matches what we see. In mainline, 7435b73f05fb ("md/raid10: cleanup skip handling in raid10_sync_request"), in v7.0, removed the skip loop and carries "Fixes: bc49694a9e8f", but has no Cc: stable and is not in 6.12.y or 6.18.y. It is patch 11 of a 12-patch series and appears to depend on earlier patches in it (it stops checking rdev_set_badblocks() return values, which relies on "md: mark rdev Faulty when badblocks setting fails"). Questions: 1. Does this analysis look right to you? 2. What is the preferred fix for 6.12.y and 6.18.y: backporting 7435b73f05fb together with the patches it depends on, or a smaller targeted fix? As a starting point for discussion only (not a formal submission), the minimal change we tried restores the pre-6.11 recomputation by resetting max_sector to the caller's value at the label. With it, the reproducer passes for both layouts on 6.12 and 6.18. We have since had concerns raised about it internally and would value your view on whether it is safe: --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3191,6 +3191,7 @@ static sector_t raid10_sync_request(stru sector_t chunk_mask = conf->geo.chunk_mask; int page_idx = 0; int error_disk = -1; + sector_t orig_max_sector = max_sector; /* * Allow skipping a full rebuild for incremental assembly @@ -3212,6 +3213,7 @@ static sector_t raid10_sync_request(stru return 0; skipped: + max_sector = orig_max_sector; if (sector_nr >= max_sector) { conf->cluster_sync_low = 0; conf->cluster_sync_high = 0; Thanks, Eric Hagberg