Skip to content

Commit

Permalink
f2fs: switch to fscrypt_prepare_setattr()
Browse files Browse the repository at this point in the history
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
ebiggers authored and Jaegeuk Kim committed Jan 3, 2018
1 parent 55899d7 commit 20bb247
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit 20bb247

Please sign in to comment.