ext4: truncate_inode_pages() in orphan cleanup path
authorLukas Czerner <lczerner@redhat.com>
Tue, 28 May 2013 03:32:35 +0000 (23:32 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 28 May 2013 03:32:35 +0000 (23:32 -0400)
Currently we do not tell mm to zero out tail of the page before truncate
in orphan_cleanup(). This is ok, because the page should not be
uptodate, however this may eventually change and I might cause problems.

Call truncate_inode_pages() as precautionary measure. Thanks Jan Kara
for pointing this out.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 94cc84db7c9aae349b44be229e993ec906a0a25a..c468560c8765c0f302c9d736d9f5020e7cd17699 100644 (file)
@@ -2170,6 +2170,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
                        jbd_debug(2, "truncating inode %lu to %lld bytes\n",
                                  inode->i_ino, inode->i_size);
                        mutex_lock(&inode->i_mutex);
+                       truncate_inode_pages(inode->i_mapping, inode->i_size);
                        ext4_truncate(inode);
                        mutex_unlock(&inode->i_mutex);
                        nr_truncates++;