Commit af738c8a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3: sync_fs() fix

From: Alex Tomas <bzzz@tmi.comex.ru>

fsync_super() calls ->sync_fs() just after ->write_super().  But
write_super() will start a commit.  In this case, ext3_sync_fs() will not
itself start a commit, and it hence forgets to wait on the commit which
ext3_write_super() started.

Fix that up by making journal_start_commit() return the transaction ID of
any currently-running transaction.
parent 4152cdfa
...@@ -484,6 +484,13 @@ int journal_start_commit(journal_t *journal, tid_t *ptid) ...@@ -484,6 +484,13 @@ int journal_start_commit(journal_t *journal, tid_t *ptid)
ret = __log_start_commit(journal, tid); ret = __log_start_commit(journal, tid);
if (ret && ptid) if (ret && ptid)
*ptid = tid; *ptid = tid;
} else if (journal->j_committing_transaction && ptid) {
/*
* If ext3_write_super() recently started a commit, then we
* have to wait for completion of that transaction
*/
*ptid = journal->j_committing_transaction->t_tid;
ret = 1;
} }
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment