From: Qu Wenruo <wqu@suse.com>
To: Guanghui Yang <3497809730@qq.com>, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: clean up target device if block group marking fails
Date: Sun, 9 Aug 2026 08:53:17 +0930 [thread overview]
Message-ID: <6ca0f838-70c1-4c18-bb1d-3e52b59eddb4@suse.com> (raw)
In-Reply-To: <tencent_853134544C3CE88A219EEB21346E2510D308@qq.com>
在 2026/8/8 16:08, Guanghui Yang 写道:
> btrfs_dev_replace_start() adds the replacement target to the device
> list before marking block groups to copy. If marking fails, returning
> directly leaves the target linked and keeps the device accounting
> incremented.
>
> Jump to the existing cleanup path so the target device is removed and
> released on failure.
>
> The issue was found by a failure-path metadata residual analyzer and
> verified with targeted failure injection on v6.14.
>
> Assisted-by: Codex:gpt-5
> Signed-off-by: Guanghui Yang <3497809730@qq.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Pushed into for-next branch.
> ---
> fs/btrfs/dev-replace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 318ddb790..bf0b78790 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -626,7 +626,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
>
> ret = mark_block_group_to_copy(fs_info, src_device);
> if (ret)
> - return ret;
> + goto leave;
>
> down_write(&dev_replace->rwsem);
> dev_replace->replace_task = current;
prev parent reply other threads:[~2026-08-08 23:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 6:38 [PATCH] btrfs: clean up target device if block group marking fails Guanghui Yang
2026-08-08 23:23 ` Qu Wenruo [this message]
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=6ca0f838-70c1-4c18-bb1d-3e52b59eddb4@suse.com \
--to=wqu@suse.com \
--cc=3497809730@qq.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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