Patchwork [5/5] ext3: fix data integrity for ext4_sync_fs

login
register
mail settings
Submitter Dmitri Monakho
Date April 14, 2013, 7:01 p.m.
Message ID <1365966097-8968-5-git-send-email-dmonakhov@openvz.org>
Download mbox | patch
Permalink /patch/236455/
State New
Headers show

Comments

Dmitri Monakho - April 14, 2013, 7:01 p.m.
Inode's data or non journaled quota may be written w/o jounral so we must
send a barrier at the end of ext3_sync_fs. But it can be skipped if journal
commit will do it for us.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/ext3/super.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Patch

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index fb5120a..ee140a8 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2521,6 +2521,7 @@  int ext3_force_commit(struct super_block *sb)
 static int ext3_sync_fs(struct super_block *sb, int wait)
 {
 	tid_t target;
+	int ret = 0;
 
 	trace_ext3_sync_fs(sb, wait);
 	/*
@@ -2530,9 +2531,12 @@  static int ext3_sync_fs(struct super_block *sb, int wait)
 	dquot_writeback_dquots(sb, -1);
 	if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
 		if (wait)
-			log_wait_commit(EXT3_SB(sb)->s_journal, target);
+			ret = log_wait_commit(EXT3_SB(sb)->s_journal, target);
+	} else {
+		ret = blkdev_issue_flush(sb->s_bdev, GFP_KERNEL, NULL);
 	}
-	return 0;
+
+	return ret;
 }
 
 /*