diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-02-11 18:20:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:51 -0500 |
commit | a2db6842873c8e5a70652f278d469128cb52db70 (patch) | |
tree | 0415c6cfb33753c7a20e05d95e3ce485a60b1f41 /fs/sysfs/dir.c | |
parent | e72ceb8ccac5f770b3e696e09bb673dca7024b20 (diff) |
sysfs: Only take active references on attributes.
If we exclude directories and symlinks from the set of sysfs
dirents where we need active references we are left with
sysfs attributes (binary or not).
- Tweak sysfs_deactivate to only do something on attributes
- Move lockdep initialization into sysfs_file_add_mode to
limit it to just attributes.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 1bdc42f4fd93..481fdec09f4e 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -156,6 +156,10 @@ static void sysfs_deactivate(struct sysfs_dirent *sd) | |||
156 | int v; | 156 | int v; |
157 | 157 | ||
158 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); | 158 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); |
159 | |||
160 | if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF)) | ||
161 | return; | ||
162 | |||
159 | sd->s_sibling = (void *)&wait; | 163 | sd->s_sibling = (void *)&wait; |
160 | 164 | ||
161 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); | 165 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); |
@@ -315,7 +319,6 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type) | |||
315 | 319 | ||
316 | atomic_set(&sd->s_count, 1); | 320 | atomic_set(&sd->s_count, 1); |
317 | atomic_set(&sd->s_active, 0); | 321 | atomic_set(&sd->s_active, 0); |
318 | sysfs_dirent_init_lockdep(sd); | ||
319 | 322 | ||
320 | sd->s_name = name; | 323 | sd->s_name = name; |
321 | sd->s_mode = mode; | 324 | sd->s_mode = mode; |