From: Jeff Mahoney <jeffm@suse.com>
To: Chris Mason <clm@fb.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
David Sterba <dsterba@suse.cz>
Subject: Re: [PATCH] Btrfs: don't remove raid type sysfs entries until unmount
Date: Thu, 22 May 2014 11:05:38 -0400 [thread overview]
Message-ID: <537E1242.1010109@suse.com> (raw)
In-Reply-To: <537DEB3F.5020303@fb.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 5/22/14, 8:19 AM, Chris Mason wrote:
> Can we safely reinit a kobject that has been put in use in sysfs?
> Given all the things that can hold refs etc is this legal?
It depends on how the kobject is being used.
It wouldn't be safe to re-use the kobject embedded in space_info since
it controls the lifetime of the object, regardless of its use in sysfs.
The kobjects for block groups only exist for creating the
subdirectories and their lifetime is actually the lifetime of the
space_info. We take a reference to the space_info when we add them to
sysfs because that's where they draw their data. The only reference to
a block group kobject is taken when we add it to sysfs and is dropped
when we remove it. Holding a sysfs file open doesn't pin the kobject,
so once we remove it from sysfs (kobject_del waits for readers to
complete), it's safe to reinitialize it.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
iQIcBAEBAgAGBQJTfhJBAAoJEB57S2MheeWymZoP/Ru0dB9DDQW7eCgeOuXTNMZt
uy29gJsUjC6QoQagJ0aHT1SiNw9EFHuDnfrnUaOGxO2l0dDostdrU4xqH/632xVv
9o4QrTWtg0d7mN2+D4YaYLB/74Nd1O86CE+3zbmM8CY8Ueh+JMR63jSSU5k2zeCX
ts0dcdK31DBP/aoof6NS8KNdJOpi0dIiefH2Si4Zm2RYBxcMBrKpI8KIrhab1Bo6
vomgq4XkAZUK7G2C/gOmGdqMlSMwMsOhiZ2fYH7pdR74q4vPu6K+RnxFnIuOzmPi
nzMxvgYnjjn1+cynTmZD3xMj94MyCamV1wbj4jciIiDdNrr1XRJH1EMqA5T3wDN4
vw52dVm6sDGizO4/coU21WMum2IUrIbCESXK74Tef3FLWzRWerKeZStIYBYGmVuz
WGTfwUJ+SnhEwSAEHbYIDM8fogVvei2UlPAwQ4o2kSzM9kKf+E5YbwYJDbdKlQ0C
tF6kyZFzkJ2ZEEVGv7fqswHudkWGafrPxRCN9iMvxWUWcxNybh1PZ3MW45uvfyA7
UrZYuDruTS2WorYSivKdFi+9DgTxms/ekfiNi4SZQ5Z1JteAPU8AS5OAQOuo+UCD
uIdlRzorK/pzYH0c/qbN5vy/t+cBVYU6ya238R9eTbq1jQGWWZlZuwaUJQb9nhmS
yKBOJnpRMrJOpO6Onrrh
=0M9G
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2014-05-22 15:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 0:12 [PATCH] Btrfs: don't remove raid type sysfs entries until unmount Chris Mason
2014-05-22 1:21 ` Jeff Mahoney
2014-05-22 12:19 ` Chris Mason
2014-05-22 15:05 ` Jeff Mahoney [this message]
2014-05-22 17:17 ` Chris Mason
2014-05-23 12:38 ` David Sterba
2014-05-23 12:56 ` Jeff Mahoney
2014-05-23 14:32 ` David Sterba
2014-05-23 14:34 ` Jeff Mahoney
2014-05-23 18:09 ` Jeff Mahoney
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=537E1242.1010109@suse.com \
--to=jeffm@suse.com \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--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).