diff options
Diffstat (limited to 'fs/jbd2/journal.c')
-rw-r--r-- | fs/jbd2/journal.c | 121 |
1 files changed, 58 insertions, 63 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 036880895bfc..ad5866aaf0f9 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/hash.h> | 41 | #include <linux/hash.h> |
42 | #include <linux/log2.h> | 42 | #include <linux/log2.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/backing-dev.h> | ||
44 | 45 | ||
45 | #define CREATE_TRACE_POINTS | 46 | #define CREATE_TRACE_POINTS |
46 | #include <trace/events/jbd2.h> | 47 | #include <trace/events/jbd2.h> |
@@ -48,8 +49,6 @@ | |||
48 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
49 | #include <asm/page.h> | 50 | #include <asm/page.h> |
50 | 51 | ||
51 | EXPORT_SYMBOL(jbd2_journal_start); | ||
52 | EXPORT_SYMBOL(jbd2_journal_restart); | ||
53 | EXPORT_SYMBOL(jbd2_journal_extend); | 52 | EXPORT_SYMBOL(jbd2_journal_extend); |
54 | EXPORT_SYMBOL(jbd2_journal_stop); | 53 | EXPORT_SYMBOL(jbd2_journal_stop); |
55 | EXPORT_SYMBOL(jbd2_journal_lock_updates); | 54 | EXPORT_SYMBOL(jbd2_journal_lock_updates); |
@@ -143,7 +142,7 @@ static int kjournald2(void *arg) | |||
143 | /* | 142 | /* |
144 | * And now, wait forever for commit wakeup events. | 143 | * And now, wait forever for commit wakeup events. |
145 | */ | 144 | */ |
146 | spin_lock(&journal->j_state_lock); | 145 | write_lock(&journal->j_state_lock); |
147 | 146 | ||
148 | loop: | 147 | loop: |
149 | if (journal->j_flags & JBD2_UNMOUNT) | 148 | if (journal->j_flags & JBD2_UNMOUNT) |
@@ -154,10 +153,10 @@ loop: | |||
154 | 153 | ||
155 | if (journal->j_commit_sequence != journal->j_commit_request) { | 154 | if (journal->j_commit_sequence != journal->j_commit_request) { |
156 | jbd_debug(1, "OK, requests differ\n"); | 155 | jbd_debug(1, "OK, requests differ\n"); |
157 | spin_unlock(&journal->j_state_lock); | 156 | write_unlock(&journal->j_state_lock); |
158 | del_timer_sync(&journal->j_commit_timer); | 157 | del_timer_sync(&journal->j_commit_timer); |
159 | jbd2_journal_commit_transaction(journal); | 158 | jbd2_journal_commit_transaction(journal); |
160 | spin_lock(&journal->j_state_lock); | 159 | write_lock(&journal->j_state_lock); |
161 | goto loop; | 160 | goto loop; |
162 | } | 161 | } |
163 | 162 | ||
@@ -169,9 +168,9 @@ loop: | |||
169 | * be already stopped. | 168 | * be already stopped. |
170 | */ | 169 | */ |
171 | jbd_debug(1, "Now suspending kjournald2\n"); | 170 | jbd_debug(1, "Now suspending kjournald2\n"); |
172 | spin_unlock(&journal->j_state_lock); | 171 | write_unlock(&journal->j_state_lock); |
173 | refrigerator(); | 172 | refrigerator(); |
174 | spin_lock(&journal->j_state_lock); | 173 | write_lock(&journal->j_state_lock); |
175 | } else { | 174 | } else { |
176 | /* | 175 | /* |
177 | * We assume on resume that commits are already there, | 176 | * We assume on resume that commits are already there, |
@@ -191,9 +190,9 @@ loop: | |||
191 | if (journal->j_flags & JBD2_UNMOUNT) | 190 | if (journal->j_flags & JBD2_UNMOUNT) |
192 | should_sleep = 0; | 191 | should_sleep = 0; |
193 | if (should_sleep) { | 192 | if (should_sleep) { |
194 | spin_unlock(&journal->j_state_lock); | 193 | write_unlock(&journal->j_state_lock); |
195 | schedule(); | 194 | schedule(); |
196 | spin_lock(&journal->j_state_lock); | 195 | write_lock(&journal->j_state_lock); |
197 | } | 196 | } |
198 | finish_wait(&journal->j_wait_commit, &wait); | 197 | finish_wait(&journal->j_wait_commit, &wait); |
199 | } | 198 | } |
@@ -211,7 +210,7 @@ loop: | |||
211 | goto loop; | 210 | goto loop; |
212 | 211 | ||
213 | end_loop: | 212 | end_loop: |
214 | spin_unlock(&journal->j_state_lock); | 213 | write_unlock(&journal->j_state_lock); |
215 | del_timer_sync(&journal->j_commit_timer); | 214 | del_timer_sync(&journal->j_commit_timer); |
216 | journal->j_task = NULL; | 215 | journal->j_task = NULL; |
217 | wake_up(&journal->j_wait_done_commit); | 216 | wake_up(&journal->j_wait_done_commit); |
@@ -234,16 +233,16 @@ static int jbd2_journal_start_thread(journal_t *journal) | |||
234 | 233 | ||
235 | static void journal_kill_thread(journal_t *journal) | 234 | static void journal_kill_thread(journal_t *journal) |
236 | { | 235 | { |
237 | spin_lock(&journal->j_state_lock); | 236 | write_lock(&journal->j_state_lock); |
238 | journal->j_flags |= JBD2_UNMOUNT; | 237 | journal->j_flags |= JBD2_UNMOUNT; |
239 | 238 | ||
240 | while (journal->j_task) { | 239 | while (journal->j_task) { |
241 | wake_up(&journal->j_wait_commit); | 240 | wake_up(&journal->j_wait_commit); |
242 | spin_unlock(&journal->j_state_lock); | 241 | write_unlock(&journal->j_state_lock); |
243 | wait_event(journal->j_wait_done_commit, journal->j_task == NULL); | 242 | wait_event(journal->j_wait_done_commit, journal->j_task == NULL); |
244 | spin_lock(&journal->j_state_lock); | 243 | write_lock(&journal->j_state_lock); |
245 | } | 244 | } |
246 | spin_unlock(&journal->j_state_lock); | 245 | write_unlock(&journal->j_state_lock); |
247 | } | 246 | } |
248 | 247 | ||
249 | /* | 248 | /* |
@@ -310,7 +309,17 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction, | |||
310 | */ | 309 | */ |
311 | J_ASSERT_BH(bh_in, buffer_jbddirty(bh_in)); | 310 | J_ASSERT_BH(bh_in, buffer_jbddirty(bh_in)); |
312 | 311 | ||
313 | new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL); | 312 | retry_alloc: |
313 | new_bh = alloc_buffer_head(GFP_NOFS); | ||
314 | if (!new_bh) { | ||
315 | /* | ||
316 | * Failure is not an option, but __GFP_NOFAIL is going | ||
317 | * away; so we retry ourselves here. | ||
318 | */ | ||
319 | congestion_wait(BLK_RW_ASYNC, HZ/50); | ||
320 | goto retry_alloc; | ||
321 | } | ||
322 | |||
314 | /* keep subsequent assertions sane */ | 323 | /* keep subsequent assertions sane */ |
315 | new_bh->b_state = 0; | 324 | new_bh->b_state = 0; |
316 | init_buffer(new_bh, NULL, NULL); | 325 | init_buffer(new_bh, NULL, NULL); |
@@ -442,7 +451,7 @@ int __jbd2_log_space_left(journal_t *journal) | |||
442 | { | 451 | { |
443 | int left = journal->j_free; | 452 | int left = journal->j_free; |
444 | 453 | ||
445 | assert_spin_locked(&journal->j_state_lock); | 454 | /* assert_spin_locked(&journal->j_state_lock); */ |
446 | 455 | ||
447 | /* | 456 | /* |
448 | * Be pessimistic here about the number of those free blocks which | 457 | * Be pessimistic here about the number of those free blocks which |
@@ -487,9 +496,9 @@ int jbd2_log_start_commit(journal_t *journal, tid_t tid) | |||
487 | { | 496 | { |
488 | int ret; | 497 | int ret; |
489 | 498 | ||
490 | spin_lock(&journal->j_state_lock); | 499 | write_lock(&journal->j_state_lock); |
491 | ret = __jbd2_log_start_commit(journal, tid); | 500 | ret = __jbd2_log_start_commit(journal, tid); |
492 | spin_unlock(&journal->j_state_lock); | 501 | write_unlock(&journal->j_state_lock); |
493 | return ret; | 502 | return ret; |
494 | } | 503 | } |
495 | 504 | ||
@@ -508,7 +517,7 @@ int jbd2_journal_force_commit_nested(journal_t *journal) | |||
508 | transaction_t *transaction = NULL; | 517 | transaction_t *transaction = NULL; |
509 | tid_t tid; | 518 | tid_t tid; |
510 | 519 | ||
511 | spin_lock(&journal->j_state_lock); | 520 | read_lock(&journal->j_state_lock); |
512 | if (journal->j_running_transaction && !current->journal_info) { | 521 | if (journal->j_running_transaction && !current->journal_info) { |
513 | transaction = journal->j_running_transaction; | 522 | transaction = journal->j_running_transaction; |
514 | __jbd2_log_start_commit(journal, transaction->t_tid); | 523 | __jbd2_log_start_commit(journal, transaction->t_tid); |
@@ -516,12 +525,12 @@ int jbd2_journal_force_commit_nested(journal_t *journal) | |||
516 | transaction = journal->j_committing_transaction; | 525 | transaction = journal->j_committing_transaction; |
517 | 526 | ||
518 | if (!transaction) { | 527 | if (!transaction) { |
519 | spin_unlock(&journal->j_state_lock); | 528 | read_unlock(&journal->j_state_lock); |
520 | return 0; /* Nothing to retry */ | 529 | return 0; /* Nothing to retry */ |
521 | } | 530 | } |
522 | 531 | ||
523 | tid = transaction->t_tid; | 532 | tid = transaction->t_tid; |
524 | spin_unlock(&journal->j_state_lock); | 533 | read_unlock(&journal->j_state_lock); |
525 | jbd2_log_wait_commit(journal, tid); | 534 | jbd2_log_wait_commit(journal, tid); |
526 | return 1; | 535 | return 1; |
527 | } | 536 | } |
@@ -535,7 +544,7 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | |||
535 | { | 544 | { |
536 | int ret = 0; | 545 | int ret = 0; |
537 | 546 | ||
538 | spin_lock(&journal->j_state_lock); | 547 | write_lock(&journal->j_state_lock); |
539 | if (journal->j_running_transaction) { | 548 | if (journal->j_running_transaction) { |
540 | tid_t tid = journal->j_running_transaction->t_tid; | 549 | tid_t tid = journal->j_running_transaction->t_tid; |
541 | 550 | ||
@@ -554,7 +563,7 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | |||
554 | *ptid = journal->j_committing_transaction->t_tid; | 563 | *ptid = journal->j_committing_transaction->t_tid; |
555 | ret = 1; | 564 | ret = 1; |
556 | } | 565 | } |
557 | spin_unlock(&journal->j_state_lock); | 566 | write_unlock(&journal->j_state_lock); |
558 | return ret; | 567 | return ret; |
559 | } | 568 | } |
560 | 569 | ||
@@ -566,26 +575,24 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) | |||
566 | { | 575 | { |
567 | int err = 0; | 576 | int err = 0; |
568 | 577 | ||
578 | read_lock(&journal->j_state_lock); | ||
569 | #ifdef CONFIG_JBD2_DEBUG | 579 | #ifdef CONFIG_JBD2_DEBUG |
570 | spin_lock(&journal->j_state_lock); | ||
571 | if (!tid_geq(journal->j_commit_request, tid)) { | 580 | if (!tid_geq(journal->j_commit_request, tid)) { |
572 | printk(KERN_EMERG | 581 | printk(KERN_EMERG |
573 | "%s: error: j_commit_request=%d, tid=%d\n", | 582 | "%s: error: j_commit_request=%d, tid=%d\n", |
574 | __func__, journal->j_commit_request, tid); | 583 | __func__, journal->j_commit_request, tid); |
575 | } | 584 | } |
576 | spin_unlock(&journal->j_state_lock); | ||
577 | #endif | 585 | #endif |
578 | spin_lock(&journal->j_state_lock); | ||
579 | while (tid_gt(tid, journal->j_commit_sequence)) { | 586 | while (tid_gt(tid, journal->j_commit_sequence)) { |
580 | jbd_debug(1, "JBD: want %d, j_commit_sequence=%d\n", | 587 | jbd_debug(1, "JBD: want %d, j_commit_sequence=%d\n", |
581 | tid, journal->j_commit_sequence); | 588 | tid, journal->j_commit_sequence); |
582 | wake_up(&journal->j_wait_commit); | 589 | wake_up(&journal->j_wait_commit); |
583 | spin_unlock(&journal->j_state_lock); | 590 | read_unlock(&journal->j_state_lock); |
584 | wait_event(journal->j_wait_done_commit, | 591 | wait_event(journal->j_wait_done_commit, |
585 | !tid_gt(tid, journal->j_commit_sequence)); | 592 | !tid_gt(tid, journal->j_commit_sequence)); |
586 | spin_lock(&journal->j_state_lock); | 593 | read_lock(&journal->j_state_lock); |
587 | } | 594 | } |
588 | spin_unlock(&journal->j_state_lock); | 595 | read_unlock(&journal->j_state_lock); |
589 | 596 | ||
590 | if (unlikely(is_journal_aborted(journal))) { | 597 | if (unlikely(is_journal_aborted(journal))) { |
591 | printk(KERN_EMERG "journal commit I/O error\n"); | 598 | printk(KERN_EMERG "journal commit I/O error\n"); |
@@ -602,7 +609,7 @@ int jbd2_journal_next_log_block(journal_t *journal, unsigned long long *retp) | |||
602 | { | 609 | { |
603 | unsigned long blocknr; | 610 | unsigned long blocknr; |
604 | 611 | ||
605 | spin_lock(&journal->j_state_lock); | 612 | write_lock(&journal->j_state_lock); |
606 | J_ASSERT(journal->j_free > 1); | 613 | J_ASSERT(journal->j_free > 1); |
607 | 614 | ||
608 | blocknr = journal->j_head; | 615 | blocknr = journal->j_head; |
@@ -610,7 +617,7 @@ int jbd2_journal_next_log_block(journal_t *journal, unsigned long long *retp) | |||
610 | journal->j_free--; | 617 | journal->j_free--; |
611 | if (journal->j_head == journal->j_last) | 618 | if (journal->j_head == journal->j_last) |
612 | journal->j_head = journal->j_first; | 619 | journal->j_head = journal->j_first; |
613 | spin_unlock(&journal->j_state_lock); | 620 | write_unlock(&journal->j_state_lock); |
614 | return jbd2_journal_bmap(journal, blocknr, retp); | 621 | return jbd2_journal_bmap(journal, blocknr, retp); |
615 | } | 622 | } |
616 | 623 | ||
@@ -830,7 +837,7 @@ static journal_t * journal_init_common (void) | |||
830 | mutex_init(&journal->j_checkpoint_mutex); | 837 | mutex_init(&journal->j_checkpoint_mutex); |
831 | spin_lock_init(&journal->j_revoke_lock); | 838 | spin_lock_init(&journal->j_revoke_lock); |
832 | spin_lock_init(&journal->j_list_lock); | 839 | spin_lock_init(&journal->j_list_lock); |
833 | spin_lock_init(&journal->j_state_lock); | 840 | rwlock_init(&journal->j_state_lock); |
834 | 841 | ||
835 | journal->j_commit_interval = (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE); | 842 | journal->j_commit_interval = (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE); |
836 | journal->j_min_batch_time = 0; | 843 | journal->j_min_batch_time = 0; |
@@ -1096,14 +1103,14 @@ void jbd2_journal_update_superblock(journal_t *journal, int wait) | |||
1096 | set_buffer_uptodate(bh); | 1103 | set_buffer_uptodate(bh); |
1097 | } | 1104 | } |
1098 | 1105 | ||
1099 | spin_lock(&journal->j_state_lock); | 1106 | read_lock(&journal->j_state_lock); |
1100 | jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n", | 1107 | jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n", |
1101 | journal->j_tail, journal->j_tail_sequence, journal->j_errno); | 1108 | journal->j_tail, journal->j_tail_sequence, journal->j_errno); |
1102 | 1109 | ||
1103 | sb->s_sequence = cpu_to_be32(journal->j_tail_sequence); | 1110 | sb->s_sequence = cpu_to_be32(journal->j_tail_sequence); |
1104 | sb->s_start = cpu_to_be32(journal->j_tail); | 1111 | sb->s_start = cpu_to_be32(journal->j_tail); |
1105 | sb->s_errno = cpu_to_be32(journal->j_errno); | 1112 | sb->s_errno = cpu_to_be32(journal->j_errno); |
1106 | spin_unlock(&journal->j_state_lock); | 1113 | read_unlock(&journal->j_state_lock); |
1107 | 1114 | ||
1108 | BUFFER_TRACE(bh, "marking dirty"); | 1115 | BUFFER_TRACE(bh, "marking dirty"); |
1109 | mark_buffer_dirty(bh); | 1116 | mark_buffer_dirty(bh); |
@@ -1124,12 +1131,12 @@ out: | |||
1124 | * any future commit will have to be careful to update the | 1131 | * any future commit will have to be careful to update the |
1125 | * superblock again to re-record the true start of the log. */ | 1132 | * superblock again to re-record the true start of the log. */ |
1126 | 1133 | ||
1127 | spin_lock(&journal->j_state_lock); | 1134 | write_lock(&journal->j_state_lock); |
1128 | if (sb->s_start) | 1135 | if (sb->s_start) |
1129 | journal->j_flags &= ~JBD2_FLUSHED; | 1136 | journal->j_flags &= ~JBD2_FLUSHED; |
1130 | else | 1137 | else |
1131 | journal->j_flags |= JBD2_FLUSHED; | 1138 | journal->j_flags |= JBD2_FLUSHED; |
1132 | spin_unlock(&journal->j_state_lock); | 1139 | write_unlock(&journal->j_state_lock); |
1133 | } | 1140 | } |
1134 | 1141 | ||
1135 | /* | 1142 | /* |
@@ -1391,13 +1398,9 @@ int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat, | |||
1391 | int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat, | 1398 | int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat, |
1392 | unsigned long ro, unsigned long incompat) | 1399 | unsigned long ro, unsigned long incompat) |
1393 | { | 1400 | { |
1394 | journal_superblock_t *sb; | ||
1395 | |||
1396 | if (!compat && !ro && !incompat) | 1401 | if (!compat && !ro && !incompat) |
1397 | return 1; | 1402 | return 1; |
1398 | 1403 | ||
1399 | sb = journal->j_superblock; | ||
1400 | |||
1401 | /* We can support any known requested features iff the | 1404 | /* We can support any known requested features iff the |
1402 | * superblock is in version 2. Otherwise we fail to support any | 1405 | * superblock is in version 2. Otherwise we fail to support any |
1403 | * extended sb features. */ | 1406 | * extended sb features. */ |
@@ -1545,7 +1548,7 @@ int jbd2_journal_flush(journal_t *journal) | |||
1545 | transaction_t *transaction = NULL; | 1548 | transaction_t *transaction = NULL; |
1546 | unsigned long old_tail; | 1549 | unsigned long old_tail; |
1547 | 1550 | ||
1548 | spin_lock(&journal->j_state_lock); | 1551 | write_lock(&journal->j_state_lock); |
1549 | 1552 | ||
1550 | /* Force everything buffered to the log... */ | 1553 | /* Force everything buffered to the log... */ |
1551 | if (journal->j_running_transaction) { | 1554 | if (journal->j_running_transaction) { |
@@ -1558,10 +1561,10 @@ int jbd2_journal_flush(journal_t *journal) | |||
1558 | if (transaction) { | 1561 | if (transaction) { |
1559 | tid_t tid = transaction->t_tid; | 1562 | tid_t tid = transaction->t_tid; |
1560 | 1563 | ||
1561 | spin_unlock(&journal->j_state_lock); | 1564 | write_unlock(&journal->j_state_lock); |
1562 | jbd2_log_wait_commit(journal, tid); | 1565 | jbd2_log_wait_commit(journal, tid); |
1563 | } else { | 1566 | } else { |
1564 | spin_unlock(&journal->j_state_lock); | 1567 | write_unlock(&journal->j_state_lock); |
1565 | } | 1568 | } |
1566 | 1569 | ||
1567 | /* ...and flush everything in the log out to disk. */ | 1570 | /* ...and flush everything in the log out to disk. */ |
@@ -1585,12 +1588,12 @@ int jbd2_journal_flush(journal_t *journal) | |||
1585 | * the magic code for a fully-recovered superblock. Any future | 1588 | * the magic code for a fully-recovered superblock. Any future |
1586 | * commits of data to the journal will restore the current | 1589 | * commits of data to the journal will restore the current |
1587 | * s_start value. */ | 1590 | * s_start value. */ |
1588 | spin_lock(&journal->j_state_lock); | 1591 | write_lock(&journal->j_state_lock); |
1589 | old_tail = journal->j_tail; | 1592 | old_tail = journal->j_tail; |
1590 | journal->j_tail = 0; | 1593 | journal->j_tail = 0; |
1591 | spin_unlock(&journal->j_state_lock); | 1594 | write_unlock(&journal->j_state_lock); |
1592 | jbd2_journal_update_superblock(journal, 1); | 1595 | jbd2_journal_update_superblock(journal, 1); |
1593 | spin_lock(&journal->j_state_lock); | 1596 | write_lock(&journal->j_state_lock); |
1594 | journal->j_tail = old_tail; | 1597 | journal->j_tail = old_tail; |
1595 | 1598 | ||
1596 | J_ASSERT(!journal->j_running_transaction); | 1599 | J_ASSERT(!journal->j_running_transaction); |
@@ -1598,7 +1601,7 @@ int jbd2_journal_flush(journal_t *journal) | |||
1598 | J_ASSERT(!journal->j_checkpoint_transactions); | 1601 | J_ASSERT(!journal->j_checkpoint_transactions); |
1599 | J_ASSERT(journal->j_head == journal->j_tail); | 1602 | J_ASSERT(journal->j_head == journal->j_tail); |
1600 | J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); | 1603 | J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); |
1601 | spin_unlock(&journal->j_state_lock); | 1604 | write_unlock(&journal->j_state_lock); |
1602 | return 0; | 1605 | return 0; |
1603 | } | 1606 | } |
1604 | 1607 | ||
@@ -1617,7 +1620,6 @@ int jbd2_journal_flush(journal_t *journal) | |||
1617 | 1620 | ||
1618 | int jbd2_journal_wipe(journal_t *journal, int write) | 1621 | int jbd2_journal_wipe(journal_t *journal, int write) |
1619 | { | 1622 | { |
1620 | journal_superblock_t *sb; | ||
1621 | int err = 0; | 1623 | int err = 0; |
1622 | 1624 | ||
1623 | J_ASSERT (!(journal->j_flags & JBD2_LOADED)); | 1625 | J_ASSERT (!(journal->j_flags & JBD2_LOADED)); |
@@ -1626,8 +1628,6 @@ int jbd2_journal_wipe(journal_t *journal, int write) | |||
1626 | if (err) | 1628 | if (err) |
1627 | return err; | 1629 | return err; |
1628 | 1630 | ||
1629 | sb = journal->j_superblock; | ||
1630 | |||
1631 | if (!journal->j_tail) | 1631 | if (!journal->j_tail) |
1632 | goto no_recovery; | 1632 | goto no_recovery; |
1633 | 1633 | ||
@@ -1665,12 +1665,12 @@ void __jbd2_journal_abort_hard(journal_t *journal) | |||
1665 | printk(KERN_ERR "Aborting journal on device %s.\n", | 1665 | printk(KERN_ERR "Aborting journal on device %s.\n", |
1666 | journal->j_devname); | 1666 | journal->j_devname); |
1667 | 1667 | ||
1668 | spin_lock(&journal->j_state_lock); | 1668 | write_lock(&journal->j_state_lock); |
1669 | journal->j_flags |= JBD2_ABORT; | 1669 | journal->j_flags |= JBD2_ABORT; |
1670 | transaction = journal->j_running_transaction; | 1670 | transaction = journal->j_running_transaction; |
1671 | if (transaction) | 1671 | if (transaction) |
1672 | __jbd2_log_start_commit(journal, transaction->t_tid); | 1672 | __jbd2_log_start_commit(journal, transaction->t_tid); |
1673 | spin_unlock(&journal->j_state_lock); | 1673 | write_unlock(&journal->j_state_lock); |
1674 | } | 1674 | } |
1675 | 1675 | ||
1676 | /* Soft abort: record the abort error status in the journal superblock, | 1676 | /* Soft abort: record the abort error status in the journal superblock, |
@@ -1755,12 +1755,12 @@ int jbd2_journal_errno(journal_t *journal) | |||
1755 | { | 1755 | { |
1756 | int err; | 1756 | int err; |
1757 | 1757 | ||
1758 | spin_lock(&journal->j_state_lock); | 1758 | read_lock(&journal->j_state_lock); |
1759 | if (journal->j_flags & JBD2_ABORT) | 1759 | if (journal->j_flags & JBD2_ABORT) |
1760 | err = -EROFS; | 1760 | err = -EROFS; |
1761 | else | 1761 | else |
1762 | err = journal->j_errno; | 1762 | err = journal->j_errno; |
1763 | spin_unlock(&journal->j_state_lock); | 1763 | read_unlock(&journal->j_state_lock); |
1764 | return err; | 1764 | return err; |
1765 | } | 1765 | } |
1766 | 1766 | ||
@@ -1775,12 +1775,12 @@ int jbd2_journal_clear_err(journal_t *journal) | |||
1775 | { | 1775 | { |
1776 | int err = 0; | 1776 | int err = 0; |
1777 | 1777 | ||
1778 | spin_lock(&journal->j_state_lock); | 1778 | write_lock(&journal->j_state_lock); |
1779 | if (journal->j_flags & JBD2_ABORT) | 1779 | if (journal->j_flags & JBD2_ABORT) |
1780 | err = -EROFS; | 1780 | err = -EROFS; |
1781 | else | 1781 | else |
1782 | journal->j_errno = 0; | 1782 | journal->j_errno = 0; |
1783 | spin_unlock(&journal->j_state_lock); | 1783 | write_unlock(&journal->j_state_lock); |
1784 | return err; | 1784 | return err; |
1785 | } | 1785 | } |
1786 | 1786 | ||
@@ -1793,10 +1793,10 @@ int jbd2_journal_clear_err(journal_t *journal) | |||
1793 | */ | 1793 | */ |
1794 | void jbd2_journal_ack_err(journal_t *journal) | 1794 | void jbd2_journal_ack_err(journal_t *journal) |
1795 | { | 1795 | { |
1796 | spin_lock(&journal->j_state_lock); | 1796 | write_lock(&journal->j_state_lock); |
1797 | if (journal->j_errno) | 1797 | if (journal->j_errno) |
1798 | journal->j_flags |= JBD2_ACK_ERR; | 1798 | journal->j_flags |= JBD2_ACK_ERR; |
1799 | spin_unlock(&journal->j_state_lock); | 1799 | write_unlock(&journal->j_state_lock); |
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | int jbd2_journal_blocks_per_page(struct inode *inode) | 1802 | int jbd2_journal_blocks_per_page(struct inode *inode) |
@@ -2201,8 +2201,6 @@ void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode) | |||
2201 | void jbd2_journal_release_jbd_inode(journal_t *journal, | 2201 | void jbd2_journal_release_jbd_inode(journal_t *journal, |
2202 | struct jbd2_inode *jinode) | 2202 | struct jbd2_inode *jinode) |
2203 | { | 2203 | { |
2204 | int writeout = 0; | ||
2205 | |||
2206 | if (!journal) | 2204 | if (!journal) |
2207 | return; | 2205 | return; |
2208 | restart: | 2206 | restart: |
@@ -2219,9 +2217,6 @@ restart: | |||
2219 | goto restart; | 2217 | goto restart; |
2220 | } | 2218 | } |
2221 | 2219 | ||
2222 | /* Do we need to wait for data writeback? */ | ||
2223 | if (journal->j_committing_transaction == jinode->i_transaction) | ||
2224 | writeout = 1; | ||
2225 | if (jinode->i_transaction) { | 2220 | if (jinode->i_transaction) { |
2226 | list_del(&jinode->i_list); | 2221 | list_del(&jinode->i_list); |
2227 | jinode->i_transaction = NULL; | 2222 | jinode->i_transaction = NULL; |