[Devel] [RH7 PATCH] ext4: drop pfcache csum on fallocate

Dmitry Monakhov dmonakhov at openvz.org
Mon Sep 28 01:41:25 PDT 2015


If fallocate will change file's data we have to drop csum.

Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 fs/ext4/extents.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 08b0709..fe95102 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5062,6 +5062,11 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		     FALLOC_FL_CONVERT_AND_EXTEND))
 		return -EOPNOTSUPP;
 
+	/* If data is about to change we must drop csum */
+	if (ext4_test_inode_state(inode, EXT4_STATE_CSUM) &&
+	    ((mode & ~FALLOC_FL_KEEP_SIZE)  || !(mode & FALLOC_FL_KEEP_SIZE)))
+		ext4_truncate_data_csum(inode, -1);
+
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		return ext4_punch_hole(inode, offset, len);
 
-- 
1.7.1




More information about the Devel mailing list