Commit 47a7ce62 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ceph-for-5.14-rc1' of git://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "We have new filesystem client metrics for reporting I/O sizes from
  Xiubo, two patchsets from Jeff that begin to untangle some heavyweight
  blocking locks in the filesystem and a bunch of code cleanups"

* tag 'ceph-for-5.14-rc1' of git://github.com/ceph/ceph-client:
  ceph: take reference to req->r_parent at point of assignment
  ceph: eliminate ceph_async_iput()
  ceph: don't take s_mutex in ceph_flush_snaps
  ceph: don't take s_mutex in try_flush_caps
  ceph: don't take s_mutex or snap_rwsem in ceph_check_caps
  ceph: eliminate session->s_gen_ttl_lock
  ceph: allow ceph_put_mds_session to take NULL or ERR_PTR
  ceph: clean up locking annotation for ceph_get_snap_realm and __lookup_snap_realm
  ceph: add some lockdep assertions around snaprealm handling
  ceph: decoding error in ceph_update_snap_realm should return -EIO
  ceph: add IO size metrics support
  ceph: update and rename __update_latency helper to __update_stdev
  ceph: simplify the metrics struct
  libceph: fix doc warnings in cls_lock_client.c
  libceph: remove unnecessary ret variable in ceph_auth_init()
  libceph: fix some spelling mistakes
  libceph: kill ceph_none_authorizer::reply_buf
  ceph: make ceph_queue_cap_snap static
  ceph: make ceph_netfs_read_ops static
  ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
parents 96890bc2 4c183472
Loading
Loading
Loading
Loading
+10 −16
Original line number Diff line number Diff line
@@ -82,10 +82,6 @@ static int ceph_set_page_dirty(struct page *page)
	struct inode *inode;
	struct ceph_inode_info *ci;
	struct ceph_snap_context *snapc;
	int ret;

	if (unlikely(!mapping))
		return !TestSetPageDirty(page);

	if (PageDirty(page)) {
		dout("%p set_page_dirty %p idx %lu -- already dirty\n",
@@ -130,11 +126,7 @@ static int ceph_set_page_dirty(struct page *page)
	BUG_ON(PagePrivate(page));
	attach_page_private(page, snapc);

	ret = __set_page_dirty_nobuffers(page);
	WARN_ON(!PageLocked(page));
	WARN_ON(!page->mapping);

	return ret;
	return __set_page_dirty_nobuffers(page);
}

/*
@@ -226,7 +218,7 @@ static void finish_netfs_read(struct ceph_osd_request *req)
	int err = req->r_result;

	ceph_update_read_metrics(&fsc->mdsc->metric, req->r_start_latency,
				 req->r_end_latency, err);
				 req->r_end_latency, osd_data->length, err);

	dout("%s: result %d subreq->len=%zu i_size=%lld\n", __func__, req->r_result,
	     subreq->len, i_size_read(req->r_inode));
@@ -313,7 +305,7 @@ static void ceph_readahead_cleanup(struct address_space *mapping, void *priv)
		ceph_put_cap_refs(ci, got);
}

const struct netfs_read_request_ops ceph_netfs_read_ops = {
static const struct netfs_read_request_ops ceph_netfs_read_ops = {
	.init_rreq		= ceph_init_rreq,
	.is_cache_enabled	= ceph_is_cache_enabled,
	.begin_cache_operation	= ceph_begin_cache_operation,
@@ -560,7 +552,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
		err = ceph_osdc_wait_request(osdc, req);

	ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
				  req->r_end_latency, err);
				  req->r_end_latency, len, err);

	ceph_osdc_put_request(req);
	if (err == 0)
@@ -635,6 +627,7 @@ static void writepages_finish(struct ceph_osd_request *req)
	struct ceph_snap_context *snapc = req->r_snapc;
	struct address_space *mapping = inode->i_mapping;
	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
	unsigned int len = 0;
	bool remove_page;

	dout("writepages_finish %p rc %d\n", inode, rc);
@@ -647,9 +640,6 @@ static void writepages_finish(struct ceph_osd_request *req)
		ceph_clear_error_write(ci);
	}

	ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
				  req->r_end_latency, rc);

	/*
	 * We lost the cache cap, need to truncate the page before
	 * it is unlocked, otherwise we'd truncate it later in the
@@ -666,6 +656,7 @@ static void writepages_finish(struct ceph_osd_request *req)

		osd_data = osd_req_op_extent_osd_data(req, i);
		BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
		len += osd_data->length;
		num_pages = calc_pages_for((u64)osd_data->alignment,
					   (u64)osd_data->length);
		total_pages += num_pages;
@@ -696,6 +687,9 @@ static void writepages_finish(struct ceph_osd_request *req)
		release_pages(osd_data->pages, num_pages);
	}

	ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
				  req->r_end_latency, len, rc);

	ceph_put_wrbuffer_cap_refs(ci, total_pages, snapc);

	osd_data = osd_req_op_extent_osd_data(req, 0);
@@ -1711,7 +1705,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
		err = ceph_osdc_wait_request(&fsc->client->osdc, req);

	ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
				  req->r_end_latency, err);
				  req->r_end_latency, len, err);

out_put:
	ceph_osdc_put_request(req);
+25 −100
Original line number Diff line number Diff line
@@ -645,9 +645,7 @@ void ceph_add_cap(struct inode *inode,
	dout("add_cap %p mds%d cap %llx %s seq %d\n", inode,
	     session->s_mds, cap_id, ceph_cap_string(issued), seq);

	spin_lock(&session->s_gen_ttl_lock);
	gen = session->s_cap_gen;
	spin_unlock(&session->s_gen_ttl_lock);
	gen = atomic_read(&session->s_cap_gen);

	cap = __get_cap_for_mds(ci, mds);
	if (!cap) {
@@ -785,10 +783,8 @@ static int __cap_is_valid(struct ceph_cap *cap)
	unsigned long ttl;
	u32 gen;

	spin_lock(&cap->session->s_gen_ttl_lock);
	gen = cap->session->s_cap_gen;
	gen = atomic_read(&cap->session->s_cap_gen);
	ttl = cap->session->s_cap_ttl;
	spin_unlock(&cap->session->s_gen_ttl_lock);

	if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) {
		dout("__cap_is_valid %p cap %p issued %s "
@@ -1182,7 +1178,8 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
	 * s_cap_gen while session is in the reconnect state.
	 */
	if (queue_release &&
	    (!session->s_cap_reconnect || cap->cap_gen == session->s_cap_gen)) {
	    (!session->s_cap_reconnect ||
	     cap->cap_gen == atomic_read(&session->s_cap_gen))) {
		cap->queue_release = 1;
		if (removed) {
			__ceph_queue_cap_release(session, cap);
@@ -1534,7 +1531,7 @@ static inline int __send_flush_snap(struct inode *inode,
 * asynchronously back to the MDS once sync writes complete and dirty
 * data is written out.
 *
 * Called under i_ceph_lock.  Takes s_mutex as needed.
 * Called under i_ceph_lock.
 */
static void __ceph_flush_snaps(struct ceph_inode_info *ci,
			       struct ceph_mds_session *session)
@@ -1656,7 +1653,6 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
	mds = ci->i_auth_cap->session->s_mds;
	if (session && session->s_mds != mds) {
		dout(" oops, wrong session %p mutex\n", session);
		mutex_unlock(&session->s_mutex);
		ceph_put_mds_session(session);
		session = NULL;
	}
@@ -1665,10 +1661,6 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
		mutex_lock(&mdsc->mutex);
		session = __ceph_lookup_mds_session(mdsc, mds);
		mutex_unlock(&mdsc->mutex);
		if (session) {
			dout(" inverting session/ino locks on %p\n", session);
			mutex_lock(&session->s_mutex);
		}
		goto retry;
	}

@@ -1680,12 +1672,10 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
out:
	spin_unlock(&ci->i_ceph_lock);

	if (psession) {
	if (psession)
		*psession = session;
	} else if (session) {
		mutex_unlock(&session->s_mutex);
	else
		ceph_put_mds_session(session);
	}
	/* we flushed them all; remove this inode from the queue */
	spin_lock(&mdsc->snap_flush_lock);
	list_del_init(&ci->i_snap_flush_item);
@@ -1915,7 +1905,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
	struct ceph_cap *cap;
	u64 flush_tid, oldest_flush_tid;
	int file_wanted, used, cap_used;
	int took_snap_rwsem = 0;             /* true if mdsc->snap_rwsem held */
	int issued, implemented, want, retain, revoking, flushing = 0;
	int mds = -1;   /* keep track of how far we've gone through i_caps list
			   to avoid an infinite loop on retry */
@@ -1923,14 +1912,13 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
	bool queue_invalidate = false;
	bool tried_invalidate = false;

	if (session)
		ceph_get_mds_session(session);

	spin_lock(&ci->i_ceph_lock);
	if (ci->i_ceph_flags & CEPH_I_FLUSH)
		flags |= CHECK_CAPS_FLUSH;

	goto retry_locked;
retry:
	spin_lock(&ci->i_ceph_lock);
retry_locked:
	/* Caps wanted by virtue of active open files. */
	file_wanted = __ceph_caps_file_wanted(ci);

@@ -2010,7 +1998,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
			ci->i_rdcache_revoking = ci->i_rdcache_gen;
		}
		tried_invalidate = true;
		goto retry_locked;
		goto retry;
	}

	for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) {
@@ -2024,8 +2012,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
		    ((flags & CHECK_CAPS_AUTHONLY) && cap != ci->i_auth_cap))
			continue;

		/* NOTE: no side-effects allowed, until we take s_mutex */

		/*
		 * If we have an auth cap, we don't need to consider any
		 * overlapping caps as used.
@@ -2088,37 +2074,8 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
			continue;     /* nope, all good */

ack:
		if (session && session != cap->session) {
			dout("oops, wrong session %p mutex\n", session);
			mutex_unlock(&session->s_mutex);
			session = NULL;
		}
		if (!session) {
			session = cap->session;
			if (mutex_trylock(&session->s_mutex) == 0) {
				dout("inverting session/ino locks on %p\n",
				     session);
				session = ceph_get_mds_session(session);
				spin_unlock(&ci->i_ceph_lock);
				if (took_snap_rwsem) {
					up_read(&mdsc->snap_rwsem);
					took_snap_rwsem = 0;
				}
				if (session) {
					mutex_lock(&session->s_mutex);
		ceph_put_mds_session(session);
				} else {
					/*
					 * Because we take the reference while
					 * holding the i_ceph_lock, it should
					 * never be NULL. Throw a warning if it
					 * ever is.
					 */
					WARN_ON_ONCE(true);
				}
				goto retry;
			}
		}
		session = ceph_get_mds_session(cap->session);

		/* kick flushing and flush snaps before sending normal
		 * cap message */
@@ -2130,21 +2087,8 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
			if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)
				__ceph_flush_snaps(ci, session);

			goto retry_locked;
		}

		/* take snap_rwsem after session mutex */
		if (!took_snap_rwsem) {
			if (down_read_trylock(&mdsc->snap_rwsem) == 0) {
				dout("inverting snap/in locks on %p\n",
				     inode);
				spin_unlock(&ci->i_ceph_lock);
				down_read(&mdsc->snap_rwsem);
				took_snap_rwsem = 1;
			goto retry;
		}
			took_snap_rwsem = 1;
		}

		if (cap == ci->i_auth_cap && ci->i_dirty_caps) {
			flushing = ci->i_dirty_caps;
@@ -2165,9 +2109,10 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,

		__prep_cap(&arg, cap, CEPH_CAP_OP_UPDATE, mflags, cap_used,
			   want, retain, flushing, flush_tid, oldest_flush_tid);
		spin_unlock(&ci->i_ceph_lock);

		spin_unlock(&ci->i_ceph_lock);
		__send_cap(&arg, ci);
		spin_lock(&ci->i_ceph_lock);

		goto retry; /* retake i_ceph_lock and restart our cap scan. */
	}
@@ -2182,13 +2127,9 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,

	spin_unlock(&ci->i_ceph_lock);

	ceph_put_mds_session(session);
	if (queue_invalidate)
		ceph_queue_invalidate(inode);

	if (session)
		mutex_unlock(&session->s_mutex);
	if (took_snap_rwsem)
		up_read(&mdsc->snap_rwsem);
}

/*
@@ -2198,26 +2139,17 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
{
	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
	struct ceph_inode_info *ci = ceph_inode(inode);
	struct ceph_mds_session *session = NULL;
	int flushing = 0;
	u64 flush_tid = 0, oldest_flush_tid = 0;

retry:
	spin_lock(&ci->i_ceph_lock);
retry_locked:
	if (ci->i_dirty_caps && ci->i_auth_cap) {
		struct ceph_cap *cap = ci->i_auth_cap;
		struct cap_msg_args arg;
		struct ceph_mds_session *session = cap->session;

		if (session != cap->session) {
			spin_unlock(&ci->i_ceph_lock);
			if (session)
				mutex_unlock(&session->s_mutex);
			session = cap->session;
			mutex_lock(&session->s_mutex);
			goto retry;
		}
		if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) {
		if (session->s_state < CEPH_MDS_SESSION_OPEN) {
			spin_unlock(&ci->i_ceph_lock);
			goto out;
		}
@@ -2254,9 +2186,6 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
		spin_unlock(&ci->i_ceph_lock);
	}
out:
	if (session)
		mutex_unlock(&session->s_mutex);

	*ptid = flush_tid;
	return flushing;
}
@@ -3213,8 +3142,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
	if (complete_capsnap)
		wake_up_all(&ci->i_cap_wq);
	while (put-- > 0) {
		/* avoid calling iput_final() in osd dispatch threads */
		ceph_async_iput(inode);
		iput(inode);
	}
}

@@ -3288,7 +3216,7 @@ static void handle_cap_grant(struct inode *inode,
	u64 size = le64_to_cpu(grant->size);
	u64 max_size = le64_to_cpu(grant->max_size);
	unsigned char check_caps = 0;
	bool was_stale = cap->cap_gen < session->s_cap_gen;
	bool was_stale = cap->cap_gen < atomic_read(&session->s_cap_gen);
	bool wake = false;
	bool writeback = false;
	bool queue_trunc = false;
@@ -3340,7 +3268,7 @@ static void handle_cap_grant(struct inode *inode,
	}

	/* side effects now are allowed */
	cap->cap_gen = session->s_cap_gen;
	cap->cap_gen = atomic_read(&session->s_cap_gen);
	cap->seq = seq;

	__check_cap_issue(ci, cap, newcaps);
@@ -3553,13 +3481,12 @@ static void handle_cap_grant(struct inode *inode,
	if (wake)
		wake_up_all(&ci->i_cap_wq);

	mutex_unlock(&session->s_mutex);
	if (check_caps == 1)
		ceph_check_caps(ci, CHECK_CAPS_AUTHONLY | CHECK_CAPS_NOINVAL,
				session);
	else if (check_caps == 2)
		ceph_check_caps(ci, CHECK_CAPS_NOINVAL, session);
	else
		mutex_unlock(&session->s_mutex);
}

/*
@@ -4203,8 +4130,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
	mutex_unlock(&session->s_mutex);
done_unlocked:
	ceph_put_string(extra_info.pool_ns);
	/* avoid calling iput_final() in mds dispatch threads */
	ceph_async_iput(inode);
	iput(inode);
	return;

flush_cap_releases:
@@ -4246,8 +4172,7 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
			spin_unlock(&mdsc->cap_delay_lock);
			dout("check_delayed_caps on %p\n", inode);
			ceph_check_caps(ci, 0, NULL);
			/* avoid calling iput_final() in tick thread */
			ceph_async_iput(inode);
			iput(inode);
			spin_lock(&mdsc->cap_delay_lock);
		}
	}
+33 −4
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static int mdsc_show(struct seq_file *s, void *p)
	return 0;
}

#define CEPH_METRIC_SHOW(name, total, avg, min, max, sq) {		\
#define CEPH_LAT_METRIC_SHOW(name, total, avg, min, max, sq) {		\
	s64 _total, _avg, _min, _max, _sq, _st;				\
	_avg = ktime_to_us(avg);					\
	_min = ktime_to_us(min == KTIME_MAX ? 0 : min);			\
@@ -140,6 +140,12 @@ static int mdsc_show(struct seq_file *s, void *p)
		   name, total, _avg, _min, _max, _st);			\
}

#define CEPH_SZ_METRIC_SHOW(name, total, avg, min, max, sum) {		\
	u64 _min = min == U64_MAX ? 0 : min;				\
	seq_printf(s, "%-14s%-12lld%-16llu%-16llu%-16llu%llu\n",	\
		   name, total, avg, _min, max, sum);			\
}

static int metric_show(struct seq_file *s, void *p)
{
	struct ceph_fs_client *fsc = s->private;
@@ -147,6 +153,7 @@ static int metric_show(struct seq_file *s, void *p)
	struct ceph_client_metric *m = &mdsc->metric;
	int nr_caps = 0;
	s64 total, sum, avg, min, max, sq;
	u64 sum_sz, avg_sz, min_sz, max_sz;

	sum = percpu_counter_sum(&m->total_inodes);
	seq_printf(s, "item                               total\n");
@@ -170,7 +177,7 @@ static int metric_show(struct seq_file *s, void *p)
	max = m->read_latency_max;
	sq = m->read_latency_sq_sum;
	spin_unlock(&m->read_metric_lock);
	CEPH_METRIC_SHOW("read", total, avg, min, max, sq);
	CEPH_LAT_METRIC_SHOW("read", total, avg, min, max, sq);

	spin_lock(&m->write_metric_lock);
	total = m->total_writes;
@@ -180,7 +187,7 @@ static int metric_show(struct seq_file *s, void *p)
	max = m->write_latency_max;
	sq = m->write_latency_sq_sum;
	spin_unlock(&m->write_metric_lock);
	CEPH_METRIC_SHOW("write", total, avg, min, max, sq);
	CEPH_LAT_METRIC_SHOW("write", total, avg, min, max, sq);

	spin_lock(&m->metadata_metric_lock);
	total = m->total_metadatas;
@@ -190,7 +197,29 @@ static int metric_show(struct seq_file *s, void *p)
	max = m->metadata_latency_max;
	sq = m->metadata_latency_sq_sum;
	spin_unlock(&m->metadata_metric_lock);
	CEPH_METRIC_SHOW("metadata", total, avg, min, max, sq);
	CEPH_LAT_METRIC_SHOW("metadata", total, avg, min, max, sq);

	seq_printf(s, "\n");
	seq_printf(s, "item          total       avg_sz(bytes)   min_sz(bytes)   max_sz(bytes)  total_sz(bytes)\n");
	seq_printf(s, "----------------------------------------------------------------------------------------\n");

	spin_lock(&m->read_metric_lock);
	total = m->total_reads;
	sum_sz = m->read_size_sum;
	avg_sz = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum_sz, total) : 0;
	min_sz = m->read_size_min;
	max_sz = m->read_size_max;
	spin_unlock(&m->read_metric_lock);
	CEPH_SZ_METRIC_SHOW("read", total, avg_sz, min_sz, max_sz, sum_sz);

	spin_lock(&m->write_metric_lock);
	total = m->total_writes;
	sum_sz = m->write_size_sum;
	avg_sz = total > 0 ? DIV64_U64_ROUND_CLOSEST(sum_sz, total) : 0;
	min_sz = m->write_size_min;
	max_sz = m->write_size_max;
	spin_unlock(&m->write_metric_lock);
	CEPH_SZ_METRIC_SHOW("write", total, avg_sz, min_sz, max_sz, sum_sz);

	seq_printf(s, "\n");
	seq_printf(s, "item          total           miss            hit\n");
+11 −5
Original line number Diff line number Diff line
@@ -788,6 +788,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
		mask |= CEPH_CAP_XATTR_SHARED;
	req->r_args.getattr.mask = cpu_to_le32(mask);

	ihold(dir);
	req->r_parent = dir;
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	err = ceph_mdsc_do_request(mdsc, NULL, req);
@@ -868,6 +869,7 @@ static int ceph_mknod(struct user_namespace *mnt_userns, struct inode *dir,
	req->r_dentry = dget(dentry);
	req->r_num_caps = 2;
	req->r_parent = dir;
	ihold(dir);
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_args.mknod.mode = cpu_to_le32(mode);
	req->r_args.mknod.rdev = cpu_to_le32(rdev);
@@ -929,6 +931,8 @@ static int ceph_symlink(struct user_namespace *mnt_userns, struct inode *dir,
		goto out;
	}
	req->r_parent = dir;
	ihold(dir);

	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_dentry = dget(dentry);
	req->r_num_caps = 2;
@@ -993,6 +997,7 @@ static int ceph_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
	req->r_dentry = dget(dentry);
	req->r_num_caps = 2;
	req->r_parent = dir;
	ihold(dir);
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_args.mkdir.mode = cpu_to_le32(mode);
	req->r_dentry_drop = CEPH_CAP_FILE_SHARED | CEPH_CAP_AUTH_EXCL;
@@ -1037,6 +1042,7 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,
	req->r_num_caps = 2;
	req->r_old_dentry = dget(old_dentry);
	req->r_parent = dir;
	ihold(dir);
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_dentry_drop = CEPH_CAP_FILE_SHARED;
	req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
@@ -1158,6 +1164,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
	req->r_dentry = dget(dentry);
	req->r_num_caps = 2;
	req->r_parent = dir;
	ihold(dir);
	req->r_dentry_drop = CEPH_CAP_FILE_SHARED;
	req->r_dentry_unless = CEPH_CAP_FILE_EXCL;
	req->r_inode_drop = ceph_drop_caps_for_unlink(inode);
@@ -1232,6 +1239,7 @@ static int ceph_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
	req->r_old_dentry = dget(old_dentry);
	req->r_old_dentry_dir = old_dir;
	req->r_parent = new_dir;
	ihold(new_dir);
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_old_dentry_drop = CEPH_CAP_FILE_SHARED;
	req->r_old_dentry_unless = CEPH_CAP_FILE_EXCL;
@@ -1548,10 +1556,8 @@ static bool __dentry_lease_is_valid(struct ceph_dentry_info *di)
		u32 gen;
		unsigned long ttl;

		spin_lock(&session->s_gen_ttl_lock);
		gen = session->s_cap_gen;
		gen = atomic_read(&session->s_cap_gen);
		ttl = session->s_cap_ttl;
		spin_unlock(&session->s_gen_ttl_lock);

		if (di->lease_gen == gen &&
		    time_before(jiffies, ttl) &&
@@ -1730,6 +1736,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
			req->r_dentry = dget(dentry);
			req->r_num_caps = 2;
			req->r_parent = dir;
			ihold(dir);

			mask = CEPH_STAT_CAP_INODE | CEPH_CAP_AUTH_SHARED;
			if (ceph_security_xattr_wanted(dir))
@@ -1809,7 +1816,6 @@ static void ceph_d_release(struct dentry *dentry)
	dentry->d_fsdata = NULL;
	spin_unlock(&dentry->d_lock);

	if (di->lease_session)
	ceph_put_mds_session(di->lease_session);
	kmem_cache_free(ceph_dentry_cachep, di);
}
+1 −0
Original line number Diff line number Diff line
@@ -542,6 +542,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
	ihold(inode);
	req->r_ino2 = ceph_vino(d_inode(parent));
	req->r_parent = d_inode(parent);
	ihold(req->r_parent);
	set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags);
	req->r_num_caps = 2;
	err = ceph_mdsc_do_request(mdsc, NULL, req);
Loading