Skip to contentSkip to conversation

ext4: fix shared/002 and 004 fail issue in xfstests

PATCH Superseded Namjae Jeon 2 participants 3 messages Apr 7, 2014 ext4 file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: fix shared/002 and 004 fail issue in xfstests

From: Namjae Jeon <[email protected]>

When mounting ext4 with data=journal option, shared/002 and 004 are failed on xfstests. Calling ext4_force_commit before filemap_write_and_wait_range is needed to flush all data into journal on this case.

---
 fs/ext4/extents.c |    7 +++++++
 1 file changed, 7 insertions(+)
fs/ext4/extents.c +7 -0
index 243a02e..dc9333f 100644
@@ -5375,6 +5375,13 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 	punch_start = offset >> EXT4_BLOCK_SIZE_BITS(sb);
 	punch_stop = (offset + len) >> EXT4_BLOCK_SIZE_BITS(sb);
 
+	/* 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)
+			return ret;
+	}
+
 	/* Write out all dirty pages */
 	ret = filemap_write_and_wait_range(inode->i_mapping, offset, -1);
 	if (ret)
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 6 lines · Namjae Jeon

From: Namjae Jeon <[email protected]>

When mounting ext4 with data=journal option, shared/002 and 004 are failed on xfstests. Calling ext4_force_commit before filemap_write_and_wait_range is needed to flush all data into journal on this case.

Hi Namjae,

Thanks for working for this!

Could you include in your commit description of why adding a call to ext4_force_commit() is necessary to avoid the problem, and what wa going wrong in the data=journal case?

Thanks,

- Ted

#2 lore raw

2014-04-08 1:25 GMT+09:00, Theodore Ts'o <[email protected]>:

Quoted 8 lines · Namjae Jeon
Quoted 6 lines

From: Namjae Jeon <[email protected]>

When mounting ext4 with data=journal option, shared/002 and 004 are failed on xfstests. Calling ext4_force_commit before filemap_write_and_wait_range is needed to flush all data into journal on this case.

Quoted 7 lines

Hi Namjae,

Thanks for working for this!

Could you include in your commit description of why adding a call to ext4_force_commit() is necessary to avoid the problem, and what wa going wrong in the data=journal case?

Hi Ted.
Yes Sure. I will post the patch with detail description again. Thanks!

Quoted 5 lines

Thanks,

- Ted