mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 09:16:55 +07:00
vfs: add vfs_select_inode() helper
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Cc: <stable@vger.kernel.org> # v4.2+
This commit is contained in:
parent
44549e8f5e
commit
54d5ca871e
12
fs/open.c
12
fs/open.c
@ -840,16 +840,12 @@ EXPORT_SYMBOL(file_path);
|
|||||||
int vfs_open(const struct path *path, struct file *file,
|
int vfs_open(const struct path *path, struct file *file,
|
||||||
const struct cred *cred)
|
const struct cred *cred)
|
||||||
{
|
{
|
||||||
struct dentry *dentry = path->dentry;
|
struct inode *inode = vfs_select_inode(path->dentry, file->f_flags);
|
||||||
struct inode *inode = dentry->d_inode;
|
|
||||||
|
if (IS_ERR(inode))
|
||||||
|
return PTR_ERR(inode);
|
||||||
|
|
||||||
file->f_path = *path;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return do_dentry_open(file, inode, NULL, cred);
|
return do_dentry_open(file, inode, NULL, cred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,4 +565,16 @@ static inline struct dentry *d_real(struct dentry *dentry)
|
|||||||
return 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 */
|
#endif /* __LINUX_DCACHE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user