]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
f2fs: don't need to check encrypted inode for partial truncation
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 14 Jun 2017 15:05:32 +0000 (08:05 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 4 Jul 2017 09:11:49 +0000 (02:11 -0700)
The cache_only is always false, if inode is encrypted.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 7ea63d84a699a2f2bc8c44cfc925198f87589f30..6a201c61eef546a3ff7ab61a11e9a9ed91782ec5 100644 (file)
@@ -534,8 +534,10 @@ static int truncate_partial_data_page(struct inode *inode, u64 from,
 truncate_out:
        f2fs_wait_on_page_writeback(page, DATA, true);
        zero_user(page, offset, PAGE_SIZE - offset);
-       if (!cache_only || !f2fs_encrypted_inode(inode) ||
-                                       !S_ISREG(inode->i_mode))
+
+       /* An encrypted inode should have a key and truncate the last page. */
+       f2fs_bug_on(F2FS_I_SB(inode), cache_only && f2fs_encrypted_inode(inode));
+       if (!cache_only)
                set_page_dirty(page);
        f2fs_put_page(page, 1);
        return 0;