Skip to content

Commit

Permalink
ceph: use READ_ONCE to access d_parent in RCU critical section
Browse files Browse the repository at this point in the history
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Yan, Zheng authored and Ilya Dryomov committed Jul 8, 2019
1 parent feab6ac commit 41883ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
struct inode *dir;

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);

if (!dir || dir->i_sb != mdsc->fsc->sb) {
Expand Down Expand Up @@ -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);
}
spin_unlock(&temp->d_lock);
temp = temp->d_parent;
temp = READ_ONCE(temp->d_parent);

/* Are we at the root? */
if (IS_ROOT(temp))
Expand Down

0 comments on commit 41883ba

Please sign in to comment.