@@ -930,7 +930,7 @@ struct dentry_operations {
char *(*d_dname)(struct dentry *, char *, int);
struct vfsmount *(*d_automount)(struct path *);
int (*d_manage)(struct dentry *, bool);
- struct dentry *(*d_real)(struct dentry *, struct inode *, unsigned int);
+ struct dentry *(*d_real)(struct dentry *, const struct inode *, unsigned int);
};
d_revalidate: called when the VFS needs to revalidate a dentry. This
@@ -831,15 +831,6 @@ char *file_path(struct file *filp, char *buf, int buflen)
}
EXPORT_SYMBOL(file_path);
-static struct dentry *open_select_dentry(struct dentry *dentry,
- unsigned int open_flags)
-{
- if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
- return dentry->d_op->d_real(dentry, NULL, open_flags);
- else
- return dentry;
-}
-
/**
* vfs_open - open the file at the given path
* @path: path to open
@@ -849,7 +840,7 @@ static struct dentry *open_select_dentry(struct dentry *dentry,
int vfs_open(const struct path *path, struct file *file,
const struct cred *cred)
{
- struct dentry *dentry = open_select_dentry(path->dentry, file->f_flags);
+ struct dentry *dentry = d_real(path->dentry, NULL, file->f_flags);
if (IS_ERR(dentry))
return PTR_ERR(dentry);
@@ -295,7 +295,8 @@ static void ovl_dentry_release(struct dentry *dentry)
}
}
-static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode,
+static struct dentry *ovl_d_real(struct dentry *dentry,
+ const struct inode *inode,
unsigned int open_flags)
{
struct dentry *real;
@@ -328,9 +329,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode,
return real;
/* Handle recursion */
- if (real->d_flags & DCACHE_OP_REAL)
- return real->d_op->d_real(real, inode, open_flags);
-
+ return d_real(real, inode, open_flags);
bug:
WARN(1, "ovl_d_real(%pd4, %s:%lu\n): real dentry not found\n", dentry,
inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);
@@ -160,7 +160,7 @@ struct dentry_operations {
char *(*d_dname)(struct dentry *, char *, int);
struct vfsmount *(*d_automount)(struct path *);
int (*d_manage)(struct dentry *, bool);
- struct dentry *(*d_real)(struct dentry *, struct inode *, unsigned int);
+ struct dentry *(*d_real)(struct dentry *, const struct inode *, unsigned int);
} ____cacheline_aligned;
/*
@@ -561,10 +561,12 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
* If dentry is on an union/overlay, then return the underlying, real dentry.
* Otherwise return the dentry itself.
*/
-static inline struct dentry *d_real(struct dentry *dentry)
+static inline struct dentry *d_real(struct dentry *dentry,
+ const struct inode *inode,
+ unsigned int flags)
{
if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
- return dentry->d_op->d_real(dentry, NULL, 0);
+ return dentry->d_op->d_real(dentry, inode, flags);
else
return dentry;
}
@@ -578,7 +580,7 @@ static inline struct dentry *d_real(struct dentry *dentry)
*/
static inline struct inode *d_real_inode(struct dentry *dentry)
{
- return d_backing_inode(d_real(dentry));
+ return d_backing_inode(d_real(dentry, NULL, 0));
}
@@ -1243,12 +1243,7 @@ static inline struct inode *file_inode(const struct file *f)
static inline struct dentry *file_dentry(const struct file *file)
{
- struct dentry *dentry = file->f_path.dentry;
-
- if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
- return dentry->d_op->d_real(dentry, file_inode(file), 0);
- else
- return dentry;
+ return d_real(file->f_path.dentry, file_inode(file), 0);
}
static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)