diff options
author | Eric Biggers <ebiggers@google.com> | 2017-11-29 21:35:28 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-01-03 04:27:28 +0100 |
commit | 2e168c82dc32e02c0d4774cbae4f07d98ff51649 (patch) | |
tree | 03254ecaab6fdd6ca61fe4c32beef02bce0cc850 /fs/f2fs/file.c | |
parent | posix_acl: convert posix_acl.a_refcount from atomic_t to refcount_t (diff) | |
download | linux-2e168c82dc32e02c0d4774cbae4f07d98ff51649.tar.xz linux-2e168c82dc32e02c0d4774cbae4f07d98ff51649.zip |
f2fs: switch to fscrypt_file_open()
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.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 84a011a522a1..ebe55d4793fb 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -472,22 +472,10 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma) static int f2fs_file_open(struct inode *inode, struct file *filp) { - struct dentry *dir; + int err = fscrypt_file_open(inode, filp); - if (f2fs_encrypted_inode(inode)) { - int ret = fscrypt_get_encryption_info(inode); - if (ret) - return -EACCES; - if (!fscrypt_has_encryption_key(inode)) - return -ENOKEY; - } - dir = dget_parent(file_dentry(filp)); - if (f2fs_encrypted_inode(d_inode(dir)) && - !fscrypt_has_permitted_context(d_inode(dir), inode)) { - dput(dir); - return -EPERM; - } - dput(dir); + if (err) + return err; return dquot_file_open(inode, filp); } |