summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/dir.c
diff options
context:
space:
mode:
authorSheng Yong <shengyong1@huawei.com>2018-03-15 11:51:42 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2018-03-17 06:02:57 +0100
commitff62af200b94e06b1430eac6e58f5f26d13c749d (patch)
tree23f4285339aa68a38749106c87c37002dccd69f8 /fs/f2fs/dir.c
parentf2fs: introduce F2FS_FEATURE_LOST_FOUND feature (diff)
downloadlinux-ff62af200b94e06b1430eac6e58f5f26d13c749d.tar.xz
linux-ff62af200b94e06b1430eac6e58f5f26d13c749d.zip
f2fs: introduce a new mount option test_dummy_encryption
This patch introduces a new mount option `test_dummy_encryption' to allow fscrypt to create a fake fscrypt context. This is used by xfstests. Signed-off-by: Sheng Yong <shengyong1@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r--fs/f2fs/dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 9a0d103b5052..fe661274ff10 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -361,6 +361,7 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
struct page *dpage)
{
struct page *page;
+ int dummy_encrypt = DUMMY_ENCRYPTION_ENABLED(F2FS_I_SB(dir));
int err;
if (is_inode_flag_set(inode, FI_NEW_INODE)) {
@@ -387,7 +388,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
if (err)
goto put_error;
- if (f2fs_encrypted_inode(dir) && f2fs_may_encrypt(inode)) {
+ if ((f2fs_encrypted_inode(dir) || dummy_encrypt) &&
+ f2fs_may_encrypt(inode)) {
err = fscrypt_inherit_context(dir, inode, page, false);
if (err)
goto put_error;