Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f49d1e05 authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov
Browse files

ceph: handle LOOKUP_RCU in ceph_d_revalidate



We can now handle the snapshot cases under RCU, as well as the
non-snapshot case when we don't need to queue up a lease renewal
allow LOOKUP_RCU walks to proceed under those conditions.

Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-by: default avatarYan, Zheng <zyan@redhat.com>
parent 14fb9c9e
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -1214,15 +1214,19 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
	struct dentry *parent;
	struct dentry *parent;
	struct inode *dir;
	struct inode *dir;


	if (flags & LOOKUP_RCU)
	if (flags & LOOKUP_RCU) {
		parent = ACCESS_ONCE(dentry->d_parent);
		dir = d_inode_rcu(parent);
		if (!dir)
			return -ECHILD;
			return -ECHILD;
	} else {
		parent = dget_parent(dentry);
		dir = d_inode(parent);
	}


	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
	dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
	     dentry, d_inode(dentry), ceph_dentry(dentry)->offset);
	     dentry, d_inode(dentry), ceph_dentry(dentry)->offset);


	parent = dget_parent(dentry);
	dir = d_inode(parent);

	/* always trust cached snapped dentries, snapdir dentry */
	/* always trust cached snapped dentries, snapdir dentry */
	if (ceph_snap(dir) != CEPH_NOSNAP) {
	if (ceph_snap(dir) != CEPH_NOSNAP) {
		dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
		dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
@@ -1249,6 +1253,9 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
		struct ceph_mds_request *req;
		struct ceph_mds_request *req;
		int op, mask, err;
		int op, mask, err;


		if (flags & LOOKUP_RCU)
			return -ECHILD;

		op = ceph_snap(dir) == CEPH_SNAPDIR ?
		op = ceph_snap(dir) == CEPH_SNAPDIR ?
			CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_LOOKUP;
			CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_LOOKUP;
		req = ceph_mdsc_create_request(mdsc, op, USE_ANY_MDS);
		req = ceph_mdsc_create_request(mdsc, op, USE_ANY_MDS);
@@ -1284,6 +1291,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
		ceph_dir_clear_complete(dir);
		ceph_dir_clear_complete(dir);
	}
	}


	if (!(flags & LOOKUP_RCU))
		dput(parent);
		dput(parent);
	return valid;
	return valid;
}
}