All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Josef Bacik <josef@toxicpanda.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs: initialize sysfs devid and device link for seed device
Date: Sun, 23 Aug 2020 21:05:38 +0800	[thread overview]
Message-ID: <ad2a98b5-320c-4990-d1e5-9c7bc3ae71a0@oracle.com> (raw)
In-Reply-To: <779bd819-d320-39e3-0a0b-80c0c8455243@toxicpanda.com>


> 
> So now we're using the main fs_devices->devices_kobj, which is the main 
> fs_devices with fs_devices->seed being the seed fs_devices.  This is 
> fine, except when we actually mount a seed device, and in that case we 
> have fs_devices as the seed devices being used, and then if we add a 
> device we'll actually swap in the new fs_devices for the main 
> fs_devices, and we have the seed devices with the actual devices_kobj 
> that we used set in fs_devices->seed, and thus we'll leak the sysfs 
> objects for the seed devices.  Thanks,

Do you mean leaking the devinfo_kobj instead of devices_kobj? If so,
then yes, and this patch fixed it as well (I just found out).

Otherwise, no, there isn't devices_kobj leak.  We make sure only mounted
fsid has the devices_kobj initialized. So during sprouting- the
devices_kobj remains with the fs_info->fs_devices, as we move the seed
devices below the seed_devices.

static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info)
::
  list_splice_init_rcu(&fs_devices->devices, &seed_devices->devices,
  synchronize_rcu);
  list_for_each_entry(device, &seed_devices->devices, dev_list)
  device->fs_devices = seed_devices;

And during unmount, we clean up the dev links and devices_kobj.

close_ctree()
   btrfs_sysfs_remove_mounted()
   btrfs_sysfs_remove_fsid()


Anand


> Josef



  reply	other threads:[~2020-08-23 13:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 13:15 [PATCH RFC] btrfs/163: replace sprout instead of seed Anand Jain
2020-08-30 14:41 ` [PATCH] fstests: " Anand Jain
2020-08-21 13:15 ` [PATCH 1/2] btrfs: initialize sysfs devid and device link for seed device Anand Jain
2020-08-21 13:15   ` [PATCH RFC 2/2] btrfs: fix replace of " Anand Jain
2020-08-21 14:38     ` Josef Bacik
2020-08-23 15:05       ` Anand Jain
2020-08-21 14:36   ` [PATCH 1/2] btrfs: initialize sysfs devid and device link for " Josef Bacik
2020-08-23 13:05     ` Anand Jain [this message]
2020-08-29 11:44   ` Anand Jain
2020-08-30 14:40 Anand Jain
2020-08-30 14:40 ` Anand Jain
2020-08-31  1:38   ` [PATCH 0/11] btrfs: seed fix null ptr, use only main device_list_mutex, and cleanups Anand Jain
2020-08-30 14:40   ` [PATCH 01/11] btrfs: initialize sysfs devid and device link for seed device Anand Jain
2020-08-31  9:07     ` Nikolay Borisov
2020-08-31 12:00       ` Anand Jain
2020-08-31 16:21     ` Josef Bacik
2020-09-01 16:16       ` Anand Jain
2020-08-30 14:40   ` [PATCH 02/11] btrfs: refactor btrfs_sysfs_add_devices_dir Anand Jain
2020-08-30 14:40   ` [PATCH 03/11] btrfs: refactor btrfs_sysfs_remove_devices_dir Anand Jain
2020-08-31  8:58     ` Nikolay Borisov
2020-08-31  9:12       ` Anand Jain
2020-08-30 14:40   ` [PATCH 04/11] btrfs: reada: use sprout device_list_mutex Anand Jain
2020-08-31  8:54     ` Nikolay Borisov
2020-08-31 16:08     ` Josef Bacik
2020-09-01  9:02       ` Anand Jain
2020-08-30 14:41   ` [PATCH 05/11] btrfs: btrfs_init_devices_late: " Anand Jain
2020-08-31  8:37     ` Nikolay Borisov
2020-09-01  8:54       ` Anand Jain
2020-08-30 14:41   ` [PATCH 06/11] btrfs: open code list_head pointer in btrfs_init_dev_replace_tgtdev Anand Jain
2020-08-31  8:38     ` Nikolay Borisov
2020-08-30 14:41   ` [PATCH 07/11] btrfs: cleanup btrfs_remove_chunk Anand Jain
2020-08-31  8:43     ` Nikolay Borisov
2020-08-30 14:41   ` [PATCH 08/11] btrfs: cleanup btrfs_assign_next_active_device() Anand Jain
2020-08-31  8:44     ` Nikolay Borisov
2020-08-30 14:41   ` [PATCH 09/11] btrfs: cleanup unnecessary goto in open_seed_device Anand Jain
2020-08-31  8:44     ` Nikolay Borisov
2020-08-30 14:41   ` [PATCH 10/11] btrfs: btrfs_dev_replace_update_device_in_mapping_tree drop file global declare Anand Jain
2020-08-31  8:46     ` Nikolay Borisov
2020-08-30 14:41   ` [PATCH 11/11] btrfs: fix replace of seed device Anand Jain

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=ad2a98b5-320c-4990-d1e5-9c7bc3ae71a0@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=josef@toxicpanda.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.