diff options
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 31b6cf30636d..1b5643407a95 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -15,8 +15,7 @@ | |||
15 | #include "sysfs.h" | 15 | #include "sysfs.h" |
16 | 16 | ||
17 | DECLARE_RWSEM(sysfs_rename_sem); | 17 | DECLARE_RWSEM(sysfs_rename_sem); |
18 | spinlock_t sysfs_lock = SPIN_LOCK_UNLOCKED; | 18 | spinlock_t sysfs_assoc_lock = SPIN_LOCK_UNLOCKED; |
19 | spinlock_t kobj_sysfs_assoc_lock = SPIN_LOCK_UNLOCKED; | ||
20 | 19 | ||
21 | static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED; | 20 | static spinlock_t sysfs_ino_lock = SPIN_LOCK_UNLOCKED; |
22 | static DEFINE_IDA(sysfs_ino_ida); | 21 | static DEFINE_IDA(sysfs_ino_ida); |
@@ -236,10 +235,10 @@ static void sysfs_d_iput(struct dentry * dentry, struct inode * inode) | |||
236 | struct sysfs_dirent * sd = dentry->d_fsdata; | 235 | struct sysfs_dirent * sd = dentry->d_fsdata; |
237 | 236 | ||
238 | if (sd) { | 237 | if (sd) { |
239 | /* sd->s_dentry is protected with sysfs_lock. This | 238 | /* sd->s_dentry is protected with sysfs_assoc_lock. |
240 | * allows sysfs_drop_dentry() to dereference it. | 239 | * This allows sysfs_drop_dentry() to dereference it. |
241 | */ | 240 | */ |
242 | spin_lock(&sysfs_lock); | 241 | spin_lock(&sysfs_assoc_lock); |
243 | 242 | ||
244 | /* The dentry might have been deleted or another | 243 | /* The dentry might have been deleted or another |
245 | * lookup could have happened updating sd->s_dentry to | 244 | * lookup could have happened updating sd->s_dentry to |
@@ -248,7 +247,7 @@ static void sysfs_d_iput(struct dentry * dentry, struct inode * inode) | |||
248 | */ | 247 | */ |
249 | if (sd->s_dentry == dentry) | 248 | if (sd->s_dentry == dentry) |
250 | sd->s_dentry = NULL; | 249 | sd->s_dentry = NULL; |
251 | spin_unlock(&sysfs_lock); | 250 | spin_unlock(&sysfs_assoc_lock); |
252 | sysfs_put(sd); | 251 | sysfs_put(sd); |
253 | } | 252 | } |
254 | iput(inode); | 253 | iput(inode); |
@@ -298,9 +297,9 @@ static void sysfs_attach_dentry(struct sysfs_dirent *sd, struct dentry *dentry) | |||
298 | dentry->d_fsdata = sysfs_get(sd); | 297 | dentry->d_fsdata = sysfs_get(sd); |
299 | 298 | ||
300 | /* protect sd->s_dentry against sysfs_d_iput */ | 299 | /* protect sd->s_dentry against sysfs_d_iput */ |
301 | spin_lock(&sysfs_lock); | 300 | spin_lock(&sysfs_assoc_lock); |
302 | sd->s_dentry = dentry; | 301 | sd->s_dentry = dentry; |
303 | spin_unlock(&sysfs_lock); | 302 | spin_unlock(&sysfs_assoc_lock); |
304 | 303 | ||
305 | d_rehash(dentry); | 304 | d_rehash(dentry); |
306 | } | 305 | } |
@@ -603,9 +602,9 @@ void sysfs_remove_dir(struct kobject * kobj) | |||
603 | { | 602 | { |
604 | struct sysfs_dirent *sd = kobj->sd; | 603 | struct sysfs_dirent *sd = kobj->sd; |
605 | 604 | ||
606 | spin_lock(&kobj_sysfs_assoc_lock); | 605 | spin_lock(&sysfs_assoc_lock); |
607 | kobj->sd = NULL; | 606 | kobj->sd = NULL; |
608 | spin_unlock(&kobj_sysfs_assoc_lock); | 607 | spin_unlock(&sysfs_assoc_lock); |
609 | 608 | ||
610 | __sysfs_remove_dir(sd); | 609 | __sysfs_remove_dir(sd); |
611 | } | 610 | } |