]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext4: fix ZERO_RANGE test failure in data journalling
authorNamjae Jeon <namjae.jeon@samsung.com>
Tue, 27 May 2014 16:48:55 +0000 (12:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 27 May 2014 16:48:55 +0000 (12:48 -0400)
xfstests generic/091 is failing when mounting ext4 with data=journal.
I think that this regression is same problem that occurred prior to collapse
range issue. So ZERO RANGE also need to call ext4_force_commit as
collapse range.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c

index cb23a34bc48a323fdd64e47e0622317eca140e3e..4ddf2b203fb98bbfbe219f45ec5de5d76c1aa3f1 100644 (file)
@@ -4743,6 +4743,15 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 
        mutex_lock(&EXT4_I(inode)->i_write_mutex);
 
+       /* Call ext4_force_commit to flush all data in case of data=journal. */
+       if (ext4_should_journal_data(inode)) {
+               ret = ext4_force_commit(inode->i_sb);
+               if (ret) {
+                       mutex_unlock(&EXT4_I(inode)->i_write_mutex);
+                       return ret;
+               }
+       }
+
        /*
         * Write out all dirty pages to avoid race conditions
         * Then release them.