From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Zhen Lei <thunder.leizhen@huawei.com>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: normalize the error handling branch in btrfs_init_sysfs()
Date: Tue, 22 Nov 2022 19:59:53 +0800 [thread overview]
Message-ID: <351a524a-3739-e9f3-3b20-0854e8b2a1af@gmx.com> (raw)
In-Reply-To: <20221122115002.1831-1-thunder.leizhen@huawei.com>
On 2022/11/22 19:50, Zhen Lei wrote:
> Although kset_unregister() can eventually remove all attribute files,
> explicitly rolling back with the matching function makes the code logic
> look clearer.
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/sysfs.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> v1 --> v2:
> 1. Add sysfs_unmerge_group() to unmerge group first.
> 2. Update subject and commit message, no resource leaks.
>
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 699b54b3acaae0b..74fef1f49c358cd 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -2321,8 +2321,11 @@ int __init btrfs_init_sysfs(void)
>
> #ifdef CONFIG_BTRFS_DEBUG
> ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_debug_feature_attr_group);
> - if (ret)
> - goto out2;
> + if (ret) {
> + sysfs_unmerge_group(&btrfs_kset->kobj,
> + &btrfs_static_feature_attr_group);
> + goto out_remove_group;
> + }
> #endif
>
> return 0;
next prev parent reply other threads:[~2022-11-22 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 11:50 Zhen Lei
2022-11-22 11:59 ` Qu Wenruo [this message]
2022-11-22 15:25 ` David Sterba
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=351a524a-3739-e9f3-3b20-0854e8b2a1af@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thunder.leizhen@huawei.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®