aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jbd2/transaction.c11
-rw-r--r--include/linux/jbd2.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index f30802aeefae..70b3199e69dc 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -241,6 +241,8 @@ out:
241 return ret; 241 return ret;
242} 242}
243 243
244static struct lock_class_key jbd2_handle_key;
245
244/* Allocate a new handle. This should probably be in a slab... */ 246/* Allocate a new handle. This should probably be in a slab... */
245static handle_t *new_handle(int nblocks) 247static handle_t *new_handle(int nblocks)
246{ 248{
@@ -251,6 +253,9 @@ static handle_t *new_handle(int nblocks)
251 handle->h_buffer_credits = nblocks; 253 handle->h_buffer_credits = nblocks;
252 handle->h_ref = 1; 254 handle->h_ref = 1;
253 255
256 lockdep_init_map(&handle->h_lockdep_map, "jbd2_handle",
257 &jbd2_handle_key, 0);
258
254 return handle; 259 return handle;
255} 260}
256 261
@@ -293,7 +298,11 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
293 jbd2_free_handle(handle); 298 jbd2_free_handle(handle);
294 current->journal_info = NULL; 299 current->journal_info = NULL;
295 handle = ERR_PTR(err); 300 handle = ERR_PTR(err);
301 goto out;
296 } 302 }
303
304 lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
305out:
297 return handle; 306 return handle;
298} 307}
299 308
@@ -1419,6 +1428,8 @@ int jbd2_journal_stop(handle_t *handle)
1419 spin_unlock(&journal->j_state_lock); 1428 spin_unlock(&journal->j_state_lock);
1420 } 1429 }
1421 1430
1431 lock_release(&handle->h_lockdep_map, 1, _THIS_IP_);
1432
1422 jbd2_free_handle(handle); 1433 jbd2_free_handle(handle);
1423 return err; 1434 return err;
1424} 1435}
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 98a2bc5d3e3f..2cbf6fdb1799 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -418,6 +418,10 @@ struct handle_s
418 unsigned int h_sync: 1; /* sync-on-close */ 418 unsigned int h_sync: 1; /* sync-on-close */
419 unsigned int h_jdata: 1; /* force data journaling */ 419 unsigned int h_jdata: 1; /* force data journaling */
420 unsigned int h_aborted: 1; /* fatal error on handle */ 420 unsigned int h_aborted: 1; /* fatal error on handle */
421
422#ifdef CONFIG_DEBUG_LOCK_ALLOC
423 struct lockdep_map h_lockdep_map;
424#endif
421}; 425};
422 426
423 427