diff options
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/transaction.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 5f09370c90a8..ff2f2e6ad311 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -551,7 +551,6 @@ int jbd2_journal_extend(handle_t *handle, int nblocks) | |||
551 | int result; | 551 | int result; |
552 | int wanted; | 552 | int wanted; |
553 | 553 | ||
554 | WARN_ON(!transaction); | ||
555 | if (is_handle_aborted(handle)) | 554 | if (is_handle_aborted(handle)) |
556 | return -EROFS; | 555 | return -EROFS; |
557 | journal = transaction->t_journal; | 556 | journal = transaction->t_journal; |
@@ -627,7 +626,6 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) | |||
627 | tid_t tid; | 626 | tid_t tid; |
628 | int need_to_start, ret; | 627 | int need_to_start, ret; |
629 | 628 | ||
630 | WARN_ON(!transaction); | ||
631 | /* If we've had an abort of any type, don't even think about | 629 | /* If we've had an abort of any type, don't even think about |
632 | * actually doing the restart! */ | 630 | * actually doing the restart! */ |
633 | if (is_handle_aborted(handle)) | 631 | if (is_handle_aborted(handle)) |
@@ -785,7 +783,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, | |||
785 | int need_copy = 0; | 783 | int need_copy = 0; |
786 | unsigned long start_lock, time_lock; | 784 | unsigned long start_lock, time_lock; |
787 | 785 | ||
788 | WARN_ON(!transaction); | ||
789 | if (is_handle_aborted(handle)) | 786 | if (is_handle_aborted(handle)) |
790 | return -EROFS; | 787 | return -EROFS; |
791 | journal = transaction->t_journal; | 788 | journal = transaction->t_journal; |
@@ -1051,7 +1048,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
1051 | int err; | 1048 | int err; |
1052 | 1049 | ||
1053 | jbd_debug(5, "journal_head %p\n", jh); | 1050 | jbd_debug(5, "journal_head %p\n", jh); |
1054 | WARN_ON(!transaction); | ||
1055 | err = -EROFS; | 1051 | err = -EROFS; |
1056 | if (is_handle_aborted(handle)) | 1052 | if (is_handle_aborted(handle)) |
1057 | goto out; | 1053 | goto out; |
@@ -1266,7 +1262,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1266 | struct journal_head *jh; | 1262 | struct journal_head *jh; |
1267 | int ret = 0; | 1263 | int ret = 0; |
1268 | 1264 | ||
1269 | WARN_ON(!transaction); | ||
1270 | if (is_handle_aborted(handle)) | 1265 | if (is_handle_aborted(handle)) |
1271 | return -EROFS; | 1266 | return -EROFS; |
1272 | journal = transaction->t_journal; | 1267 | journal = transaction->t_journal; |
@@ -1397,7 +1392,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1397 | int err = 0; | 1392 | int err = 0; |
1398 | int was_modified = 0; | 1393 | int was_modified = 0; |
1399 | 1394 | ||
1400 | WARN_ON(!transaction); | ||
1401 | if (is_handle_aborted(handle)) | 1395 | if (is_handle_aborted(handle)) |
1402 | return -EROFS; | 1396 | return -EROFS; |
1403 | journal = transaction->t_journal; | 1397 | journal = transaction->t_journal; |
@@ -1530,8 +1524,22 @@ int jbd2_journal_stop(handle_t *handle) | |||
1530 | tid_t tid; | 1524 | tid_t tid; |
1531 | pid_t pid; | 1525 | pid_t pid; |
1532 | 1526 | ||
1533 | if (!transaction) | 1527 | if (!transaction) { |
1534 | goto free_and_exit; | 1528 | /* |
1529 | * Handle is already detached from the transaction so | ||
1530 | * there is nothing to do other than decrease a refcount, | ||
1531 | * or free the handle if refcount drops to zero | ||
1532 | */ | ||
1533 | if (--handle->h_ref > 0) { | ||
1534 | jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, | ||
1535 | handle->h_ref); | ||
1536 | return err; | ||
1537 | } else { | ||
1538 | if (handle->h_rsv_handle) | ||
1539 | jbd2_free_handle(handle->h_rsv_handle); | ||
1540 | goto free_and_exit; | ||
1541 | } | ||
1542 | } | ||
1535 | journal = transaction->t_journal; | 1543 | journal = transaction->t_journal; |
1536 | 1544 | ||
1537 | J_ASSERT(journal_current_handle() == handle); | 1545 | J_ASSERT(journal_current_handle() == handle); |
@@ -2373,7 +2381,6 @@ int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *jinode) | |||
2373 | transaction_t *transaction = handle->h_transaction; | 2381 | transaction_t *transaction = handle->h_transaction; |
2374 | journal_t *journal; | 2382 | journal_t *journal; |
2375 | 2383 | ||
2376 | WARN_ON(!transaction); | ||
2377 | if (is_handle_aborted(handle)) | 2384 | if (is_handle_aborted(handle)) |
2378 | return -EROFS; | 2385 | return -EROFS; |
2379 | journal = transaction->t_journal; | 2386 | journal = transaction->t_journal; |