From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=79.135.106.113 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795996542; b=IVQHv0ArB04qMi7tT0CYKA1fKtn8gOoTrhF0ctD+FDPoTKNyh2QjMLDj1Duvjrxj+mC9 xU7ZQhidCzogO3g7vgp1vtv0tsirMksiApW5PNOdnFgLVM7m26VvoadIi1RlZnceDLT1A JaAHkr13uzDj055b5ToO3cNlG47ukHuT6TNh3jUnUquGj+8PJkfTUMMkXSgBEs/r8fWvz 387D4I4H3OTSfq4geGjQVLH9Vf55X2ff/KRq6RQGpsafkxtqmAU6yEXMNogMqPd0Dyt8P VxRU2b5T62GLUOMshCA0Ed4bnD1PMwpbjimX2Gen0pfF2v2bTtQjETGzvvXI7o9E6+A== 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:MIME-Version:Content-Transfer-Encoding; bh=ALKu72hGpwsIvVy1jiErLmS1E0BoEy1DyZREUV2NNIE=; b=WFhQNSt25+Jmy0p830Jb4cAbT5Z7jIIgRwKVVoXVBjMJs2AIQVMe+4OVaIuPUNhXYxOJ ZD0HJRj8A9JAoFuS98ex+NYwqbI1e9uChHNPtJ1yzqNLZL7ws3Atzhy3afGeYsKcFDHBY tIOxCtC+DDs7Nr0Vh0RY9aMb7Oyx+cYlUIk7yMtcQCsd1l5okg96NydO+1D0HhNMukIEh c11Aj3TAtJ1VCbrJ3DSNPYNQAtyHqUTLjrC5wCZg3I9vh2JopWZGBYwk4NFJ2U93CcIsm z5TFM1L2mVar2byLt7ZYdUCDfs5yP1H2TVNUcMgI8NgzARcKXi6nf3xHnYxoMG5L3DA== 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=qQscRCCl; arc=none smtp.remote-ip=79.135.106.113 Received: from mail-106113.protonmail.ch (mail-106113.protonmail.ch [79.135.106.113]) (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 79594606A31C for ; Sun, 29 Nov 2026 23:55:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 79594606A31C 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=qQscRCCl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raidlab.org; s=protonmail; t=1795996538; x=1796255738; bh=ALKu72hGpwsIvVy1jiErLmS1E0BoEy1DyZREUV2NNIE=; h=From:To:Cc:Subject:Date:Message-ID:From:To:Cc:Date:Subject: Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=qQscRCClrx4xmWUKrgOwVR1TH9ynvt127oTSyZ+m0uqs9kW+ouev0XqqfSrN1E3az rRXphD3FldmK6ZMtToatvMGBhAaRCUxmqWDcz7IVSgfF7BpmOLe2ZrNI7hXwHzIbBs ZcPEVecMZJopvZ2Cd54lnKeR6+akCtU0iReTjyjEGO2sW91MOuq6FQSkCKnMp6Bh0O bQSrzFU0cGfAnfhoMNGT4IoMmQiKl/OP/ofLCo1RfO8Av84n5EPDXsgs2HM42gEeRj 0SrMDRDXXttXyJnuVdxjZvwK9gfd39Q0ODJil8JhS82UFl1waU4UZRsZPHteLTZzfE zpf7BJygBgMYQ== X-Pm-Submission-Id: 4jd3tv5Kbyz2ScP5 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 0/3] btrfs: zoned: unwritten copies of mirrored data writes Date: Sun, 29 Nov 2026 23:52:23 +0000 Message-ID: <20261129235226.459661-1-mc@raidlab.org> X-Mailer: git-send-email 2.53.0 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 On a zoned filesystem, a mirrored data write can lose a copy, or fail, without any problem on the devices. The bugs fixed by 1/3 and 3/3 need writes to one zone to arrive out of allocation order, which parallel writers do. 1/3: since 7.0, every copy but the last is a regular write. A regular write that arrives before an earlier one fails. 2/3: since 5.19, unmount does not wait for the work that finishes the zones of a full metadata block group. 3/3 uses that work for data too. 3/3: since 6.7, with the raid stripe tree, the zones of a block group are finished when the extent at its end completes. Zone append writes of other extents that are still queued then fail. Changes in v2: - 1/3: Reviewed-by from Johannes. Stable tag 6.18+: the fixed commit is in 6.18.y too. Rebased on for-next. - 2/3: new. - 3/3: no new field in btrfs_block_group (Johannes). zone_finish_work finishes the zones once every extent that zone append writes to the block group is written or freed. Rebased on for-next. Tested on for-next 1adb6f14ca90 as in v1 [1], with 8 active zones per device. With 1/3 alone, zone append writes failed in 10 of 10 runs with 8 direct writers. With the series, 31 runs showed no failed write. A test-only print showed the work waiting for other writes before 82 of 160 zone finishes. With a test-only delay in the work, an unmount right after the writes hit an assertion in 9 of 9 runs without 2/3 and in none of 6 runs with it. Found by an LLM while testing a fix on zoned RAID1. The analysis, the fixes and the tests were done with the help of an LLM. I reviewed everything. [1] https://lore.kernel.org/linux-btrfs/20261122034826.2333981-1-mc@raidlab.org/ Miroslav Cimerman (3): btrfs: zoned: use zone append for every copy of a mirrored write btrfs: zoned: wait for zone finish works at unmount btrfs: zoned: finish raid stripe tree zones once all data is written fs/btrfs/bio.c | 1 + fs/btrfs/block-group.c | 16 ++++++++-- fs/btrfs/disk-io.c | 7 +++++ fs/btrfs/inode.c | 3 ++ fs/btrfs/zoned.c | 71 ++++++++++++++++++++++++++++++++++++++++-- fs/btrfs/zoned.h | 3 ++ 6 files changed, 96 insertions(+), 5 deletions(-) base-commit: 1adb6f14ca90851ae4a8279ee90442589c312ba3 -- 2.53.0