Re: [RFC 2/5] sysfs-dir.patch

From: viro
Date: Wed Nov 12 2003 - 09:40:19 EST


On Wed, Nov 12, 2003 at 05:55:29PM +0530, Maneesh Soni wrote:
> @@ -110,10 +231,15 @@ void sysfs_remove_subdir(struct dentry *
> void sysfs_remove_dir(struct kobject * kobj)
> {
> struct list_head * node;
> - struct dentry * dentry = dget(kobj->dentry);
> + struct dentry * dentry = kobj->s_dirent->s_dentry;
> + struct sysfs_dirent * parent_sd;
>
> if (!dentry)
> - return;
> + goto exit;
> +
> + spin_lock(&dcache_lock);
> + dentry = dget_locked(dentry);
> + spin_unlock(&dcache_lock);

Racy. Directory might've been looked up just as you've decided that it
had no dentry.

> void sysfs_rename_dir(struct kobject * kobj, const char *new_name)
> @@ -162,14 +292,170 @@ void sysfs_rename_dir(struct kobject * k
> if (!kobj->parent)
> return;
>
> - parent = kobj->parent->dentry;
> + parent = kobj->parent->s_dirent->s_dentry;
> + if (parent) {

Ditto.

Look, the *only* benefit of ramfs as a backing store for sysfs was that we
could easily get locking right. You want second tree - you get to fight
for coherency.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/