[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A1521C2.4000506@kernel.org>
Date: Thu, 21 May 2009 18:41:22 +0900
From: Tejun Heo <tj@...nel.org>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
linux-kernel@...r.kernel.org,
Cornelia Huck <cornelia.huck@...ibm.com>,
linux-fsdevel@...r.kernel.org,
"Eric W. Biederman" <ebiederm@...stanetworks.com>
Subject: Re: [PATCH 16/20] sysfs: Propagate renames to the vfs on demand
Eric W. Biederman wrote:
> From: Eric W. Biederman <ebiederm@...ssion.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@...stanetworks.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@...nel.org>
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists