aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-28 14:54:29 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 17:48:15 -0800
commit517e64f57883bd63c5a4ab8b3d0d3ed68c55d0cf (patch)
tree573f1e42c269ab32985511788a612ed3d7a99347 /fs/sysfs/dir.c
parentsysfs, kernfs: reorganize SYSFS_* constants (diff)
downloadwireguard-linux-517e64f57883bd63c5a4ab8b3d0d3ed68c55d0cf.tar.xz
wireguard-linux-517e64f57883bd63c5a4ab8b3d0d3ed68c55d0cf.zip
sysfs, kernfs: revamp sysfs_dirent active_ref lockdep annotation
Currently, sysfs_dirent active_ref lockdep annotation uses attribute->[s]key as the lockdep key, which forces kernfs_create_file_ns() to assume that sysfs_dirent->priv is pointing to a struct attribute which may not be true for non-sysfs users. This patch restructures the lockdep annotation such that * kernfs_ops contains lockdep_key which is used by default for files created kernfs_create_file_ns(). * kernfs_create_file_ns_key() is introduced which takes an extra @key argument. The created file will use the specified key for active_ref lockdep annotation. If NULL is specified, lockdep for the file is disabled. * sysfs_add_file_mode_ns() is updated to use kernfs_create_file_ns_key() with the appropriate key from the attribute or NULL if ignore_lockdep is set. This makes the lockdep annotation properly contained in kernfs while allowing sysfs to cleanly keep its current behavior. This patch doesn't introduce any behavior differences. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e88e9a94a083..8f2d577b5f64 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -150,7 +150,7 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
if (!atomic_inc_unless_negative(&sd->s_active))
return NULL;
- if (likely(!sysfs_ignore_lockdep(sd)))
+ if (sd->s_flags & SYSFS_FLAG_LOCKDEP)
rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_);
return sd;
}
@@ -169,7 +169,7 @@ void sysfs_put_active(struct sysfs_dirent *sd)
if (unlikely(!sd))
return;
- if (likely(!sysfs_ignore_lockdep(sd)))
+ if (sd->s_flags & SYSFS_FLAG_LOCKDEP)
rwsem_release(&sd->dep_map, 1, _RET_IP_);
v = atomic_dec_return(&sd->s_active);
if (likely(v != SD_DEACTIVATED_BIAS))