Commit b0dac61d authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Greg Kroah-Hartman

vfs: add vfs_select_inode() helper

commit 54d5ca87 upstream.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e54c41be
......@@ -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);
}
file->f_path = *path;
return do_dentry_open(file, inode, NULL, cred);
}
......
......@@ -592,4 +592,16 @@ static inline struct dentry *d_real(struct dentry *dentry)
return dentry;
}
static inline struct inode *vfs_select_inode(struct dentry *dentry,
unsigned open_flags)
{
struct inode *inode = d_inode(dentry);
if (inode && unlikely(dentry->d_flags & DCACHE_OP_SELECT_INODE))
inode = dentry->d_op->d_select_inode(dentry, open_flags);
return inode;
}
#endif /* __LINUX_DCACHE_H */
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