summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-11-29 12:35:32 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-01-02 19:27:29 -0800
commit20bb2479be49296ca324d7d9dfafad4816e7958c (patch)
tree036a4f6e988933e3c49097376212e307618c229e /fs/f2fs/file.c
parent55899d7b4977759a751cf923d368e22b8c891544 (diff)
downloadlinux-stable-20bb2479be49296ca324d7d9dfafad4816e7958c.tar.gz
linux-stable-20bb2479be49296ca324d7d9dfafad4816e7958c.tar.bz2
linux-stable-20bb2479be49296ca324d7d9dfafad4816e7958c.zip
f2fs: switch to fscrypt_prepare_setattr()
Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index ebe55d4793fb..d2bd2138514c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -743,6 +743,10 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
if (err)
return err;
+ err = fscrypt_prepare_setattr(dentry, attr);
+ if (err)
+ return err;
+
if (is_quota_modification(inode, attr)) {
err = dquot_initialize(inode);
if (err)
@@ -758,14 +762,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
}
if (attr->ia_valid & ATTR_SIZE) {
- if (f2fs_encrypted_inode(inode)) {
- err = fscrypt_get_encryption_info(inode);
- if (err)
- return err;
- if (!fscrypt_has_encryption_key(inode))
- return -ENOKEY;
- }
-
if (attr->ia_size <= i_size_read(inode)) {
down_write(&F2FS_I(inode)->i_mmap_sem);
truncate_setsize(inode, attr->ia_size);