diff options
author | Jan Kara <jack@suse.cz> | 2011-05-24 11:52:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-05-24 11:52:40 -0400 |
commit | 81be12c8179c1c397d3f179cdd9b3f7146cf47f1 (patch) | |
tree | b535687e88af17fc6b25329decf28563ed519395 /fs/jbd2/commit.c | |
parent | b221349fa8b45d13c3650089f0514df7d1eb36c3 (diff) |
jbd2: fix sending of data flush on journal commit
In data=ordered mode, it's theoretically possible (however rare) that
an inode is filed to transaction's t_inode_list and a flusher thread
writes all the data and inode is reclaimed before the transaction
starts to commit. In such a case, we could erroneously omit sending a
flush to file system device when it is different from the journal
device (because data can still be in disk cache only).
Fix the problem by setting a flag in a transaction when some inode is added
to it and then send disk flush in the commit code when the flag is set.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/commit.c')
-rw-r--r-- | fs/jbd2/commit.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 78c299218681..2d5095ecc25f 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -219,7 +219,6 @@ static int journal_submit_data_buffers(journal_t *journal, | |||
219 | ret = err; | 219 | ret = err; |
220 | spin_lock(&journal->j_list_lock); | 220 | spin_lock(&journal->j_list_lock); |
221 | J_ASSERT(jinode->i_transaction == commit_transaction); | 221 | J_ASSERT(jinode->i_transaction == commit_transaction); |
222 | commit_transaction->t_flushed_data_blocks = 1; | ||
223 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); | 222 | clear_bit(__JI_COMMIT_RUNNING, &jinode->i_flags); |
224 | smp_mb__after_clear_bit(); | 223 | smp_mb__after_clear_bit(); |
225 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); | 224 | wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); |
@@ -683,7 +682,7 @@ start_journal_io: | |||
683 | * then we must flush the file system device before we issue | 682 | * then we must flush the file system device before we issue |
684 | * the commit record | 683 | * the commit record |
685 | */ | 684 | */ |
686 | if (commit_transaction->t_flushed_data_blocks && | 685 | if (commit_transaction->t_need_data_flush && |
687 | (journal->j_fs_dev != journal->j_dev) && | 686 | (journal->j_fs_dev != journal->j_dev) && |
688 | (journal->j_flags & JBD2_BARRIER)) | 687 | (journal->j_flags & JBD2_BARRIER)) |
689 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); | 688 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); |