From: Guanghui Yang <3497809730@qq.com>
To: linux-btrfs@vger.kernel.org
Cc: clm@fb.com, dsterba@suse.com, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Guanghui Yang <3497809730@qq.com>
Subject: [PATCH v3 0/3] btrfs: fix failed sprout device add rollback
Date: Mon, 10 Aug 2026 20:16:03 +0800 [thread overview]
Message-ID: <tencent_AD274BC8BB1B11444FCC2955080F81A2BE06@qq.com> (raw)
In-Reply-To: <cover.1786358930.git.3497809730@qq.com>
Hi,
This series fixes the error path for adding the first writable device to a
seed filesystem.
I verified the failure path locally in QEMU with null_blk and a seed btrfs
filesystem:
- create btrfs on /dev/nullb0
- set the seed flag with btrfstune -S 1
- mount the filesystem read-only
- run "btrfs device add -f /dev/nullb1 /mnt"
- inject -EIO after metadata chunk creation in init_first_rw_device()
Before these fixes, the injected failure triggered:
- WARN_ON(!list_empty(&device->post_commit_list)) in btrfs_free_device()
- a NULL pointer dereference through btrfs_show_devname()
- the sprout fs_devices state left with no open devices
Without the injected failure, the same device-add path succeeds.
AI disclosure: AI assistance was used during code analysis, patch
development, and drafting parts of the commit messages and cover letter.
I reviewed the final code and local validation results and take
responsibility for this submission.
Changes in v3:
- Add AI assistance disclosure to the cover letter.
- No code changes.
Guanghui Yang (3):
btrfs: detach failed sprout device from transaction update list
btrfs: restore active device pointers after failed sprout
btrfs: roll back sprout setup after device add failure
fs/btrfs/volumes.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
base-commit: 38fec10eb60d687e30c8c6b5420d86e8149f7557
--
2.53.0
next prev parent reply other threads:[~2026-08-10 12:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1786358930.git.3497809730@qq.com>
2026-08-10 10:59 ` [PATCH v2 1/3] btrfs: detach failed sprout device from transaction update list Guanghui Yang
2026-08-10 10:59 ` [PATCH v2 2/3] btrfs: restore active device pointers after failed sprout Guanghui Yang
2026-08-10 10:59 ` [PATCH v2 3/3] btrfs: roll back sprout setup after device add failure Guanghui Yang
2026-08-10 12:16 ` Guanghui Yang [this message]
2026-08-10 23:16 ` [PATCH v3 0/3] btrfs: fix failed sprout device add rollback Qu Wenruo
2026-08-10 23:36 ` Qu Wenruo
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=tencent_AD274BC8BB1B11444FCC2955080F81A2BE06@qq.com \
--to=3497809730@qq.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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