From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796410819; b=RyYJWs/p8dPXQUFZa6mw7Il0qGXKk6Ec2tR4dBfYC0rHaZ6EKtS2sEMA5HuLc55Vq6jQ gtCJZWhNyA0LTwqaMMMU4M3ywbp8jQw6c9vZKA+sTgydDhKDORInjrtYIogZ2G1mcCYNb BjQa9KnE0WsDEQjEupNlGPoFcdn/imLaDXeu0X0Ax93DG2FU1wFKl+UHEpxP9urZa3RuS CSd+wOjVy55mMgZUBbDurePgQtBi5AJU7p4IBOA1h3h4tQVuteQxaBGQFRNbczl6g2F0P kIIFzTonOeNVXV9tN3rjPahUENRVj4/QtFV/crkJSIE3Q0i8C9mcR2mMPbb0bZgkM1A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796410819; 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=u2xMnTVZfkCDKY0fhs4m4c/HMcpxDMUJT9us4U64uew=; b=Ww79eatgTALdXIsHmqlLNLx6tGS5klAc3eQAgrka/aLgXCl3osR7M3xaixXblSFvxVlz x295qp1mRD8AUs+bF5P/db056bX9ALozyciZ3zefCCdqNJXywSl3ry3LaHUPvwQ24XyIh j6m417AV1Ie1uHCTmlhxjLRLw0WRKRr3Qzf5JxN7Nu6jocdsQvvrkGMyRQHbYHXYaFCmf 4fn+6eftUC+bhBnaatpT/7rQQxfSXsIICJBvGfizU1L0ctGpLJbhioSLsyIPeqO71fLxq Civ/iDUkNXKeKEa/KoGt3LufLjVgIkyqpR7/H9BG3Ui78crWhbi/thfEtoZGxC6rWaw== 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="N7Yn/cpd"; arc=none smtp.remote-ip=185.70.43.170 Received: from mail-43170.protonmail.ch (mail-43170.protonmail.ch [185.70.43.170]) (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 02F97606A32C for ; Fri, 4 Dec 2026 19:00:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 02F97606A32C 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=N7Yn/cpd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raidlab.org; s=protonmail; t=1796410812; x=1796670012; bh=u2xMnTVZfkCDKY0fhs4m4c/HMcpxDMUJT9us4U64uew=; 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=N7Yn/cpdtk+LrAvUn20C3hIVFO7v/o0K49LN+50HZYzDumqU/sPh8e5VD2GrEJggX 40rr67s0PYnIvLs5SIQCpccxCYg7qElIRIvqeXKHDMSZsTomksvLtJzE7/guk3RFAa U0yT8OINklC6CC6UsiAcdJ/gedq8qg1tYzbjEwCUVvz3MIKt2RRA7zBoxRYBuglpYl ilzrHrYHLUxlshpqryvisfi83YT4SnFATlariQKDRys/JoE0cSzNByRnsgMG9qQqud 51yoPOdoN8KYvP8J/Q5dsn2ysfpDIcYzZjbe88hKXXLjVj207QNhoueWwYn8nrv4jD kOa2euBrOObxA== X-Pm-Submission-Id: 4jh15h69d1z2ScmL From: Miroslav Cimerman To: linux-btrfs@vger.kernel.org Cc: David Sterba , Chris Mason , Johannes Thumshirn , Naohiro Aota Subject: [PATCH v3 1/3] btrfs: zoned: use zone append for every copy of a mirrored write Date: Fri, 4 Dec 2026 18:59:55 +0000 Message-ID: <20261204185957.313982-2-mc@raidlab.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261204185957.313982-1-mc@raidlab.org> References: <20261204185957.313982-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 afff5811c8fc..66b24173c72c 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -520,6 +520,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