diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 13:40:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 13:40:41 -0400 |
commit | 419217cb1d0266f62cbea6cdc6b1d1324350bc34 (patch) | |
tree | 01f80c026cc94dfc13b3a16d2fce3ba41c69d54f /fs | |
parent | 4937ce87959629d31e9b09cf5bdf1e12a305c805 (diff) | |
parent | 14358e6ddaed27499d7d366b3e65c3e46b39e1c4 (diff) |
Merge branch 'v2.6.24-lockdep' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep
* 'v2.6.24-lockdep' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep:
lockdep: annotate dir vs file i_mutex
lockdep: per filesystem inode lock class
lockdep: annotate kprobes irq fiddling
lockdep: annotate rcu_read_{,un}lock{,_bh}
lockdep: annotate journal_start()
lockdep: s390: connect the sysexit hook
lockdep: x86_64: connect the sysexit hook
lockdep: i386: connect the sysexit hook
lockdep: syscall exit check
lockdep: fixup mutex annotations
lockdep: fix mismatched lockdep_depth/curr_chain_hash
lockdep: Avoid /proc/lockdep & lock_stat infinite output
lockdep: maintainers
Diffstat (limited to 'fs')
-rw-r--r-- | fs/inode.c | 24 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 9 |
2 files changed, 30 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 |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 772b6531a2a2..8df5bac0b7a5 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -233,6 +233,8 @@ out: | |||
233 | return ret; | 233 | return ret; |
234 | } | 234 | } |
235 | 235 | ||
236 | static struct lock_class_key jbd_handle_key; | ||
237 | |||
236 | /* Allocate a new handle. This should probably be in a slab... */ | 238 | /* Allocate a new handle. This should probably be in a slab... */ |
237 | static handle_t *new_handle(int nblocks) | 239 | static handle_t *new_handle(int nblocks) |
238 | { | 240 | { |
@@ -243,6 +245,8 @@ static handle_t *new_handle(int nblocks) | |||
243 | handle->h_buffer_credits = nblocks; | 245 | handle->h_buffer_credits = nblocks; |
244 | handle->h_ref = 1; | 246 | handle->h_ref = 1; |
245 | 247 | ||
248 | lockdep_init_map(&handle->h_lockdep_map, "jbd_handle", &jbd_handle_key, 0); | ||
249 | |||
246 | return handle; | 250 | return handle; |
247 | } | 251 | } |
248 | 252 | ||
@@ -286,6 +290,9 @@ handle_t *journal_start(journal_t *journal, int nblocks) | |||
286 | current->journal_info = NULL; | 290 | current->journal_info = NULL; |
287 | handle = ERR_PTR(err); | 291 | handle = ERR_PTR(err); |
288 | } | 292 | } |
293 | |||
294 | lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_); | ||
295 | |||
289 | return handle; | 296 | return handle; |
290 | } | 297 | } |
291 | 298 | ||
@@ -1411,6 +1418,8 @@ int journal_stop(handle_t *handle) | |||
1411 | spin_unlock(&journal->j_state_lock); | 1418 | spin_unlock(&journal->j_state_lock); |
1412 | } | 1419 | } |
1413 | 1420 | ||
1421 | lock_release(&handle->h_lockdep_map, 1, _THIS_IP_); | ||
1422 | |||
1414 | jbd_free_handle(handle); | 1423 | jbd_free_handle(handle); |
1415 | return err; | 1424 | return err; |
1416 | } | 1425 | } |