Commit 41883ba8 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: use READ_ONCE to access d_parent in RCU critical section

Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent feab6ac2
...@@ -913,7 +913,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc, ...@@ -913,7 +913,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
struct inode *dir; struct inode *dir;
rcu_read_lock(); rcu_read_lock();
parent = req->r_dentry->d_parent; parent = READ_ONCE(req->r_dentry->d_parent);
dir = req->r_parent ? : d_inode_rcu(parent); dir = req->r_parent ? : d_inode_rcu(parent);
if (!dir || dir->i_sb != mdsc->fsc->sb) { if (!dir || dir->i_sb != mdsc->fsc->sb) {
...@@ -2145,7 +2145,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, ...@@ -2145,7 +2145,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase,
memcpy(path + pos, temp->d_name.name, temp->d_name.len); memcpy(path + pos, temp->d_name.name, temp->d_name.len);
} }
spin_unlock(&temp->d_lock); spin_unlock(&temp->d_lock);
temp = temp->d_parent; temp = READ_ONCE(temp->d_parent);
/* Are we at the root? */ /* Are we at the root? */
if (IS_ROOT(temp)) if (IS_ROOT(temp))
......
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