After the last round of refactoring nothing is really using
using s_dirent so remove it.  Which makes the code easier to work
with and follow.  And with a little luck makes it easier to
support multiple dentry trees for sysfs.

Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]>
---
 fs/sysfs/dir.c   |   26 +-------------------------
 fs/sysfs/mount.c |    1 -
 fs/sysfs/sysfs.h |    1 -
 3 files changed, 1 insertions(+), 27 deletions(-)

diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index f8de6fb..c17e601 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -310,22 +310,7 @@ static void sysfs_d_iput(struct dentry * dentry, struct 
inode * inode)
 {
        struct sysfs_dirent * sd = dentry->d_fsdata;
 
-       if (sd) {
-               /* sd->s_dentry is protected with sysfs_assoc_lock.
-                * This allows sysfs_drop_dentry() to dereference it.
-                */
-               spin_lock(&sysfs_assoc_lock);
-
-               /* The dentry might have been deleted or another
-                * lookup could have happened updating sd->s_dentry to
-                * point the new dentry.  Ignore if it isn't pointing
-                * to this dentry.
-                */
-               if (sd->s_dentry == dentry)
-                       sd->s_dentry = NULL;
-               spin_unlock(&sysfs_assoc_lock);
-               sysfs_put(sd);
-       }
+       sysfs_put(sd);
        iput(inode);
 }
 
@@ -373,9 +358,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, 
umode_t mode, int type)
  *     @sd: target sysfs_dirent
  *     @dentry: dentry to associate
  *
- *     Associate @sd with @dentry.  This is protected by
- *     sysfs_assoc_lock to avoid race with sysfs_d_iput().
- *
  *     LOCKING:
  *     mutex_lock(sysfs_mutex)
  */
@@ -383,12 +365,6 @@ static void sysfs_attach_dentry(struct sysfs_dirent *sd, 
struct dentry *dentry)
 {
        dentry->d_op = &sysfs_dentry_ops;
        dentry->d_fsdata = sysfs_get(sd);
-
-       /* protect sd->s_dentry against sysfs_d_iput */
-       spin_lock(&sysfs_assoc_lock);
-       sd->s_dentry = dentry;
-       spin_unlock(&sysfs_assoc_lock);
-
        d_rehash(dentry);
 }
 
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 919eaaf..3f652be 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -57,7 +57,6 @@ static int sysfs_fill_super(struct super_block *sb, void 
*data, int silent)
                iput(inode);
                return -ENOMEM;
        }
-       sysfs_root.s_dentry = root;
        root->d_fsdata = &sysfs_root;
        sb->s_root = root;
        return 0;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 3b4b989..60af864 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -37,7 +37,6 @@ struct sysfs_dirent {
        unsigned int            s_flags;
        umode_t                 s_mode;
        ino_t                   s_ino;
-       struct dentry           * s_dentry;
        struct iattr            * s_iattr;
        atomic_t                s_event;
 };
-- 
1.5.1.1.181.g2de0

_______________________________________________
Containers mailing list
[EMAIL PROTECTED]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to