> On Mon, Mar 22, 2010 at 07:14:13PM +0300, Dmitry Monakhov wrote:
But still if you happen to set the flag after commit code has checked
it, you have lost the race. Given the bug you describe below, I think
we should provide a new call from JBD2 that will do all the necessary
magic for given TID - something like:
data_barrier = 0;
if (journal->j_commit_sequence > tid)
data_barrier = 1;
else if (journal->j_committing_transaction &&
journal->j_committing_transaction->t_tid == tid) {
/* Here we could be more clever and set the barrier
* flag of the transaction if according to its state
* it has not yet issued data barrier */
data_barrier = 1;
} else {
journal->j_running_transaction->has_data = 1;
jbd2_log_start_commit(journal, tid);
}
jbd2_log_wait_commit(journal, tid);
if (data_barrier)
blk_dev_issue_flush(journal->j_fs_dev);
What do you think?
Yeah, I agree this is a problem and it could cause ext4_sync_file not
properly wait. The simplest fix is to call jbd2_log_wait_commit
unconditionally. But I'd maybe go with the above approach.
Honza
--
Jan Kara <jack@suse.cz>
SuSE CR Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html