Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67981
b: refs/heads/master
c: 5a26b79
h: refs/heads/master
i:
  67979: 8c80139
v: v3
  • Loading branch information
Eric W. Biederman authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent f4dd7c8 commit a52085d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e0712bbfd9cb617fc3a822781c2466fb6b7ede50
refs/heads/master: 5a26b79c426f8e55ebf7204cb138eb6b1645d4d3
32 changes: 4 additions & 28 deletions trunk/fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,22 +289,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);
}

Expand Down Expand Up @@ -352,22 +337,13 @@ 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)
*/
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);
}

Expand Down Expand Up @@ -846,7 +822,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name)

/* rename */
d_add(new_dentry, NULL);
d_move(sd->s_dentry, new_dentry);
d_move(old_dentry, new_dentry);

error = 0;
goto out_unlock;
Expand Down Expand Up @@ -881,7 +857,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
error = PTR_ERR(old_dentry);
goto out_dput;
}
old_parent = sd->s_parent->s_dentry;
old_parent = old_dentry->d_parent;

new_parent = sysfs_get_dentry(new_parent_sd);
if (IS_ERR(new_parent)) {
Expand All @@ -907,7 +883,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
} else
error = 0;
d_add(new_dentry, NULL);
d_move(sd->s_dentry, new_dentry);
d_move(old_dentry, new_dentry);
dput(new_dentry);

/* Remove from old parent's list and insert into new parent's list. */
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/sysfs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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;
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/sysfs/sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit a52085d

Please sign in to comment.