aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-06-04 09:26:49 -0400
committerJoel Becker <joel.becker@oracle.com>2009-06-22 17:34:22 -0400
commit9a7aa12f3911853a3574d47d567b81a2a5df7208 (patch)
treeec3c8efe46b59ed78515ec75302a86054f60d6e5 /fs/inode.c
parentdf152c241df9e9d2b9a65d37bd02961abe7f591a (diff)
vfs: Set special lockdep map for dirs only if not set by fs
Some filesystems need to set lockdep map for i_mutex differently for different directories. For example OCFS2 has system directories (for orphan inode tracking and for gathering all system files like journal or quota files into a single place) which have different locking locking rules than standard directories. For a filesystem setting lockdep map is naturaly done when the inode is read but we have to modify unlock_new_inode() not to overwrite the lockdep map the filesystem has set. Acked-by: peterz@infradead.org CC: mingo@redhat.com Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c
index f643be565df8..04c785bb63c3 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -665,12 +665,17 @@ void unlock_new_inode(struct inode *inode)
665 if (inode->i_mode & S_IFDIR) { 665 if (inode->i_mode & S_IFDIR) {
666 struct file_system_type *type = inode->i_sb->s_type; 666 struct file_system_type *type = inode->i_sb->s_type;
667 667
668 /* 668 /* Set new key only if filesystem hasn't already changed it */
669 * ensure nobody is actually holding i_mutex 669 if (!lockdep_match_class(&inode->i_mutex,
670 */ 670 &type->i_mutex_key)) {
671 mutex_destroy(&inode->i_mutex); 671 /*
672 mutex_init(&inode->i_mutex); 672 * ensure nobody is actually holding i_mutex
673 lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key); 673 */
674 mutex_destroy(&inode->i_mutex);
675 mutex_init(&inode->i_mutex);
676 lockdep_set_class(&inode->i_mutex,
677 &type->i_mutex_dir_key);
678 }
674 } 679 }
675#endif 680#endif
676 /* 681 /*