summaryrefslogtreecommitdiff
path: root/fs/ext4/truncate.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/truncate.h')
-rw-r--r--fs/ext4/truncate.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/ext4/truncate.h b/fs/ext4/truncate.h
index 011ba6670d99..ce84aa2786c7 100644
--- a/fs/ext4/truncate.h
+++ b/fs/ext4/truncate.h
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* linux/fs/ext4/truncate.h
*
@@ -10,8 +11,16 @@
*/
static inline void ext4_truncate_failed_write(struct inode *inode)
{
- truncate_inode_pages(inode->i_mapping, inode->i_size);
+ struct address_space *mapping = inode->i_mapping;
+
+ /*
+ * We don't need to call ext4_break_layouts() because the blocks we
+ * are truncating were never visible to userspace.
+ */
+ filemap_invalidate_lock(mapping);
+ truncate_inode_pages(mapping, inode->i_size);
ext4_truncate(inode);
+ filemap_invalidate_unlock(mapping);
}
/*