diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 303c8d96457f..d329c9df90ae 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -147,8 +147,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
147 | 147 | ||
148 | mlog_entry("(max_buffs = %d)\n", max_buffs); | 148 | mlog_entry("(max_buffs = %d)\n", max_buffs); |
149 | 149 | ||
150 | if (!osb || !osb->journal->j_journal) | 150 | BUG_ON(!osb || !osb->journal->j_journal); |
151 | BUG(); | ||
152 | 151 | ||
153 | if (ocfs2_is_hard_readonly(osb)) { | 152 | if (ocfs2_is_hard_readonly(osb)) { |
154 | ret = -EROFS; | 153 | ret = -EROFS; |
@@ -401,7 +400,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
401 | * j_trans_barrier for us. */ | 400 | * j_trans_barrier for us. */ |
402 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); | 401 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); |
403 | 402 | ||
404 | down(&OCFS2_I(inode)->ip_io_sem); | 403 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); |
405 | switch (type) { | 404 | switch (type) { |
406 | case OCFS2_JOURNAL_ACCESS_CREATE: | 405 | case OCFS2_JOURNAL_ACCESS_CREATE: |
407 | case OCFS2_JOURNAL_ACCESS_WRITE: | 406 | case OCFS2_JOURNAL_ACCESS_WRITE: |
@@ -416,7 +415,7 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle, | |||
416 | status = -EINVAL; | 415 | status = -EINVAL; |
417 | mlog(ML_ERROR, "Uknown access type!\n"); | 416 | mlog(ML_ERROR, "Uknown access type!\n"); |
418 | } | 417 | } |
419 | up(&OCFS2_I(inode)->ip_io_sem); | 418 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); |
420 | 419 | ||
421 | if (status < 0) | 420 | if (status < 0) |
422 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", | 421 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", |
@@ -561,7 +560,11 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) | |||
561 | SET_INODE_JOURNAL(inode); | 560 | SET_INODE_JOURNAL(inode); |
562 | OCFS2_I(inode)->ip_open_count++; | 561 | OCFS2_I(inode)->ip_open_count++; |
563 | 562 | ||
564 | status = ocfs2_meta_lock(inode, NULL, &bh, 1); | 563 | /* Skip recovery waits here - journal inode metadata never |
564 | * changes in a live cluster so it can be considered an | ||
565 | * exception to the rule. */ | ||
566 | status = ocfs2_meta_lock_full(inode, NULL, &bh, 1, | ||
567 | OCFS2_META_LOCK_RECOVERY); | ||
565 | if (status < 0) { | 568 | if (status < 0) { |
566 | if (status != -ERESTARTSYS) | 569 | if (status != -ERESTARTSYS) |
567 | mlog(ML_ERROR, "Could not get lock on journal!\n"); | 570 | mlog(ML_ERROR, "Could not get lock on journal!\n"); |
@@ -672,8 +675,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
672 | 675 | ||
673 | mlog_entry_void(); | 676 | mlog_entry_void(); |
674 | 677 | ||
675 | if (!osb) | 678 | BUG_ON(!osb); |
676 | BUG(); | ||
677 | 679 | ||
678 | journal = osb->journal; | 680 | journal = osb->journal; |
679 | if (!journal) | 681 | if (!journal) |
@@ -805,8 +807,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) | |||
805 | 807 | ||
806 | mlog_entry_void(); | 808 | mlog_entry_void(); |
807 | 809 | ||
808 | if (!journal) | 810 | BUG_ON(!journal); |
809 | BUG(); | ||
810 | 811 | ||
811 | status = journal_wipe(journal->j_journal, full); | 812 | status = journal_wipe(journal->j_journal, full); |
812 | if (status < 0) { | 813 | if (status < 0) { |
@@ -1072,10 +1073,10 @@ restart: | |||
1072 | NULL); | 1073 | NULL); |
1073 | 1074 | ||
1074 | bail: | 1075 | bail: |
1075 | down(&osb->recovery_lock); | 1076 | mutex_lock(&osb->recovery_lock); |
1076 | if (!status && | 1077 | if (!status && |
1077 | !ocfs2_node_map_is_empty(osb, &osb->recovery_map)) { | 1078 | !ocfs2_node_map_is_empty(osb, &osb->recovery_map)) { |
1078 | up(&osb->recovery_lock); | 1079 | mutex_unlock(&osb->recovery_lock); |
1079 | goto restart; | 1080 | goto restart; |
1080 | } | 1081 | } |
1081 | 1082 | ||
@@ -1083,7 +1084,7 @@ bail: | |||
1083 | mb(); /* sync with ocfs2_recovery_thread_running */ | 1084 | mb(); /* sync with ocfs2_recovery_thread_running */ |
1084 | wake_up(&osb->recovery_event); | 1085 | wake_up(&osb->recovery_event); |
1085 | 1086 | ||
1086 | up(&osb->recovery_lock); | 1087 | mutex_unlock(&osb->recovery_lock); |
1087 | 1088 | ||
1088 | mlog_exit(status); | 1089 | mlog_exit(status); |
1089 | /* no one is callint kthread_stop() for us so the kthread() api | 1090 | /* no one is callint kthread_stop() for us so the kthread() api |
@@ -1098,7 +1099,7 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) | |||
1098 | mlog_entry("(node_num=%d, osb->node_num = %d)\n", | 1099 | mlog_entry("(node_num=%d, osb->node_num = %d)\n", |
1099 | node_num, osb->node_num); | 1100 | node_num, osb->node_num); |
1100 | 1101 | ||
1101 | down(&osb->recovery_lock); | 1102 | mutex_lock(&osb->recovery_lock); |
1102 | if (osb->disable_recovery) | 1103 | if (osb->disable_recovery) |
1103 | goto out; | 1104 | goto out; |
1104 | 1105 | ||
@@ -1120,7 +1121,7 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) | |||
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | out: | 1123 | out: |
1123 | up(&osb->recovery_lock); | 1124 | mutex_unlock(&osb->recovery_lock); |
1124 | wake_up(&osb->recovery_event); | 1125 | wake_up(&osb->recovery_event); |
1125 | 1126 | ||
1126 | mlog_exit_void(); | 1127 | mlog_exit_void(); |
@@ -1271,8 +1272,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
1271 | 1272 | ||
1272 | /* Should not ever be called to recover ourselves -- in that | 1273 | /* Should not ever be called to recover ourselves -- in that |
1273 | * case we should've called ocfs2_journal_load instead. */ | 1274 | * case we should've called ocfs2_journal_load instead. */ |
1274 | if (osb->node_num == node_num) | 1275 | BUG_ON(osb->node_num == node_num); |
1275 | BUG(); | ||
1276 | 1276 | ||
1277 | slot_num = ocfs2_node_num_to_slot(si, node_num); | 1277 | slot_num = ocfs2_node_num_to_slot(si, node_num); |
1278 | if (slot_num == OCFS2_INVALID_SLOT) { | 1278 | if (slot_num == OCFS2_INVALID_SLOT) { |
@@ -1584,10 +1584,9 @@ static int ocfs2_commit_thread(void *arg) | |||
1584 | while (!(kthread_should_stop() && | 1584 | while (!(kthread_should_stop() && |
1585 | atomic_read(&journal->j_num_trans) == 0)) { | 1585 | atomic_read(&journal->j_num_trans) == 0)) { |
1586 | 1586 | ||
1587 | wait_event_interruptible_timeout(osb->checkpoint_event, | 1587 | wait_event_interruptible(osb->checkpoint_event, |
1588 | atomic_read(&journal->j_num_trans) | 1588 | atomic_read(&journal->j_num_trans) |
1589 | || kthread_should_stop(), | 1589 | || kthread_should_stop()); |
1590 | OCFS2_CHECKPOINT_INTERVAL); | ||
1591 | 1590 | ||
1592 | status = ocfs2_commit_cache(osb); | 1591 | status = ocfs2_commit_cache(osb); |
1593 | if (status < 0) | 1592 | if (status < 0) |