linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 3/4] btrfs: sysfs, use btrfs_sysfs_remove_fsid in fail return in add_fsid
Date: Wed, 12 Feb 2020 17:28:12 +0800	[thread overview]
Message-ID: <1581499693-22407-4-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1581499693-22407-1-git-send-email-anand.jain@oracle.com>

We have one simple function btrfs_sysfs_remove_fsid() to undo
btrfs_sysfs_add_fsid(). Which is also smart enough to check if the kobject
is initialized.

So lets use this function while retreating from the function
btrfs_sysfs_add_fsid().

One difference if btrfs_sysfs_remove_fsid() used is that, now we also call
kobject_del() which was missing before. So tested (with kobject debug
turned on) and find that there isn't any change with or without
kobject_del().

This is a cleanup patch.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: change log updated.

 fs/btrfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 3c10e78924d0..119edd4341d6 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1371,7 +1371,7 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs)
 	if (!fs_devs->devices_kobj) {
 		btrfs_err(fs_devs->fs_info,
 			  "failed to init sysfs device interface");
-		kobject_put(&fs_devs->fsid_kobj);
+		btrfs_sysfs_remove_fsid(fs_devs);
 		return -ENOMEM;
 	}
 
-- 
1.8.3.1


  parent reply	other threads:[~2020-02-12  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12  9:28 [PATCH 0/4] btrfs: sysfs, add devinfo, fix devid and cleanups Anand Jain
2020-02-12  9:28 ` [PATCH v2 1/4] btrfs: sysfs, add UUID/devinfo kobject Anand Jain
2020-02-12  9:28 ` [PATCH 2/4] btrfs: sysfs, move dev_state kobject under UUID/devinfo Anand Jain
2020-02-12  9:28 ` Anand Jain [this message]
2020-02-12  9:28 ` [PATCH v3 4/4] btrfs: sysfs, rename device_link add,remove functions Anand Jain
2020-02-12 17:35 ` [PATCH 0/4] btrfs: sysfs, add devinfo, fix devid and cleanups David Sterba
2020-02-13  8:40   ` [PATCH] btrfs: fix devid attribute name Anand Jain
2020-02-13 13:12     ` 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=1581499693-22407-4-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).