Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296571
b: refs/heads/master
c: a78bb11
h: refs/heads/master
i:
  296569: ef5972b
  296567: e64123f
v: v3
  • Loading branch information
Jan Kara authored and Theodore Ts'o committed Mar 13, 2012
1 parent e0d76f5 commit 4a7f495
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24bcc89c7e7c64982e6192b4952a0a92379fc341
refs/heads/master: a78bb11d7acd525623c6a0c2ff4e213d527573fa
2 changes: 2 additions & 0 deletions trunk/fs/jbd2/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ void jbd2_journal_commit_transaction(journal_t *journal)
/* Do we need to erase the effects of a prior jbd2_journal_flush? */
if (journal->j_flags & JBD2_FLUSHED) {
jbd_debug(3, "super block updated\n");
mutex_lock(&journal->j_checkpoint_mutex);
jbd2_journal_update_sb_log_tail(journal);
mutex_unlock(&journal->j_checkpoint_mutex);
} else {
jbd_debug(3, "superblock not updated\n");
}
Expand Down
19 changes: 16 additions & 3 deletions trunk/fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,11 @@ static int journal_reset(journal_t *journal)
journal->j_errno);
journal->j_flags |= JBD2_FLUSHED;
} else {
/* Lock here to make assertions happy... */
mutex_lock(&journal->j_checkpoint_mutex);
/* Add the dynamic fields and write it to disk. */
jbd2_journal_update_sb_log_tail(journal);
mutex_unlock(&journal->j_checkpoint_mutex);
}
return jbd2_journal_start_thread(journal);
}
Expand Down Expand Up @@ -1173,6 +1176,7 @@ void jbd2_journal_update_sb_log_tail(journal_t *journal)
{
journal_superblock_t *sb = journal->j_superblock;

BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
read_lock(&journal->j_state_lock);
jbd_debug(1, "JBD2: updating superblock (start %ld, seq %d)\n",
journal->j_tail, journal->j_tail_sequence);
Expand Down Expand Up @@ -1201,6 +1205,7 @@ static void jbd2_mark_journal_empty(journal_t *journal)
{
journal_superblock_t *sb = journal->j_superblock;

BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
read_lock(&journal->j_state_lock);
jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
journal->j_tail_sequence);
Expand Down Expand Up @@ -1434,9 +1439,11 @@ int jbd2_journal_destroy(journal_t *journal)
spin_unlock(&journal->j_list_lock);

if (journal->j_sb_buffer) {
if (!is_journal_aborted(journal))
if (!is_journal_aborted(journal)) {
mutex_lock(&journal->j_checkpoint_mutex);
jbd2_mark_journal_empty(journal);
else
mutex_unlock(&journal->j_checkpoint_mutex);
} else
err = -EIO;
brelse(journal->j_sb_buffer);
}
Expand Down Expand Up @@ -1630,6 +1637,7 @@ int jbd2_journal_flush(journal_t *journal)
if (is_journal_aborted(journal))
return -EIO;

mutex_lock(&journal->j_checkpoint_mutex);
jbd2_cleanup_journal_tail(journal);

/* Finally, mark the journal as really needing no recovery.
Expand All @@ -1638,6 +1646,7 @@ int jbd2_journal_flush(journal_t *journal)
* commits of data to the journal will restore the current
* s_start value. */
jbd2_mark_journal_empty(journal);
mutex_unlock(&journal->j_checkpoint_mutex);
write_lock(&journal->j_state_lock);
J_ASSERT(!journal->j_running_transaction);
J_ASSERT(!journal->j_committing_transaction);
Expand Down Expand Up @@ -1678,8 +1687,12 @@ int jbd2_journal_wipe(journal_t *journal, int write)
write ? "Clearing" : "Ignoring");

err = jbd2_journal_skip_recovery(journal);
if (write)
if (write) {
/* Lock to make assertions happy... */
mutex_lock(&journal->j_checkpoint_mutex);
jbd2_mark_journal_empty(journal);
mutex_unlock(&journal->j_checkpoint_mutex);
}

no_recovery:
return err;
Expand Down

0 comments on commit 4a7f495

Please sign in to comment.