add patch fix-fsync-error-handling-after-filesystem-abort
[ext4-patch-queue.git] / ext4__truncate_inode_pages()_in_orphan_cleanup_path
blob96d703655edcc0779057e37b0280e6ce6c5e0427
1 ext4: truncate_inode_pages() in orphan cleanup path
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently we do not tell mm to zero out tail of the page before truncate
6 in orphan_cleanup(). This is ok, because the page should not be
7 uptodate, however this may eventually change and I might cause problems.
9 Call truncate_inode_pages() as precautionary measure. Thanks Jan Kara
10 for pointing this out.
12 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
16 index 94cc84d..c468560 100644
17 --- a/fs/ext4/super.c
18 +++ b/fs/ext4/super.c
19 @@ -2170,6 +2170,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
20                         jbd_debug(2, "truncating inode %lu to %lld bytes\n",
21                                   inode->i_ino, inode->i_size);
22                         mutex_lock(&inode->i_mutex);
23 +                       truncate_inode_pages(inode->i_mapping, inode->i_size);
24                         ext4_truncate(inode);
25                         mutex_unlock(&inode->i_mutex);
26                         nr_truncates++;