lkml.org 
[lkml]   [2009]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 16/20] sysfs: Propagate renames to the vfs on demand
    Eric W. Biederman wrote:
    > From: Eric W. Biederman <ebiederm@xmission.com>
    >
    > By teaching sysfs_revalidate to hide a dentry for
    > a sysfs_dirent if the sysfs_dirent has been renamed,
    > and by teaching sysfs_lookup to return the original
    > dentry if the sysfs dirent has been renamed. I can
    > show the results of renames correctly without having to
    > update the dcache during the directory rename.
    >
    > This massively simplifies the rename logic allowing a lot
    > of weird sysfs special cases to be removed along with
    > a lot of now unnecesary helper code.
    >
    > Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>

    It's probably a good idea to cc Al Viro?

    > @@ -311,6 +270,14 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd)
    > if (sd->s_flags & SYSFS_FLAG_REMOVED)
    > goto out_bad;
    >
    > + /* The sysfs dirent has been moved? */
    > + if (dentry->d_parent->d_fsdata != sd->s_parent)
    > + goto out_bad;
    > +
    > + /* The sysfs dirent has been renamed */
    > + if (strcmp(dentry->d_name.name, sd->s_name) != 0)
    > + goto out_bad;
    > +
    > mutex_unlock(&sysfs_mutex);
    > out_valid:
    > return 1;
    > @@ -318,6 +285,12 @@ out_bad:
    > /* Remove the dentry from the dcache hashes.
    > * If this is a deleted dentry we use d_drop instead of d_delete
    > * so sysfs doesn't need to cope with negative dentries.
    > + *
    > + * If this is a dentry that has simply been renamed we
    > + * use d_drop to remove it from the dcache lookup on it's
    ^^^^
    its

    > + * old parent. If this dentry persists later when a lookup
    > + * is performed at it's new name the dentry will be readded
    ^^^^
    its

    Other than the above comment changes,

    Acked-by: Tejun Heo <tj@kernel.org>

    --
    tejun


    \
     
     \ /
      Last update: 2009-05-21 11:45    [W:0.024 / U:2.192 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site