mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
ovl: let helper ovl_i_path_real() return the realinode
Let helper ovl_i_path_real() return the realinode to prepare for
checking non-null realinode in RCU walking path.
[msz] Use d_inode_rcu() since we are depending on the consitency
between dentry and inode being non-NULL in an RCU setting.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Fixes: ffa5723c6d
("ovl: store lower path in ovl_inode")
Cc: <stable@vger.kernel.org> # v5.19
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
858fd168a9
commit
b2dd05f107
@ -382,7 +382,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry);
|
|||||||
void ovl_path_upper(struct dentry *dentry, struct path *path);
|
void ovl_path_upper(struct dentry *dentry, struct path *path);
|
||||||
void ovl_path_lower(struct dentry *dentry, struct path *path);
|
void ovl_path_lower(struct dentry *dentry, struct path *path);
|
||||||
void ovl_path_lowerdata(struct dentry *dentry, struct path *path);
|
void ovl_path_lowerdata(struct dentry *dentry, struct path *path);
|
||||||
void ovl_i_path_real(struct inode *inode, struct path *path);
|
struct inode *ovl_i_path_real(struct inode *inode, struct path *path);
|
||||||
enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
|
enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
|
||||||
enum ovl_path_type ovl_path_realdata(struct dentry *dentry, struct path *path);
|
enum ovl_path_type ovl_path_realdata(struct dentry *dentry, struct path *path);
|
||||||
struct dentry *ovl_dentry_upper(struct dentry *dentry);
|
struct dentry *ovl_dentry_upper(struct dentry *dentry);
|
||||||
|
@ -250,7 +250,7 @@ struct dentry *ovl_i_dentry_upper(struct inode *inode)
|
|||||||
return ovl_upperdentry_dereference(OVL_I(inode));
|
return ovl_upperdentry_dereference(OVL_I(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ovl_i_path_real(struct inode *inode, struct path *path)
|
struct inode *ovl_i_path_real(struct inode *inode, struct path *path)
|
||||||
{
|
{
|
||||||
path->dentry = ovl_i_dentry_upper(inode);
|
path->dentry = ovl_i_dentry_upper(inode);
|
||||||
if (!path->dentry) {
|
if (!path->dentry) {
|
||||||
@ -259,6 +259,8 @@ void ovl_i_path_real(struct inode *inode, struct path *path)
|
|||||||
} else {
|
} else {
|
||||||
path->mnt = ovl_upper_mnt(OVL_FS(inode->i_sb));
|
path->mnt = ovl_upper_mnt(OVL_FS(inode->i_sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return path->dentry ? d_inode_rcu(path->dentry) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct inode *ovl_inode_upper(struct inode *inode)
|
struct inode *ovl_inode_upper(struct inode *inode)
|
||||||
@ -1105,8 +1107,7 @@ void ovl_copyattr(struct inode *inode)
|
|||||||
vfsuid_t vfsuid;
|
vfsuid_t vfsuid;
|
||||||
vfsgid_t vfsgid;
|
vfsgid_t vfsgid;
|
||||||
|
|
||||||
ovl_i_path_real(inode, &realpath);
|
realinode = ovl_i_path_real(inode, &realpath);
|
||||||
realinode = d_inode(realpath.dentry);
|
|
||||||
real_idmap = mnt_idmap(realpath.mnt);
|
real_idmap = mnt_idmap(realpath.mnt);
|
||||||
|
|
||||||
vfsuid = i_uid_into_vfsuid(real_idmap, realinode);
|
vfsuid = i_uid_into_vfsuid(real_idmap, realinode);
|
||||||
|
Loading…
Reference in New Issue
Block a user