mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miroslav Cimerman <mc@raidlab.org>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>, Chris Mason <mason@kernel.org>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Qu Wenruo <wqu@suse.com>, Damien Le Moal <dlemoal@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] btrfs: zoned: handle a failed zone finish on one device
Date: Sun, 22 Nov 2026 23:23:07 +0000	[thread overview]
Message-ID: <20261122232310.4099580-1-mc@raidlab.org> (raw)

When ZONE_FINISH fails on one device, btrfs can lose a completed write
or turn read-only, even if the profile tolerates the failed device.

1/3: since 7.3, a failed zone finish fails the ordered extent whose
completion started it. The data is written, but the file keeps the old
data in the range of that extent.

2/3: since 6.18, one failed device of a RAID1 metadata block group turns
the filesystem read-only. The patch tolerates the failure when the zones
are full. A partly written block group still stops at the first error.
Finishing its other zones could make the next mount fail.

3/3: relocation hits a WARN_ON() when a device fails ZONE_FINISH.

Tested in QEMU with KASAN on for-next 65101fe10b30, with two zoned
null_blk devices (1 GiB, 16 MiB zones, zone capacity 12 or 16 MiB). A
test-only module parameter fails the next ZONE_FINISH on one device.
Each RAID1 case ran with a failure on each device:

                            for-next             with the series

  RAID1 or single data, an  last 1 MiB reads     all new data
  O_DIRECT overwrite fills  old data, first
  the block group           read gets EIO

  RAID1 metadata fills      forced read-only     stays writable,
  a block group                                  remount works

  relocation, RAID1 or      WARN_ON()            two warning
  single data                                    messages

The relocated block groups are partly written, so 2/3 does not tolerate
the failure there.

The btrfs self-tests pass. Degraded-mount tests and parallel writers
show the same failures as on for-next. These are the bugs fixed by my
pending series [1], [2] and [3]. fstests was not run.

Found with FuzzyRAID, a fault-injection tester for RAID that is not
public at the moment. It ran the series on an older for-next with my
other pending zoned fixes. Its runs showed no lost write and nothing
new. 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/20261121134550.216217-1-mc@raidlab.org/
[2] https://lore.kernel.org/linux-btrfs/20261121205657.1108500-1-mc@raidlab.org/
[3] https://lore.kernel.org/linux-btrfs/20261122034826.2333981-1-mc@raidlab.org/

Miroslav Cimerman (3):
  btrfs: zoned: do not fail an ordered extent on a zone finish error
  btrfs: zoned: tolerate a failed zone finish on a full block group
  btrfs: zoned: do not WARN when zones fail to finish before relocation

 fs/btrfs/relocation.c |  5 +++-
 fs/btrfs/zoned.c      | 59 +++++++++++++++++++++++++++++++++++++------
 2 files changed, 55 insertions(+), 9 deletions(-)


base-commit: 65101fe10b3008186b813b628ee3a611b0e70ce6
-- 
2.53.0


             reply	other threads:[~2026-11-22 23:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 23:23 Miroslav Cimerman [this message]
2026-11-22 23:23 ` [PATCH 1/3] btrfs: zoned: do not fail an ordered extent on a zone finish error Miroslav Cimerman
2026-11-22 23:23 ` [PATCH 2/3] btrfs: zoned: tolerate a failed zone finish on a full block group Miroslav Cimerman
2026-11-22 23:23 ` [PATCH 3/3] btrfs: zoned: do not WARN when zones fail to finish before relocation Miroslav Cimerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122232310.4099580-1-mc@raidlab.org \
    --to=mc@raidlab.org \
    --cc=dlemoal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®