From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=79.135.106.111 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796342804; b=aBmn///YJArWlxE009Q6yOJ9ovqnVXpVkA3Cr8ghTmn+wT+gmQ1kI+sSGSGA7ALxwgXO S8jktGk1joMMdKIrsgCTq/afXkZp46vGfE6/zqpnyFyN7F6z6U+cShKhNGCdX4v1VQsm/ xVwksJl5u7yeVSTRM4TpDDNm+N0ZGy2/Zdw52QhbZqlcMDXJvp2k8ffQRYTFn0LdiSI8+ wiV9A4USOcn9d9zM9/VAAOqTRysyDMQxYrBY3CiOtgsZJSkHn8UkTEvi9yj8AHHeI0wtE t0Sh3dxAjDgqprTg2BDqY5f0DdGwn+q1tEN5CRLt0dN6Mz3exwxx7tpt6VRB666H13A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796342804; h=DMARC-Filter:DKIM-Signature:X-Pm-Submission-Id:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=gm5PXgDMvRQrRU7s7vzwm5qYfoScSgWiA4bs7ua+/aA=; b=E8fw85xEN+w6PaXDQimwIKYi6Qn9Xc49KCObgmRfGxpism5bA64/5cU8Cu+h26WOqHAB nQkIzAtNNvHhMv1AXBfSfRC80wleh2brKw44KLhsj8jv4Ea0m7Wz7+8ztTTxHL04Nb+1+ nS3u1AOFjCGYXjOe6i92pyRj5cu05fGfIqALuyqqUqYAzGQ1PfEcR4PyQzV+n4L/nih8+ nr0yX4mLOEh6uzHWTu8Zdn18iMYabt8POpfamppLyYFs+CKBRK3wftExdcoX5EfRtpOPz 3aReCXOVCiy2zlHaxIw7AOHyKbHW+uo9W4lRtEY01UMjfR46H/n04uVFOO3zRu0w9bA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=raidlab.org; spf=pass smtp.mailfrom=raidlab.org; dkim=pass header.d=raidlab.org header.i=@raidlab.org header.a=rsa-sha256 header.s=protonmail header.b=pqTwhNxZ; arc=none smtp.remote-ip=79.135.106.111 Received: from mail-106111.protonmail.ch (mail-106111.protonmail.ch [79.135.106.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F224F606A32C for ; Fri, 4 Dec 2026 00:06:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F224F606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=raidlab.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raidlab.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=raidlab.org header.i=@raidlab.org header.a=rsa-sha256 header.s=protonmail header.b=pqTwhNxZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raidlab.org; s=protonmail; t=1796342800; x=1796602000; bh=gm5PXgDMvRQrRU7s7vzwm5qYfoScSgWiA4bs7ua+/aA=; h=From:To:Cc:Subject:Date:Message-ID:From:To:Cc:Date:Subject: Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=pqTwhNxZMvRUv67pCVmj2qFFwLncinEHhSwo6yJ4MtbqOgopVrZX11/EcGQsw32Pk /7UbYBKkydJytB8cLxTh7YZsAt/1BaFHvUAisKwlBpAEkznTc2OH0sX/FHMfPh9tO0 YTxFN6tBwWR8p931DNrBlGqbzFxwksBhmwIOQvsF0DJSR3lILVjP+rHIx8EJRIo6dt OqAsl9sLkoOAPxNBbIyFjMYfvd2LnotGCuRWt29MArNP12T3GoazNNzwu/QkMBPDqp 8wKjqdW9dSErzYYHAVYL6ufNZM97CCbXav5YslkqoEoklnzvai9dRH1WFaTd2xZxAt i4RAzMb4in+Ag== X-Pm-Submission-Id: 4jgWxl6ktKz2ScNb From: Miroslav Cimerman To: Song Liu , Yu Kuai Cc: Li Nan , Xiao Ni , Logan Gunthorpe , Jens Axboe , linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] md: don't update curr_resync_completed when curr_resync is ACTIVE Date: Fri, 4 Dec 2026 00:03:39 +0000 Message-ID: <20261204000339.1209921-1-mc@raidlab.org> X-Mailer: git-send-email 2.53.0 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 MD_RESYNC_ACTIVE (3) in curr_resync marks a sync that has started but has done nothing yet. If the sync is interrupted before the first ->sync_request() call, md_do_sync() takes this marker as a position and stores it in curr_resync_completed. md_update_sb() then saves 3 as recovery_offset of the new member, and the next recovery skips its sectors 0-2. Update curr_resync_completed only when curr_resync is above MD_RESYNC_ACTIVE. Found with FuzzyRAID, a fault injection tester for RAID. Fixes: eac58d08d493 ("md: Use enum for overloaded magic numbers used by mddev->curr_resync") Cc: stable@vger.kernel.org # 7.0+ Signed-off-by: Miroslav Cimerman --- 7.0+ because cc0dab317acb made the bug reachable by removing the MD_RECOVERY_INTR check. Arrays that already saved 3 as recovery_offset are not repaired by this patch. Tested on md-7.5 with RAID1 on null_blk members, the recovery interrupted by writing "frozen" to sync_action or by a member failure: stale sectors 0-2 (512 B blocks) or failing reads (4 KiB blocks) on stock, everything copied with the fix. drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index c71c3b043496..5c5d867c59ec 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -10060,7 +10060,7 @@ void md_do_sync(struct md_thread *thread) wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) && - mddev->curr_resync >= MD_RESYNC_ACTIVE) { + mddev->curr_resync > MD_RESYNC_ACTIVE) { /* All sync IO completes after recovery_active becomes 0 */ mddev->curr_resync_completed = mddev->curr_resync; sysfs_notify_dirent_safe(mddev->sysfs_completed); base-commit: c526b7cd32f75fea6021ffdab287b81cf38ddeb7 -- 2.53.0