Commit 20bb2479 authored by Eric Biggers's avatar Eric Biggers Committed by Jaegeuk Kim

f2fs: switch to fscrypt_prepare_setattr()

Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 55899d7b
...@@ -743,6 +743,10 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -743,6 +743,10 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
if (err) if (err)
return err; return err;
err = fscrypt_prepare_setattr(dentry, attr);
if (err)
return err;
if (is_quota_modification(inode, attr)) { if (is_quota_modification(inode, attr)) {
err = dquot_initialize(inode); err = dquot_initialize(inode);
if (err) if (err)
...@@ -758,14 +762,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -758,14 +762,6 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
} }
if (attr->ia_valid & ATTR_SIZE) { 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)) { if (attr->ia_size <= i_size_read(inode)) {
down_write(&F2FS_I(inode)->i_mmap_sem); down_write(&F2FS_I(inode)->i_mmap_sem);
truncate_setsize(inode, attr->ia_size); truncate_setsize(inode, attr->ia_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment