Re: [PATCH v3 0/3] btrfs: fix failed sprout device add rollback
From: Qu Wenruo
Date: Mon Aug 10 2026 - 19:16:42 EST
在 2026/8/10 21:46, Guanghui Yang 写道:
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.
I mean the assisted-by tag for each patch.
I'll add them when merging using your last disclosed one.
Especially you seem to intentionally leave a blank line for "Assisted-by" tag but filled nothing.
Hope you are not pretending to find all those bugs by yourself, not only for btrfs but also for all other subsystems you're going to submit patches.
And tell your agent to add the "assisted-by" tag or read the "Documentation/process/coding-assistants.rst" file.
Otherwise the patches look good to me, and will be pushed to for-next.
Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
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