aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2006-07-12 12:03:06 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-12 15:52:54 -0400
commit232ba9dbd68bb084d5d90c511f207d18eae614da (patch)
tree257808053d298d4bf0fd169310e628cc1ed7209d /fs/sysfs
parentd579091b4385e9386e244622d593fe064aa8e8e7 (diff)
[PATCH] lockdep: annotate the sysfs i_mutex to be a separate class
sysfs has a different i_mutex lock order behavior for i_mutex than the other filesystems; sysfs i_mutex is called in many places with subsystem locks held. At the same time, many of the VFS locking rules do not apply to sysfs at all (cross directory rename for example). To untangle this mess (which gives false positives in lockdep), we're giving sysfs inodes their own class for i_mutex. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/sysfs')
-rw-r--r--fs/sysfs/inode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 5e0e31cc46f5..9889e54e1f13 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -109,6 +109,17 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
109 inode->i_ctime = iattr->ia_ctime; 109 inode->i_ctime = iattr->ia_ctime;
110} 110}
111 111
112
113/*
114 * sysfs has a different i_mutex lock order behavior for i_mutex than other
115 * filesystems; sysfs i_mutex is called in many places with subsystem locks
116 * held. At the same time, many of the VFS locking rules do not apply to
117 * sysfs at all (cross directory rename for example). To untangle this mess
118 * (which gives false positives in lockdep), we're giving sysfs inodes their
119 * own class for i_mutex.
120 */
121static struct lock_class_key sysfs_inode_imutex_key;
122
112struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd) 123struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
113{ 124{
114 struct inode * inode = new_inode(sysfs_sb); 125 struct inode * inode = new_inode(sysfs_sb);
@@ -118,6 +129,7 @@ struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
118 inode->i_mapping->a_ops = &sysfs_aops; 129 inode->i_mapping->a_ops = &sysfs_aops;
119 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; 130 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
120 inode->i_op = &sysfs_inode_operations; 131 inode->i_op = &sysfs_inode_operations;
132 lockdep_set_class(&inode->i_mutex, &sysfs_inode_imutex_key);
121 133
122 if (sd->s_iattr) { 134 if (sd->s_iattr) {
123 /* sysfs_dirent has non-default attributes 135 /* sysfs_dirent has non-default attributes