From nobody Thu Apr 2 23:55:40 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BC662556E; Sat, 14 Feb 2026 06:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771049419; cv=none; b=d4P8dUOyeWy/H/ZIMZKmcix+tSGphjfTVfNhWkuDmOunXunM3JcjTuaJS0FaAFINd3YyTR3q5+ygp66rO+GQLNT2y4WCOXiVpQZocXrJ5dlxjg/Eu6daVS/hlE59F9bxznqZg0qzW9kAq/FUjvXjd+atg8wGSdW95mFYc+Rmsns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771049419; c=relaxed/simple; bh=7Tm19XjqDZryvGVvRo6y2vQQHtmWELjPcCgnqGUNitc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Txhrj/4gWGQnVLOgQc81AmX/LSkXulK0OnHU7NDkpK28bxMJxwVlhXf4ly1kzuWoRPCe0WYX587tRsY9T8a1L6iO2kV8XzQuu+8OIV1wQXRRaBODxbjkoflaUDqFqVs172HJY5Vh+MktIG09h++lzwCoNJgsYNnrGJPvaoloMs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6E36C19423; Sat, 14 Feb 2026 06:10:17 +0000 (UTC) From: Yu Kuai To: song@kernel.org Cc: linan122@huawei.com, xni@redhat.com, colyli@fnnas.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] md/md-llbitmap: skip reading rdevs that are not in_sync Date: Sat, 14 Feb 2026 14:10:09 +0800 Message-ID: <20260214061013.2335604-2-yukuai@fnnas.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260214061013.2335604-1-yukuai@fnnas.com> References: <20260214061013.2335604-1-yukuai@fnnas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When reading bitmap pages from member disks, the code iterates through all rdevs and attempts to read from the first available one. However, it only checks for raid_disk assignment and Faulty flag, missing the In_sync flag check. This can cause bitmap data to be read from spare disks that are still being rebuilt and don't have valid bitmap information yet. Reading stale or uninitialized bitmap data from such disks can lead to incorrect dirty bit tracking, potentially causing data corruption during recovery or normal operation. Add the In_sync flag check to ensure bitmap pages are only read from fully synchronized member disks that have valid bitmap data. Cc: stable@vger.kernel.org Fixes: 5ab829f1971d ("md/md-llbitmap: introduce new lockless bitmap") Signed-off-by: Yu Kuai --- drivers/md/md-llbitmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/md-llbitmap.c b/drivers/md/md-llbitmap.c index cd713a7dc270..30d7e36b22c4 100644 --- a/drivers/md/md-llbitmap.c +++ b/drivers/md/md-llbitmap.c @@ -459,7 +459,8 @@ static struct page *llbitmap_read_page(struct llbitmap = *llbitmap, int idx) rdev_for_each(rdev, mddev) { sector_t sector; =20 - if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags)) + if (rdev->raid_disk < 0 || test_bit(Faulty, &rdev->flags) || + !test_bit(In_sync, &rdev->flags)) continue; =20 sector =3D mddev->bitmap_info.offset + --=20 2.51.0