From: ebiederm@xmission.com (Eric W. Biederman)
To: Tejun Heo <tj@kernel.org>
Cc: "Greg KH" <gregkh@suse.de>,
"Américo Wang" <xiyou.wangcong@gmail.com>,
"Neil Brown" <neilb@suse.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysfs: differentiate between locking links and non-links
Date: Thu, 11 Feb 2010 17:20:38 -0800 [thread overview]
Message-ID: <m1sk97uu55.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4B74A7F3.9000001@kernel.org> (Tejun Heo's message of "Fri\, 12 Feb 2010 09\:59\:31 +0900")
Tejun Heo <tj@kernel.org> writes:
> Hello, Eric.
>
> On 02/12/2010 03:08 AM, Eric W. Biederman wrote:
>> I have been playing with it and so far the code doesn't seem too bad. I have
>> however come across another misfeature of sysfs. sysfs_get_active_two appears
>> to be unnecessary overkill.
>>
>> The purpose of the active references are to allows us to block when
>> removing sysfs entries that have custom methods so we don't remove
>> modules or those custom methods don't remove access data structures
>> after the files have been removed. Further sysfs_remove_dir remove
>> all elements in the directory before removing the directory itself, so
>> there is no chance we will remove a directory with active children.
>>
>> Tejun do you know of any other reason we want sysfs_get_active_two?
>>
>> If not I think we can make active references apply exclusively to
>> attributes.
>
> Yeah, it's necessary for something which I can't remember from the top
> of my head ATM. It maybe has something to do with attributes not
> holding reference to the owning module while the parent kobj does.
> I'll dig in but IIRC it's not there just for fun. Is it difficult to
> do the lockdep annotation without removing get_active_two?
Probably double the code and testing, plus. I could not figure out
where to stash a lock_class_key for directories. So it certainly would
be a pain to keep get_active_two just because.
If you can figure out what the value of an active reference on a directory
is we can keep them.
My reasoning is that we effectively get an active reference on directories
for free because we have to delete the children before we can delete a
directory.
I do know we have to go up to the directory to get the kobject. So
from that perspective it makes sense.
It would not surprise me if there was a reason that is now gone
that required the active references on directories. sysfs has gone through
a lot of cleanups since that code was added.
Eric
next prev parent reply other threads:[~2010-02-12 1:20 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 1:09 [PATCH] sysfs: differentiate between locking links and non-links Neil Brown
2010-02-10 1:21 ` David Rientjes
2010-02-10 1:56 ` Américo Wang
2010-02-10 3:05 ` David Rientjes
2010-02-10 3:14 ` Américo Wang
2010-02-10 3:19 ` David Rientjes
2010-02-10 3:33 ` Américo Wang
2010-02-10 2:08 ` Américo Wang
2010-02-10 2:19 ` Tejun Heo
2010-02-10 3:12 ` Américo Wang
2010-02-10 8:03 ` Eric W. Biederman
2010-02-10 10:39 ` Tejun Heo
2010-02-10 18:25 ` Eric W. Biederman
2010-02-10 23:05 ` Greg KH
2010-02-11 1:31 ` Eric W. Biederman
2010-02-11 2:10 ` Tejun Heo
2010-02-11 18:08 ` Eric W. Biederman
2010-02-12 0:59 ` Tejun Heo
2010-02-12 1:20 ` Eric W. Biederman [this message]
2010-02-12 1:20 ` Eric W. Biederman
2010-02-12 2:16 ` Tejun Heo
2010-02-11 23:13 ` [PATCH 0/4] Better sysfs lockdep Eric W. Biederman
2010-02-11 23:14 ` [PATCH 1/4] sysfs: Remove sysfs_get/put_active_two Eric W. Biederman
2010-02-11 23:20 ` [PATCH 2/4] sysfs: Only take active references on attributes Eric W. Biederman
2010-02-11 23:21 ` [PATCH 3/4] sysfs: Use one lockdep class per sysfs attribute Eric W. Biederman
2010-02-11 23:23 ` [PATCH 4/4] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on dynamic attributes Eric W. Biederman
2010-02-11 23:42 ` Greg KH
2010-02-12 12:47 ` [PATCH] sysfs: Document sysfs_attr_init and sysfs_bin_attr_init Eric W. Biederman
2010-02-12 21:41 ` [PATCH] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on module dynamic attributes Eric W. Biederman
2010-02-15 10:38 ` [PATCH 4/4] sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on " Américo Wang
2010-02-15 12:53 ` Eric W. Biederman
2010-02-15 10:35 ` [PATCH 3/4] sysfs: Use one lockdep class per sysfs attribute Américo Wang
2010-02-15 7:27 ` [PATCH 2/4] sysfs: Only take active references on attributes Américo Wang
2010-02-15 8:15 ` Américo Wang
2010-02-15 8:31 ` Américo Wang
2010-02-15 10:11 ` Eric W. Biederman
2010-02-15 7:03 ` [PATCH 1/4] sysfs: Remove sysfs_get/put_active_two Américo Wang
2010-02-11 23:18 ` Eric W. Biederman
2010-02-11 23:17 ` [PATCH 0/4] Better sysfs lockdep Eric W. Biederman
2010-02-11 23:43 ` Greg KH
2010-02-10 23:54 ` [PATCH] sysfs: differentiate between locking links and non-links Tejun Heo
2010-02-11 0:38 ` Eric W. Biederman
2010-02-10 17:36 ` Eric W. Biederman
2010-02-10 17:55 ` Dmitry Torokhov
2010-02-10 23:06 ` Greg KH
2010-02-11 21:42 ` Eric W. Biederman
2010-02-11 22:32 ` Greg KH
2010-02-11 22:47 ` Eric W. Biederman
2010-02-17 22:38 ` Greg KH
2010-02-18 0:39 ` Neil Brown
2010-02-18 1:01 ` Eric W. Biederman
2010-02-18 1:12 ` Greg KH
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=m1sk97uu55.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tj@kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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