From mboxrd@z Thu Jan 1 00:00:00 1970 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 2779D284662; Sun, 1 Mar 2026 01:25:25 +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=1772328325; cv=none; b=Ny7Bqmmmas5VUVa1JFEWvb3V7lZGDVVjlj+L2LJ+Tpkgfa8FgDJql6qSR2+k4kuHcoPoFrHc125JXP4mRBfDJYRApgrGUkZV0UbojCRYAcYA2P5xv/r4l3lZ323bP/78o5Cbh+jopdkQ9zFMNTJynVHmDffHUGuZBpSDMgOpaFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772328325; c=relaxed/simple; bh=cKlqKVWnKrwrQ6/zq5Uok2x+zuWHrlzQHjlMXZsL2SU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dXlaTmR5/oCUE3su/oQlNriSyaNR7HfM5GkZ8PDaWm7QMsskrUyeIzobMaojQc6bBUu+0FjQtOU2Dy9Dnfbeo13P0DPz7HWuZhAT3pvTXt1B6h7JQlKo9ncUjp96uj6vLYzcSrYXkfcNrxVJslk7Cz+3ZDrbeNolVPINZxqLDmk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iWFkxF+I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iWFkxF+I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73075C19421; Sun, 1 Mar 2026 01:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772328325; bh=cKlqKVWnKrwrQ6/zq5Uok2x+zuWHrlzQHjlMXZsL2SU=; h=From:To:Cc:Subject:Date:From; b=iWFkxF+IeAVT5qGlRhTKqn0dTk4bSTJwnXtGRxFayCh9uKRW07PyLVcFWE9GJ7s94 AeX9Exp0k23MmgV5wNiGl0BbiEj7ElcPMV4GII5HmWpcQENu2hv8cASKLL4Rc9fvOO rn+BOInQq2006gRQkfCHOvaxcGZQzNKKYFlr7TV/3NaUXV9xmJbrzRZRuzB7JdHMtm tE18ubF4OXrNDdBTEQcPH0WEVBYmXRQla1rkU1wEF0JUwNoMxoYOvFb0okMoEEPafx 6me55+TXLUwkULnEiEWF3RCXFsgmoo01mdUlm8FchGZEnJgdeGQfwIApEVsrv89I52 yn6trYZV4ZNhQ== From: Sasha Levin To: stable@vger.kernel.org, naohiro.aota@wdc.com Cc: Johannes Thumshirn , David Sterba , linux-btrfs@vger.kernel.org Subject: FAILED: Patch "btrfs: zoned: fixup last alloc pointer after extent removal for RAID1" failed to apply to 6.12-stable tree Date: Sat, 28 Feb 2026 20:25:22 -0500 Message-ID: <20260301012523.1682472-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.12-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ >From dda3ec9ee6b3e120603bff1b798f25b51e54ac5d Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Wed, 17 Dec 2025 20:14:04 +0900 Subject: [PATCH] btrfs: zoned: fixup last alloc pointer after extent removal for RAID1 When a block group is composed of a sequential write zone and a conventional zone, we recover the (pseudo) write pointer of the conventional zone using the end of the last allocated position. However, if the last extent in a block group is removed, the last extent position will be smaller than the other real write pointer position. Then, that will cause an error due to mismatch of the write pointers. We can fixup this case by moving the alloc_offset to the corresponding write pointer position. Fixes: 568220fa9657 ("btrfs: zoned: support RAID0/1/10 on top of raid stripe tree") CC: stable@vger.kernel.org # 6.12+ Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- fs/btrfs/zoned.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index d6a2480d5dc17..714f45045c84f 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1491,6 +1491,21 @@ static int btrfs_load_block_group_raid1(struct btrfs_block_group *bg, /* In case a device is missing we have a cap of 0, so don't use it. */ bg->zone_capacity = min_not_zero(zone_info[0].capacity, zone_info[1].capacity); + /* + * When the last extent is removed, last_alloc can be smaller than the other write + * pointer. In that case, last_alloc should be moved to the corresponding write + * pointer position. + */ + for (i = 0; i < map->num_stripes; i++) { + if (zone_info[i].alloc_offset == WP_MISSING_DEV || + zone_info[i].alloc_offset == WP_CONVENTIONAL) + continue; + if (last_alloc <= zone_info[i].alloc_offset) { + last_alloc = zone_info[i].alloc_offset; + break; + } + } + for (i = 0; i < map->num_stripes; i++) { if (zone_info[i].alloc_offset == WP_MISSING_DEV) continue; -- 2.51.0