* [PATCH] btrfs: add a check for sysfs_create_group
@ 2018-12-26 3:46 Kangjie Lu
2018-12-26 5:19 ` Qu Wenruo
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26 3:46 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel
In case sysfs_create_group fails, let's check its return value and
issues an error message.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
fs/btrfs/sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 3717c864ba23..62529153a51a 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -889,6 +889,8 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
*/
sysfs_remove_group(fsid_kobj, &btrfs_feature_attr_group);
ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group);
+ if (ret)
+ pr_err("failed to create btrfs_feature_attr_group.\n");
}
static int btrfs_init_debugfs(void)
--
2.17.2 (Apple Git-113)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: add a check for sysfs_create_group
2018-12-26 3:46 [PATCH] btrfs: add a check for sysfs_create_group Kangjie Lu
@ 2018-12-26 5:19 ` Qu Wenruo
0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2018-12-26 5:19 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 989 bytes --]
On 2018/12/26 上午11:46, Kangjie Lu wrote:
> In case sysfs_create_group fails, let's check its return value and
> issues an error message.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> fs/btrfs/sysfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 3717c864ba23..62529153a51a 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -889,6 +889,8 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
> */
> sysfs_remove_group(fsid_kobj, &btrfs_feature_attr_group);
> ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group);
> + if (ret)
> + pr_err("failed to create btrfs_feature_attr_group.\n");
Btrfs have better error message infrastructures (e.g. distinguish
different filesystems).
Please use btrfs_error() or btrfs_warn() instead.
Despite that, I think the patch looks good.
Thanks,
Qu
> }
>
> static int btrfs_init_debugfs(void)
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-26 5:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 3:46 [PATCH] btrfs: add a check for sysfs_create_group Kangjie Lu
2018-12-26 5:19 ` Qu Wenruo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).