From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=109.224.244.108 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795996542; b=dxEV5JUCHcddAdrLQ3GnYRZJ4P/B65Px+vWdW9rGcKRHiXpHE4BUdoPJ5GR/94kHO7M3 LNxj0a6zacNVI2mfYfQNuCXlZ1P13J9xj0IWKeaGgSJ7j1EcQOVyMArsNnsQKuPITLBO1 S4XbKx333psgn+AspQdiPKfZ1sBTUBWXCq88VKZXRN88F08xfAQmfB3ciA0mA1La913ZA phj1KXC2M7TEJOh9BWrheePxfXOhMpkgpdffqE4VOmAtQ3YoJHJQ3qO1skMDxWLqTzQVF j4mu97G/ZM9RovOWhFlEYblkiCZ4En3IcXBQQj508UtxCAvLtG9w7wlS8TTQC5up2Tg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795996542; h=DMARC-Filter:DKIM-Signature:X-Pm-Submission-Id:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=c6zSo/MwNOud2xQyLlTVWsuMeFMvBhpU7ObofKNniJk=; b=n++WNiJD6aX++smVUUAVnLN30maQj2RWEw7PQ52AHFQVnVajwvskEf9z90bKgRfPboq/ gULKxSXa9QNv25kRylwrfSSogFJmyE0PSk0lgFadqd76HOzekvC1Jgv4hFXFeyz2MvJ0+ wkLMWWYo3y+GSkw4k9gOEpq1HJfl3PBqLHKaTfnhQSBFYzBJyAq5tbb5bNKY3Tys1KxTT Vp/AYtQyqcmTKYOgnkc/HWY6M9UH3dsOl9VG9hwGSjhMAl6inVmlEOmDVQAGNYrcdP8KJ 8GB/I6oE41LQb2MDsK8p+YziVVIHZQUbXY6Os5bpsT2vmDLcHzvyXMUqEPT7mi0606A== 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=Cqppe5pu; arc=none smtp.remote-ip=109.224.244.108 Received: from mail-244108.protonmail.ch (mail-244108.protonmail.ch [109.224.244.108]) (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 62C92606A327 for ; Sun, 29 Nov 2026 23:55:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 62C92606A327 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=Cqppe5pu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raidlab.org; s=protonmail; t=1795996539; x=1796255739; bh=c6zSo/MwNOud2xQyLlTVWsuMeFMvBhpU7ObofKNniJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Cqppe5pueZTdOBqQRVg7uN83qrYVY50MpS5aoHioKwQwLgOl+G+rqZ3SZzs99RoYh HAH1PUxqQ51CZvYEXd8up/zE/AEEowHH2nTA0pAt7bSS1LabJM6tUWKvwU8UGYf/Tl Y8cUFzNfIqRlvEJnuaxZv276XXkVzJX2KILraht5FOZmo2NIFGsg8U+bYYO78mXhyP AhUIaITmUkSRXPjjMuLZolM0jqoInfzFrloZr4mIxQlRPm9QPxrL7OJtJR7WmsTAlE VxtAK3p3te6Z/BVxloxtkvTV8l6LtupajOQSX2Cb8pMAOmU9R3OVssDAwCPF3NnK+B EFDfh7AgZYPYw== X-Pm-Submission-Id: 4jd3tx6nYpz2ScWV From: Miroslav Cimerman To: linux-btrfs@vger.kernel.org Cc: David Sterba , Chris Mason , Naohiro Aota , Johannes Thumshirn , Qu Wenruo , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] btrfs: zoned: use zone append for every copy of a mirrored write Date: Sun, 29 Nov 2026 23:52:24 +0000 Message-ID: <20261129235226.459661-2-mc@raidlab.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261129235226.459661-1-mc@raidlab.org> References: <20261129235226.459661-1-mc@raidlab.org> X-Mailing-List: linux-btrfs@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 Since commit b39b26e017c7 ("btrfs: zoned: don't zone append to conventional zone"), btrfs_submit_dev_bio() uses zone append only if can_use_append is set in the btrfs_bio. For a mirrored write, btrfs_submit_mirrored_bio() sends the original bio to the last stripe and a clone to every other stripe. The clone is set up with btrfs_bio_init(), which clears can_use_append. So on a zoned filesystem, every copy of a mirrored data write but the last is a regular write at the allocated address. A regular write to a sequential zone has to arrive at the zone's write pointer. Writes to one zone can arrive in a different order than they were allocated, for example from two writers. The copy that arrives too early then fails: extent A at offset 0, extent B at offset 64K of one zone last stripe (zone append): B, then A: both written stripe 0 (regular write): B fails, the write pointer is still at 0 A RAID1 write succeeds with one failed copy. A buffered write then completes with one copy less. Only the device's write error counter and its "errs: wr" log line show it. The failed write also leaves the write pointer of that zone behind, so every later regular write to the zone fails too. Copy can_use_append to the clone, as commit c757edbef980 ("btrfs: fix copying the flags of btrfs_bio after split") does for split bios. Fixes: b39b26e017c7 ("btrfs: zoned: don't zone append to conventional zone") CC: stable@vger.kernel.org # 6.18+ Reviewed-by: Johannes Thumshirn Signed-off-by: Miroslav Cimerman --- fs/btrfs/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index b90ca97c9c4d..2573f980de99 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -521,6 +521,7 @@ static void btrfs_submit_mirrored_bio(struct btrfs_io_context *bioc, int dev_nr) bio_inc_remaining(orig_bio); btrfs_bio_init(btrfs_bio(bio), orig_bbio->inode, orig_bbio->file_offset, NULL, NULL); + btrfs_bio(bio)->can_use_append = orig_bbio->can_use_append; bio->bi_end_io = btrfs_clone_write_end_io; } -- 2.53.0