diff options
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 8 | ||||
-rw-r--r-- | fs/sysfs/sysfs.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 079122695675..e9fddcc59447 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | DECLARE_RWSEM(sysfs_rename_sem); | 16 | DECLARE_RWSEM(sysfs_rename_sem); |
17 | spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED; | 17 | spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED; |
18 | spinlock_t kobj_sysfs_assoc_lock = SPIN_LOCK_UNLOCKED; | ||
18 | 19 | ||
19 | static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED; | 20 | static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED; |
20 | static DEFINE_IDA(sysfs_ino_ida); | 21 | static DEFINE_IDA(sysfs_ino_ida); |
@@ -426,8 +427,13 @@ static void __sysfs_remove_dir(struct dentry *dentry) | |||
426 | 427 | ||
427 | void sysfs_remove_dir(struct kobject * kobj) | 428 | void sysfs_remove_dir(struct kobject * kobj) |
428 | { | 429 | { |
429 | __sysfs_remove_dir(kobj->dentry); | 430 | struct dentry *d = kobj->dentry; |
431 | |||
432 | spin_lock(&kobj_sysfs_assoc_lock); | ||
430 | kobj->dentry = NULL; | 433 | kobj->dentry = NULL; |
434 | spin_unlock(&kobj_sysfs_assoc_lock); | ||
435 | |||
436 | __sysfs_remove_dir(d); | ||
431 | } | 437 | } |
432 | 438 | ||
433 | int sysfs_rename_dir(struct kobject * kobj, struct dentry *new_parent, | 439 | int sysfs_rename_dir(struct kobject * kobj, struct dentry *new_parent, |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 39ab0481379c..718e2e123fae 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -62,6 +62,7 @@ extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); | |||
62 | extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | 62 | extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); |
63 | 63 | ||
64 | extern spinlock_t sysfs_lock; | 64 | extern spinlock_t sysfs_lock; |
65 | extern spinlock_t kobj_sysfs_assoc_lock; | ||
65 | extern struct rw_semaphore sysfs_rename_sem; | 66 | extern struct rw_semaphore sysfs_rename_sem; |
66 | extern struct super_block * sysfs_sb; | 67 | extern struct super_block * sysfs_sb; |
67 | extern const struct file_operations sysfs_dir_operations; | 68 | extern const struct file_operations sysfs_dir_operations; |