Commit 894b3c35 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "Three CephFS fixes from Xiubo and Luis and a bunch of assorted
  cleanups"

* tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client:
  ceph: remove the incorrect Fw reference check when dirtying pages
  ceph: Remove empty definition in header file
  ceph: Fix typo in the comment
  ceph: fix a memory leak on cap_auths in MDS client
  ceph: flush all caps releases when syncing the whole filesystem
  ceph: rename ceph_flush_cap_releases() to ceph_flush_session_cap_releases()
  libceph: use min() to simplify code in ceph_dns_resolve_name()
  ceph: Convert to use jiffies macro
  ceph: Remove unused declarations
parents 9717d534 c08dfb1b
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)

	/* dirty the head */
	spin_lock(&ci->i_ceph_lock);
	BUG_ON(ci->i_wr_ref == 0); // caller should hold Fw reference
	if (__ceph_have_pending_cap_snap(ci)) {
		struct ceph_cap_snap *capsnap =
				list_last_entry(&ci->i_cap_snaps,
+26 −3
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/writeback.h>
#include <linux/iversion.h>
#include <linux/filelock.h>
#include <linux/jiffies.h>

#include "super.h"
#include "mds_client.h"
@@ -4149,7 +4150,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
		ceph_remove_cap(mdsc, cap, false);
		goto out_unlock;
	} else if (tsession) {
		/* add placeholder for the export tagert */
		/* add placeholder for the export target */
		int flag = (cap == ci->i_auth_cap) ? CEPH_CAP_FLAG_AUTH : 0;
		tcap = new_cap;
		ceph_add_cap(inode, tsession, t_cap_id, issued, 0,
@@ -4602,7 +4603,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
		__ceph_queue_cap_release(session, cap);
		spin_unlock(&session->s_cap_lock);
	}
	ceph_flush_cap_releases(mdsc, session);
	ceph_flush_session_cap_releases(mdsc, session);
	goto done;

bad:
@@ -4659,7 +4660,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
		 * slowness doesn't block mdsc delayed work,
		 * preventing send_renew_caps() from running.
		 */
		if (jiffies - loop_start >= 5 * HZ)
		if (time_after_eq(jiffies, loop_start + 5 * HZ))
			break;
	}
	spin_unlock(&mdsc->cap_delay_lock);
@@ -4701,6 +4702,28 @@ void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc)
	ceph_mdsc_iterate_sessions(mdsc, flush_dirty_session_caps, true);
}

/*
 * Flush all cap releases to the mds
 */
static void flush_cap_releases(struct ceph_mds_session *s)
{
	struct ceph_mds_client *mdsc = s->s_mdsc;
	struct ceph_client *cl = mdsc->fsc->client;

	doutc(cl, "begin\n");
	spin_lock(&s->s_cap_lock);
	if (s->s_num_cap_releases)
		ceph_flush_session_cap_releases(mdsc, s);
	spin_unlock(&s->s_cap_lock);
	doutc(cl, "done\n");

}

void ceph_flush_cap_releases(struct ceph_mds_client *mdsc)
{
	ceph_mdsc_iterate_sessions(mdsc, flush_cap_releases, true);
}

void __ceph_touch_fmode(struct ceph_inode_info *ci,
			struct ceph_mds_client *mdsc, int fmode)
{
+1 −1
Original line number Diff line number Diff line
@@ -2058,7 +2058,7 @@ static int ceph_d_delete(const struct dentry *dentry)
		return 0;
	if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
		return 0;
	/* vaild lease? */
	/* valid lease? */
	di = ceph_dentry(dentry);
	if (di) {
		if (__dentry_lease_is_valid(di))
+1 −1
Original line number Diff line number Diff line
@@ -1779,7 +1779,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
		if (err < 0)
			goto done;
	} else if (rinfo->head->is_dentry && req->r_dentry) {
		/* parent inode is not locked, be carefull */
		/* parent inode is not locked, be careful */
		struct ceph_vino *ptvino = NULL;
		dvino.ino = le64_to_cpu(rinfo->diri.in->ino);
		dvino.snap = le64_to_cpu(rinfo->diri.in->snapid);
+19 −6
Original line number Diff line number Diff line
@@ -2266,7 +2266,7 @@ int ceph_trim_caps(struct ceph_mds_client *mdsc,
		      trim_caps - remaining);
	}

	ceph_flush_cap_releases(mdsc, session);
	ceph_flush_session_cap_releases(mdsc, session);
	return 0;
}

@@ -2420,7 +2420,7 @@ static void ceph_cap_release_work(struct work_struct *work)
	ceph_put_mds_session(session);
}

void ceph_flush_cap_releases(struct ceph_mds_client *mdsc,
void ceph_flush_session_cap_releases(struct ceph_mds_client *mdsc,
		             struct ceph_mds_session *session)
{
	struct ceph_client *cl = mdsc->fsc->client;
@@ -2447,7 +2447,7 @@ void __ceph_queue_cap_release(struct ceph_mds_session *session,
	session->s_num_cap_releases++;

	if (!(session->s_num_cap_releases % CEPH_CAPS_PER_RELEASE))
		ceph_flush_cap_releases(session->s_mdsc, session);
		ceph_flush_session_cap_releases(session->s_mdsc, session);
}

static void ceph_cap_reclaim_work(struct work_struct *work)
@@ -4340,7 +4340,7 @@ static void handle_session(struct ceph_mds_session *session,
		/* flush cap releases */
		spin_lock(&session->s_cap_lock);
		if (session->s_num_cap_releases)
			ceph_flush_cap_releases(mdsc, session);
			ceph_flush_session_cap_releases(mdsc, session);
		spin_unlock(&session->s_cap_lock);

		send_flushmsg_ack(mdsc, session, seq);
@@ -4910,7 +4910,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc,
	} else {
		recon_state.msg_version = 2;
	}
	/* trsaverse this session's caps */
	/* traverse this session's caps */
	err = ceph_iterate_session_caps(session, reconnect_caps_cb, &recon_state);

	spin_lock(&session->s_cap_lock);
@@ -5446,7 +5446,7 @@ static void delayed_work(struct work_struct *work)
		}
		mutex_unlock(&mdsc->mutex);

		ceph_flush_cap_releases(mdsc, s);
		ceph_flush_session_cap_releases(mdsc, s);

		mutex_lock(&s->s_mutex);
		if (renew_caps)
@@ -5877,6 +5877,7 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)
	mutex_unlock(&mdsc->mutex);

	ceph_flush_dirty_caps(mdsc);
	ceph_flush_cap_releases(mdsc);
	spin_lock(&mdsc->cap_dirty_lock);
	want_flush = mdsc->last_cap_flush_tid;
	if (!list_empty(&mdsc->cap_flush_list)) {
@@ -6015,6 +6016,18 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
		ceph_mdsmap_destroy(mdsc->mdsmap);
	kfree(mdsc->sessions);
	ceph_caps_finalize(mdsc);

	if (mdsc->s_cap_auths) {
		int i;

		for (i = 0; i < mdsc->s_cap_auths_num; i++) {
			kfree(mdsc->s_cap_auths[i].match.gids);
			kfree(mdsc->s_cap_auths[i].match.path);
			kfree(mdsc->s_cap_auths[i].match.fs_name);
		}
		kfree(mdsc->s_cap_auths);
	}

	ceph_pool_perm_destroy(mdsc);
}

Loading