summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-05-11 01:16:37 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-10 23:55:01 -0400
commit54d5ca871e72f2bb172ec9323497f01cd5091ec7 (patch)
tree1fc2a5f3017793f70f32c88bc9fdbd8107ca7a99 /fs/open.c
parent44549e8f5eea4e0a41b487b63e616cb089922b99 (diff)
downloadlwn-54d5ca871e72f2bb172ec9323497f01cd5091ec7.tar.gz
lwn-54d5ca871e72f2bb172ec9323497f01cd5091ec7.zip
vfs: add vfs_select_inode() helper
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Cc: <stable@vger.kernel.org> # v4.2+
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/open.c b/fs/open.c
index 17cb6b1dab75..081d3d6df74b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -840,16 +840,12 @@ EXPORT_SYMBOL(file_path);
int vfs_open(const struct path *path, struct file *file,
const struct cred *cred)
{
- struct dentry *dentry = path->dentry;
- struct inode *inode = dentry->d_inode;
+ struct inode *inode = vfs_select_inode(path->dentry, file->f_flags);
- file->f_path = *path;
- if (dentry->d_flags & DCACHE_OP_SELECT_INODE) {
- inode = dentry->d_op->d_select_inode(dentry, file->f_flags);
- if (IS_ERR(inode))
- return PTR_ERR(inode);
- }
+ if (IS_ERR(inode))
+ return PTR_ERR(inode);
+ file->f_path = *path;
return do_dentry_open(file, inode, NULL, cred);
}