Linux-BTRFS Archive on lore.kernel.org
 help / Atom feed
* [PATCH v2] btrfs: add a check for sysfs_create_group
@ 2018-12-26  5:37 Kangjie Lu
  2018-12-26  5:48 ` Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kangjie Lu @ 2018-12-26  5:37 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..24ef416e700b 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)
+		btrfs_err(fs_info, "failed to create btrfs_feature_attr_group.\n");
 }
 
 static int btrfs_init_debugfs(void)
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] btrfs: add a check for sysfs_create_group
  2018-12-26  5:37 [PATCH v2] btrfs: add a check for sysfs_create_group Kangjie Lu
@ 2018-12-26  5:48 ` Qu Wenruo
  2018-12-26  5:51 ` Su Yue
  2019-01-08 15:50 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2018-12-26  5:48 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: 955 bytes --]



On 2018/12/26 下午1:37, 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..24ef416e700b 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)
> +		btrfs_err(fs_info, "failed to create btrfs_feature_attr_group.\n");

Forgot to mention, for btrfs_* infrastructure, no need for the ending '\n'.

Despite that, looks good.

Reviewed-by: Qu Wenruo <wqu@suse.com>

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] 4+ messages in thread

* Re: [PATCH v2] btrfs: add a check for sysfs_create_group
  2018-12-26  5:37 [PATCH v2] btrfs: add a check for sysfs_create_group Kangjie Lu
  2018-12-26  5:48 ` Qu Wenruo
@ 2018-12-26  5:51 ` Su Yue
  2019-01-08 15:50 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Su Yue @ 2018-12-26  5:51 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	linux-kernel



On 12/26/18 1:37 PM, 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..24ef416e700b 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)
> +		btrfs_err(fs_info, "failed to create btrfs_feature_attr_group.\n");

NIT: ".\n" is unnecessary.

---
Su
>   }
>   
>   static int btrfs_init_debugfs(void)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] btrfs: add a check for sysfs_create_group
  2018-12-26  5:37 [PATCH v2] btrfs: add a check for sysfs_create_group Kangjie Lu
  2018-12-26  5:48 ` Qu Wenruo
  2018-12-26  5:51 ` Su Yue
@ 2019-01-08 15:50 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2019-01-08 15:50 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	linux-kernel

On Tue, Dec 25, 2018 at 11:37:44PM -0600, Kangjie Lu wrote:
> In case sysfs_create_group fails, let's check its return value and
> issues an error message.

It's in a function that's not currently used and the sysfs code needs to
be reworked. The return code should be passed to the caller, printing
error message in this case may not be desired but I can't say right now.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26  5:37 [PATCH v2] btrfs: add a check for sysfs_create_group Kangjie Lu
2018-12-26  5:48 ` Qu Wenruo
2018-12-26  5:51 ` Su Yue
2019-01-08 15:50 ` David Sterba

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox