OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 0/14] sysfs cleanups
Re: [PATCH 06/14] sysfs: Rewrite sysfs_get_dentry [message #19537 is a reply to message #19534] Wed, 01 August 2007 17:51 Go to previous messageGo to next message
Tejun Heo is currently offline  Tejun Heo
Messages: 184
Registered: November 2006
Senior Member
Eric W. Biederman wrote:
> Tejun Heo <htejun@gmail.com> writes:
> 
>> Hmmm... I think we can live with a bit of complexity in
>> sysfs_get_dentry().  It's very well localized and not even long.  I have
>> been trying hard to untangle sysfs internals from vfs and have a bit of
>> resistance against going back.  But, then again, if we can achieve
>> something better and simpler, why not?
> 
> Right now my real challenge is untangling sysfs_move_dir.  In the
> case of multiple mounts of the sysfs tree.

OIC.  Yeah, I guess moving a sd with multiple dentries attached could be
pretty difficult.

> My practical problem is that I need to hold a lock for the sysfs
> dirents and while that lock is held I need to call sysfs_get_dentry
> for the destination directory once for each superblock.
> 
> It might be that some kind of reader-writer lock strategy is what
> I need to untangle this mess.  Rather then making changing to i_mutex.
> All I know is at the moment it is taking a lot of code reading and
> brain storm to come of with something that is easy to maintain.

Just in case, sysfs used to have sysfs_rename_rwsem to protect
move/rename against tree walking, which became unnecessary after i_mutex
-> sysfs_mutex conversion.  Move/rename can use stupid big fat locks if
that helps.

Good luck.

-- 
tejun
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 06/14] sysfs: Rewrite sysfs_get_dentry [message #19538 is a reply to message #19537] Thu, 02 August 2007 08:28 Go to previous messageGo to next message
Cornelia Huck is currently offline  Cornelia Huck
Messages: 16
Registered: August 2007
Junior Member
On Thu, 02 Aug 2007 02:51:19 +0900,
Tejun Heo <htejun@gmail.com> wrote:

> Eric W. Biederman wrote:
> > My practical problem is that I need to hold a lock for the sysfs
> > dirents and while that lock is held I need to call sysfs_get_dentry
> > for the destination directory once for each superblock.
> > 
> > It might be that some kind of reader-writer lock strategy is what
> > I need to untangle this mess.  Rather then making changing to i_mutex.
> > All I know is at the moment it is taking a lot of code reading and
> > brain storm to come of with something that is easy to maintain.
> 
> Just in case, sysfs used to have sysfs_rename_rwsem to protect
> move/rename against tree walking, which became unnecessary after i_mutex
> -> sysfs_mutex conversion.  Move/rename can use stupid big fat locks if
> that helps.

I second that. Reintroduction of sysfs_rename_rwsem or something
similar may be the best way to avoid headaches.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 06/14] sysfs: Rewrite sysfs_get_dentry [message #19549 is a reply to message #19538] Fri, 03 August 2007 19:29 Go to previous messageGo to next message
ebiederm is currently offline  ebiederm
Messages: 1354
Registered: February 2006
Senior Member
Cornelia Huck <cornelia.huck@de.ibm.com> writes:

> On Thu, 02 Aug 2007 02:51:19 +0900,
> Tejun Heo <htejun@gmail.com> wrote:
>
>> Eric W. Biederman wrote:
>> > My practical problem is that I need to hold a lock for the sysfs
>> > dirents and while that lock is held I need to call sysfs_get_dentry
>> > for the destination directory once for each superblock.
>> > 
>> > It might be that some kind of reader-writer lock strategy is what
>> > I need to untangle this mess.  Rather then making changing to i_mutex.
>> > All I know is at the moment it is taking a lot of code reading and
>> > brain storm to come of with something that is easy to maintain.
>> 
>> Just in case, sysfs used to have sysfs_rename_rwsem to protect
>> move/rename against tree walking, which became unnecessary after i_mutex
>> -> sysfs_mutex conversion.  Move/rename can use stupid big fat locks if
>> that helps.
>
> I second that. Reintroduction of sysfs_rename_rwsem or something
> similar may be the best way to avoid headaches.

I guess I haven't looked at that because we already have a big fact
lock we just have an ordering problem in taking that lock.  Introducing
another lock just because of that doesn't quite feel right.

I currently have two practical solutions on the table.

- Make the s_sibling list walk RCU safe so it does not require us to
  grab the sysfs_mutex.  This works but is a bit complicated.

- Just kill all of the dentries in sysfs_move_dir and sysfs_rename_dir.
  The semantics are that no one can be using the device at the time
  of a rename or a move (as I read the callers) so dropping the dentries
  and making it look like a delete/add pair to the users should be
  acceptable and a whole lot simpler.

Eric
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH 06/14] sysfs: Rewrite sysfs_get_dentry [message #19556 is a reply to message #19549] Mon, 06 August 2007 15:06 Go to previous message
Cornelia Huck is currently offline  Cornelia Huck
Messages: 16
Registered: August 2007
Junior Member
On Fri, 03 Aug 2007 13:29:19 -0600,
ebiederm@xmission.com (Eric W. Biederman) wrote:

> I currently have two practical solutions on the table.
> 
> - Make the s_sibling list walk RCU safe so it does not require us to
>   grab the sysfs_mutex.  This works but is a bit complicated.

But it would be nice, I guess :)

> 
> - Just kill all of the dentries in sysfs_move_dir and sysfs_rename_dir.
>   The semantics are that no one can be using the device at the time
>   of a rename or a move (as I read the callers) so dropping the dentries
>   and making it look like a delete/add pair to the users should be
>   acceptable and a whole lot simpler.

Hm, I'm not sure I understand you here. What do you mean by "using the
device"? Do you mean dropping the sysfs_dirents? Or am I just confused?
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [RFC][PATCH 0/15] Pid namespaces
Next Topic: [PATCH 1/2] sysctl: remove binary sysctls from kernel.sched_domain
Goto Forum:
  


Current Time: Sat Oct 19 01:25:48 GMT 2024

Total time taken to generate the page: 0.04917 seconds