Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Tejun Heo <htejun@gmail.com>
Cc: cornelia.huck@de.ibm.com, greg@kroah.com,
	linux-kernel@vger.kernel.org, satyam@infradead.org,
	stern@rowland.harvard.edu, containers@lists.osdl.org
Subject: Re: [PATCHSET] Sysfs cleanups from Eric W. Biederman
Date: Wed, 22 Aug 2007 09:51:35 -0600	[thread overview]
Message-ID: <m16437pny0.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <46CC4C08.1020408@gmail.com> (Tejun Heo's message of "Wed, 22 Aug 2007 23:45:28 +0900")

Tejun Heo <htejun@gmail.com> writes:

> Hello,
>
> Eric W. Biederman wrote:
>>> * fix-i_mutex-locking-in-sysfs_get_dentry patch is added at the top
>>>   and #14-Don_t-use-lookup_one_len_kern and
>>>   #15-vfs-Remove-lookup_one_len_kern are dropped.  This is because #14
>>>   contained had a bug where it might created dentry/inode for an
>>>   already deleted sysfs_dirent.  I think it's benefitial to keep
>>>   single lookup path.
>> 
>> I think I disagree with the bug spotting.
>> 
>> At least in net we the sysfs_rename_mutex which keeps parent
>> directories from disappearing.  Further we have a reference
>> to the leaf sysfs_dirent and are actively manipulating it, so
>> the sysfs_dirent should not disappear on us.
>
> sysfs_rename_mutex() keeps out renaming and moving not removing.  Also,
> reference prevents sysfs_dirent from being released not from being
> removed.  The different in lookup path is that it searches the children
> list - sd's are unlinked from children list on removal.

True.   I guess what I was seeing was not a code but a usages
restriction which may not be enforced.

If we are using sysfs_get_dentry the sd is not deleted because
it is alive and being used, likewise the path to it should also be
alive.  Once you add in classic unix delete behaviour allowing for
alive but deleted files this no longer applies.  But I don't think
that makes sense for sysfs, but I may be confused.

>>> * Rewrote simplify-sysfs_get_dentry patch and
>>>   #08-Implement-__sysfs_get_dentry,
>>>   #09-Move-sysfs_get_dentry-below-__sysfs_get_dentry and
>>>   #10-Rewrite-sysfs_get_dentry-in-terms-of-__sysfs_get_dentry are
>>>   omitted as __sysfs_get_dentry() isn't used by anyone.
>> 
>> Right.  __sysfs_get_dentry is an optimization that has makes
>> the best case for sysfs_get_dentry O(1) instead of O(depth).
>> However this doesn't matter because sysfs_get_dentry is not
>> on any fast path and the maximum depth of sysfs directories
>> is fairly shallow and programmer controlled.
>
> The reason why sysfs_get_dentry() climbed up first then climbed down was
> not because of performance.  It was to support the original shadow
> implementation.  Because there was no reliable way to reach a leaf node
> from the root, dentries of all shadows are pinned such that they can
> serve as the starting point for dentry lookup and the climing up was to
> reach that starting point.  Now that the dentry-multiplexing shadow
> support is gone, there's no need to do the climing up.

Reasonable.  The reason I kept the climbing up was the performance
benefit I saw.

>> The only user other user of __sysfs_get_dentry is in the tagged
>> directory support, and even that user doesn't strictly need it.
>> Although it is a bit silly to populate the dcache just so you
>> can invalidate it a moment later...
>
> Yeah, actually the only essential user of that kind of look up is
> sysfs_drop_dentry() which is in deletion path and can't fail due to
> allocation failure and has the logic open-coded.  I have nothing against
> __sysfs_get_dentry().  It was just not needed by the patches I forwarded
> this time.  Feel free to include it as you see fit.

Sure.

> I'm currently working on kobj/sysfs separation.  As most internal
> implementation is sd based already, the changes are mostly confined to
> interface functions but it's still a big change.  I think I'll be able
> to post the patches in this week or early next week at the latest.

Ok.

I'd like to make certain we have a path to tagged support or something
like it if we can.

Eric

  reply	other threads:[~2007-08-22 15:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 12:36 [PATCHSET] Sysfs cleanups from Eric W. Biederman Tejun Heo
     [not found] ` <11876133893720-git-send-email-htejun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-08-20 12:36   ` [PATCH 03/14] sysfs: Remove sysfs_instantiate Tejun Heo
2007-08-20 12:36   ` [PATCH 02/14] sysfs: Move all of inode initialization into sysfs_init_inode Tejun Heo
2007-08-20 12:36   ` [PATCH 04/14] sysfs: Use kill_anon_super Tejun Heo
2007-08-20 12:36   ` [PATCH 11/14] sysfs: Remove s_dentry Tejun Heo
2007-08-20 12:36   ` [PATCH 09/14] sysfs: Introduce sysfs_rename_mutex Tejun Heo
2007-08-20 12:36   ` [PATCH 06/14] sysfs: In sysfs_lookup don't open code sysfs_find_dirent Tejun Heo
2007-08-20 12:36   ` [PATCH 07/14] sysfs: Simplify readdir Tejun Heo
2007-08-20 12:36   ` [PATCH 05/14] sysfs: Make sysfs_mount static Tejun Heo
2007-08-20 12:36   ` [PATCH 08/14] sysfs: Rewrite sysfs_drop_dentry Tejun Heo
2007-08-20 12:36   ` [PATCH 12/14] sysfs: kill SYSFS_FLAG_REMOVED Tejun Heo
2007-08-20 12:36   ` [PATCH 13/14] sysfs: Rewrite rename in terms of sysfs dirents Tejun Heo
2007-08-20 12:36   ` [PATCH 14/14] sysfs: Rewrite sysfs_move_dir " Tejun Heo
2007-08-22 14:04   ` [PATCHSET] Sysfs cleanups from Eric W. Biederman Eric W. Biederman
2007-08-22 14:45     ` Tejun Heo
2007-08-22 15:51       ` Eric W. Biederman [this message]
2007-08-20 12:36 ` [PATCH 01/14] sysfs: fix i_mutex locking in sysfs_get_dentry() Tejun Heo
2007-08-20 12:36 ` [PATCH 10/14] sysfs: simply sysfs_get_dentry Tejun Heo
2007-08-22  9:26 ` [PATCHSET] Sysfs cleanups from Eric W. Biederman Cornelia Huck
2007-08-22  9:39   ` Tejun Heo

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=m16437pny0.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=containers@lists.osdl.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=htejun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=satyam@infradead.org \
    --cc=stern@rowland.harvard.edu \
    /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