diff mbox

[2/2] ext4: fix ZERO_RANGE test failure in data journalling

Message ID 001401cf6e3f$cf49f7c0$6ddde740$@samsung.com
State Accepted, archived
Headers show

Commit Message

Namjae Jeon May 13, 2014, 12:10 a.m. UTC
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>
---
 fs/ext4/extents.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Theodore Ts'o May 26, 2014, 4:29 p.m. UTC | #1
On Tue, May 13, 2014 at 09:10:55AM +0900, Namjae Jeon wrote:
> 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>

Thanks, applied.

						- Ted
--
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
diff mbox

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 1c5e877..02143d6 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -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.