f2fs crypto: check encryption for tmpfile
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 19 May 2015 23:11:40 +0000 (16:11 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 1 Jun 2015 23:21:02 +0000 (16:21 -0700)
This patch adds to check encryption for tmpfile in early stage.

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

index 6edad57d7b47689468a5e9a074e1e3b707c15431..a316783de8c9ca0a3e47a7e103870c67fcb4ef67 100644 (file)
@@ -569,6 +569,12 @@ out:
 
 static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
+       if (f2fs_encrypted_inode(dir)) {
+               int err = f2fs_get_encryption_info(dir);
+               if (err)
+                       return err;
+       }
+
        return __f2fs_tmpfile(dir, dentry, mode, NULL);
 }