>From 83ea3af40033e4214383a9846d8180d9c096c2e0 Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <[email protected]>
Date: Tue, 29 Sep 2015 14:35:25 +0400
Subject: [RH7 PATCH] ext4: drop pfcache csum on fallocate v2

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

https://jira.sw.ru/browse/PSBM-33644

Signed-off-by: Dmitry Monakhov <[email protected]>
---
 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..bac9339 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_PFCACHE_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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to