diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/fs/inode.c b/fs/inode.c index 29f5068f819b..f97de0aeb3b6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -142,6 +142,15 @@ static struct inode *alloc_inode(struct super_block *sb) | |||
142 | return NULL; | 142 | return NULL; |
143 | } | 143 | } |
144 | 144 | ||
145 | spin_lock_init(&inode->i_lock); | ||
146 | lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); | ||
147 | |||
148 | mutex_init(&inode->i_mutex); | ||
149 | lockdep_set_class(&inode->i_mutex, &sb->s_type->i_mutex_key); | ||
150 | |||
151 | init_rwsem(&inode->i_alloc_sem); | ||
152 | lockdep_set_class(&inode->i_alloc_sem, &sb->s_type->i_alloc_sem_key); | ||
153 | |||
145 | mapping->a_ops = &empty_aops; | 154 | mapping->a_ops = &empty_aops; |
146 | mapping->host = inode; | 155 | mapping->host = inode; |
147 | mapping->flags = 0; | 156 | mapping->flags = 0; |
@@ -190,8 +199,6 @@ void inode_init_once(struct inode *inode) | |||
190 | INIT_HLIST_NODE(&inode->i_hash); | 199 | INIT_HLIST_NODE(&inode->i_hash); |
191 | INIT_LIST_HEAD(&inode->i_dentry); | 200 | INIT_LIST_HEAD(&inode->i_dentry); |
192 | INIT_LIST_HEAD(&inode->i_devices); | 201 | INIT_LIST_HEAD(&inode->i_devices); |
193 | mutex_init(&inode->i_mutex); | ||
194 | init_rwsem(&inode->i_alloc_sem); | ||
195 | INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC); | 202 | INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC); |
196 | rwlock_init(&inode->i_data.tree_lock); | 203 | rwlock_init(&inode->i_data.tree_lock); |
197 | spin_lock_init(&inode->i_data.i_mmap_lock); | 204 | spin_lock_init(&inode->i_data.i_mmap_lock); |
@@ -199,7 +206,6 @@ void inode_init_once(struct inode *inode) | |||
199 | spin_lock_init(&inode->i_data.private_lock); | 206 | spin_lock_init(&inode->i_data.private_lock); |
200 | INIT_RAW_PRIO_TREE_ROOT(&inode->i_data.i_mmap); | 207 | INIT_RAW_PRIO_TREE_ROOT(&inode->i_data.i_mmap); |
201 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); | 208 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); |
202 | spin_lock_init(&inode->i_lock); | ||
203 | i_size_ordered_init(inode); | 209 | i_size_ordered_init(inode); |
204 | #ifdef CONFIG_INOTIFY | 210 | #ifdef CONFIG_INOTIFY |
205 | INIT_LIST_HEAD(&inode->inotify_watches); | 211 | INIT_LIST_HEAD(&inode->inotify_watches); |
@@ -561,6 +567,18 @@ EXPORT_SYMBOL(new_inode); | |||
561 | 567 | ||
562 | void unlock_new_inode(struct inode *inode) | 568 | void unlock_new_inode(struct inode *inode) |
563 | { | 569 | { |
570 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
571 | struct file_system_type *type = inode->i_sb->s_type; | ||
572 | /* | ||
573 | * ensure nobody is actually holding i_mutex | ||
574 | */ | ||
575 | mutex_destroy(&inode->i_mutex); | ||
576 | mutex_init(&inode->i_mutex); | ||
577 | if (inode->i_mode & S_IFDIR) | ||
578 | lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key); | ||
579 | else | ||
580 | lockdep_set_class(&inode->i_mutex, &type->i_mutex_key); | ||
581 | #endif | ||
564 | /* | 582 | /* |
565 | * This is special! We do not need the spinlock | 583 | * This is special! We do not need the spinlock |
566 | * when clearing I_LOCK, because we're guaranteed | 584 | * when clearing I_LOCK, because we're guaranteed |