public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ceph: correct ceph_mds_cap_item field name
@ 2024-10-13  1:16 Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 1/2] ceph: requalify some char pointers as const Patrick Donnelly
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-13  1:16 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov
  Cc: Patrick Donnelly, Patrick Donnelly, ceph-devel, linux-kernel

The issue_seq is sent with bulk cap releases, not the current sequence number.

See also ceph.git commit: "include/ceph_fs: correct ceph_mds_cap_item field name".

See-also: https://tracker.ceph.com/issues/66704
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/mds_client.c         | 2 +-
 include/linux/ceph/ceph_fs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index c4a5fd94bbbb..0be82de8a6da 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2362,7 +2362,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
 		item->ino = cpu_to_le64(cap->cap_ino);
 		item->cap_id = cpu_to_le64(cap->cap_id);
 		item->migrate_seq = cpu_to_le32(cap->mseq);
-		item->seq = cpu_to_le32(cap->issue_seq);
+		item->issue_seq = cpu_to_le32(cap->issue_seq);
 		msg->front.iov_len += sizeof(*item);
 
 		ceph_put_cap(mdsc, cap);
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index ee1d0e5f9789..4ff3ad5e9210 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -822,7 +822,7 @@ struct ceph_mds_cap_release {
 struct ceph_mds_cap_item {
 	__le64 ino;
 	__le64 cap_id;
-	__le32 migrate_seq, seq;
+	__le32 migrate_seq, issue_seq;
 } __attribute__ ((packed));
 
 #define CEPH_MDS_LEASE_REVOKE           1  /*    mds  -> client */

base-commit: 75b607fab38d149f232f01eae5e6392b394dd659
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/2] ceph: requalify some char pointers as const
  2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
@ 2024-10-13  1:16 ` Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 2/3] ceph: correct ceph_mds_cap_peer field name Patrick Donnelly
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-13  1:16 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov; +Cc: Patrick Donnelly, ceph-devel, linux-kernel

From: Patrick Donnelly <pdonnell@redhat.com>

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 73f321b52895..42bdbe5b7ef9 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -286,7 +286,7 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	struct ceph_fsid fsid;
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
 	struct ceph_mount_options *fsopt = pctx->opts;
-	char *fsid_start, *fs_name_start;
+	const char *fsid_start, *fs_name_start;
 
 	if (*dev_name_end != '=') {
 		dout("separator '=' missing in source");

base-commit: 7234e2ea0edd00bfb6bb2159e55878c19885ce68
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ceph: correct ceph_mds_cap_peer field name
  2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 1/2] ceph: requalify some char pointers as const Patrick Donnelly
@ 2024-10-13  1:16 ` Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 2/2] ceph: extract entity name from device id Patrick Donnelly
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-13  1:16 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov
  Cc: Patrick Donnelly, Patrick Donnelly, ceph-devel, linux-kernel

See also ceph.git commit: "include/ceph_fs: correct ceph_mds_cap_peer field name".

See-also: https://tracker.ceph.com/issues/66704
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/caps.c               | 23 ++++++++++++-----------
 include/linux/ceph/ceph_fs.h |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index bed34fc11c91..88a674cf27a8 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -4086,17 +4086,17 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	u64 t_cap_id;
 	unsigned mseq = le32_to_cpu(ex->migrate_seq);
-	unsigned t_seq, t_mseq;
+	unsigned t_issue_seq, t_mseq;
 	int target, issued;
 	int mds = session->s_mds;
 
 	if (ph) {
 		t_cap_id = le64_to_cpu(ph->cap_id);
-		t_seq = le32_to_cpu(ph->seq);
+		t_issue_seq = le32_to_cpu(ph->issue_seq);
 		t_mseq = le32_to_cpu(ph->mseq);
 		target = le32_to_cpu(ph->mds);
 	} else {
-		t_cap_id = t_seq = t_mseq = 0;
+		t_cap_id = t_issue_seq = t_mseq = 0;
 		target = -1;
 	}
 
@@ -4134,12 +4134,12 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 	if (tcap) {
 		/* already have caps from the target */
 		if (tcap->cap_id == t_cap_id &&
-		    ceph_seq_cmp(tcap->seq, t_seq) < 0) {
+		    ceph_seq_cmp(tcap->seq, t_issue_seq) < 0) {
 			doutc(cl, " updating import cap %p mds%d\n", tcap,
 			      target);
 			tcap->cap_id = t_cap_id;
-			tcap->seq = t_seq - 1;
-			tcap->issue_seq = t_seq - 1;
+			tcap->seq = t_issue_seq - 1;
+			tcap->issue_seq = t_issue_seq - 1;
 			tcap->issued |= issued;
 			tcap->implemented |= issued;
 			if (cap == ci->i_auth_cap) {
@@ -4154,7 +4154,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 		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,
-			     t_seq - 1, t_mseq, (u64)-1, flag, &new_cap);
+			     t_issue_seq - 1, t_mseq, (u64)-1, flag, &new_cap);
 
 		if (!list_empty(&ci->i_cap_flush_list) &&
 		    ci->i_auth_cap == tcap) {
@@ -4268,14 +4268,14 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
 		doutc(cl, " remove export cap %p mds%d flags %d\n",
 		      ocap, peer, ph->flags);
 		if ((ph->flags & CEPH_CAP_FLAG_AUTH) &&
-		    (ocap->seq != le32_to_cpu(ph->seq) ||
+		    (ocap->seq != le32_to_cpu(ph->issue_seq) ||
 		     ocap->mseq != le32_to_cpu(ph->mseq))) {
 			pr_err_ratelimited_client(cl, "mismatched seq/mseq: "
 					"%p %llx.%llx mds%d seq %d mseq %d"
 					" importer mds%d has peer seq %d mseq %d\n",
 					inode, ceph_vinop(inode), peer,
 					ocap->seq, ocap->mseq, mds,
-					le32_to_cpu(ph->seq),
+					le32_to_cpu(ph->issue_seq),
 					le32_to_cpu(ph->mseq));
 		}
 		ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
@@ -4350,7 +4350,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 	struct ceph_snap_realm *realm = NULL;
 	int op;
 	int msg_version = le16_to_cpu(msg->hdr.version);
-	u32 seq, mseq;
+	u32 seq, mseq, issue_seq;
 	struct ceph_vino vino;
 	void *snaptrace;
 	size_t snaptrace_len;
@@ -4375,6 +4375,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 	vino.snap = CEPH_NOSNAP;
 	seq = le32_to_cpu(h->seq);
 	mseq = le32_to_cpu(h->migrate_seq);
+	issue_seq = le32_to_cpu(h->issue_seq);
 
 	snaptrace = h + 1;
 	snaptrace_len = le32_to_cpu(h->snap_trace_len);
@@ -4598,7 +4599,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 		cap->cap_id = le64_to_cpu(h->cap_id);
 		cap->mseq = mseq;
 		cap->seq = seq;
-		cap->issue_seq = seq;
+		cap->issue_seq = issue_seq;
 		spin_lock(&session->s_cap_lock);
 		__ceph_queue_cap_release(session, cap);
 		spin_unlock(&session->s_cap_lock);
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 4ff3ad5e9210..2d7d86f0290d 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -808,7 +808,7 @@ struct ceph_mds_caps {
 
 struct ceph_mds_cap_peer {
 	__le64 cap_id;
-	__le32 seq;
+	__le32 issue_seq;
 	__le32 mseq;
 	__le32 mds;
 	__u8   flags;
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ceph: extract entity name from device id
  2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 1/2] ceph: requalify some char pointers as const Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 2/3] ceph: correct ceph_mds_cap_peer field name Patrick Donnelly
@ 2024-10-13  1:16 ` Patrick Donnelly
  2024-10-13  1:16 ` [PATCH 3/3] ceph: improve caps debugging output Patrick Donnelly
  2024-10-14  0:57 ` [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Xiubo Li
  4 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-13  1:16 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov; +Cc: Patrick Donnelly, ceph-devel, linux-kernel

From: Patrick Donnelly <pdonnell@redhat.com>

Previously, the "name" in the new device syntax "<name>@<fsid>.<fsname>" was
ignored because (presumably) tests were done using mount.ceph which also passed
the entity name using "-o name=foo". If mounting is done without the mount.ceph
helper, the new device id syntax fails to set the name properly.

Resolves: https://tracker.ceph.com/issues/68516
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 42bdbe5b7ef9..de03cd6eb86e 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -285,7 +285,9 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	size_t len;
 	struct ceph_fsid fsid;
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
+	struct ceph_options *opts = pctx->copts;
 	struct ceph_mount_options *fsopt = pctx->opts;
+	const char *name_start = dev_name;
 	const char *fsid_start, *fs_name_start;
 
 	if (*dev_name_end != '=') {
@@ -296,8 +298,14 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	fsid_start = strchr(dev_name, '@');
 	if (!fsid_start)
 		return invalfc(fc, "missing cluster fsid");
-	++fsid_start; /* start of cluster fsid */
+	len = fsid_start - name_start;
+	kfree(opts->name);
+	opts->name = kstrndup(name_start, len, GFP_KERNEL);
+	if (!opts->name)
+		return -ENOMEM;
+	dout("using %s entity name", opts->name);
 
+	++fsid_start; /* start of cluster fsid */
 	fs_name_start = strchr(fsid_start, '.');
 	if (!fs_name_start)
 		return invalfc(fc, "missing file system name");
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ceph: improve caps debugging output
  2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
                   ` (2 preceding siblings ...)
  2024-10-13  1:16 ` [PATCH 2/2] ceph: extract entity name from device id Patrick Donnelly
@ 2024-10-13  1:16 ` Patrick Donnelly
  2024-10-14  0:57 ` [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Xiubo Li
  4 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-13  1:16 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov; +Cc: Patrick Donnelly, ceph-devel, linux-kernel

From: Patrick Donnelly <pdonnell@redhat.com>

This improves uniformity and exposes important sequence numbers.

Now looks like:

    <7>[   73.749563] ceph:           caps.c:4465 : [c9653bca-110b-4f70-9f84-5a195b205e9a 15290]  caps mds2 op export ino 20000000000.fffffffffffffffe inode 0000000008d2e5ea seq 0 iseq 0 mseq 0
    ...
    <7>[   73.749574] ceph:           caps.c:4102 : [c9653bca-110b-4f70-9f84-5a195b205e9a 15290]  cap 20000000000.fffffffffffffffe export to peer 1 piseq 1 pmseq 1
    ...
    <7>[   73.749645] ceph:           caps.c:4465 : [c9653bca-110b-4f70-9f84-5a195b205e9a 15290]  caps mds1 op import ino 20000000000.fffffffffffffffe inode 0000000008d2e5ea seq 1 iseq 1 mseq 1
    ...
    <7>[   73.749681] ceph:           caps.c:4244 : [c9653bca-110b-4f70-9f84-5a195b205e9a 15290]  cap 20000000000.fffffffffffffffe import from peer 2 piseq 686 pmseq 0
    ...
    <7>[  248.645596] ceph:           caps.c:4465 : [c9653bca-110b-4f70-9f84-5a195b205e9a 15290]  caps mds1 op revoke ino 20000000000.fffffffffffffffe inode 0000000008d2e5ea seq 2538 iseq 1 mseq 1

See also: "mds: add issue_seq to all cap messages" in ceph.git

See-also: https://tracker.ceph.com/issues/66704
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/caps.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 88a674cf27a8..74ba310dfcc7 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -4085,8 +4085,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 	struct ceph_cap *cap, *tcap, *new_cap = NULL;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	u64 t_cap_id;
-	unsigned mseq = le32_to_cpu(ex->migrate_seq);
-	unsigned t_issue_seq, t_mseq;
+	u32 t_issue_seq, t_mseq;
 	int target, issued;
 	int mds = session->s_mds;
 
@@ -4100,8 +4099,8 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 		target = -1;
 	}
 
-	doutc(cl, "%p %llx.%llx ci %p mds%d mseq %d target %d\n",
-	      inode, ceph_vinop(inode), ci, mds, mseq, target);
+	doutc(cl, " cap %llx.%llx export to peer %d piseq %u pmseq %u\n",
+	      ceph_vinop(inode), target, t_issue_seq, t_mseq);
 retry:
 	down_read(&mdsc->snap_rwsem);
 	spin_lock(&ci->i_ceph_lock);
@@ -4228,18 +4227,22 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
 	u64 realmino = le64_to_cpu(im->realm);
 	u64 cap_id = le64_to_cpu(im->cap_id);
 	u64 p_cap_id;
+	u32 piseq = 0;
+	u32 pmseq = 0;
 	int peer;
 
 	if (ph) {
 		p_cap_id = le64_to_cpu(ph->cap_id);
 		peer = le32_to_cpu(ph->mds);
+		piseq = le32_to_cpu(ph->issue_seq);
+		pmseq = le32_to_cpu(ph->mseq);
 	} else {
 		p_cap_id = 0;
 		peer = -1;
 	}
 
-	doutc(cl, "%p %llx.%llx ci %p mds%d mseq %d peer %d\n",
-	      inode, ceph_vinop(inode), ci, mds, mseq, peer);
+	doutc(cl, " cap %llx.%llx import from peer %d piseq %u pmseq %u\n",
+	      ceph_vinop(inode), peer, piseq, pmseq);
 retry:
 	cap = __get_cap_for_mds(ci, mds);
 	if (!cap) {
@@ -4268,15 +4271,13 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
 		doutc(cl, " remove export cap %p mds%d flags %d\n",
 		      ocap, peer, ph->flags);
 		if ((ph->flags & CEPH_CAP_FLAG_AUTH) &&
-		    (ocap->seq != le32_to_cpu(ph->issue_seq) ||
-		     ocap->mseq != le32_to_cpu(ph->mseq))) {
+		    (ocap->seq != piseq ||
+		     ocap->mseq != pmseq)) {
 			pr_err_ratelimited_client(cl, "mismatched seq/mseq: "
 					"%p %llx.%llx mds%d seq %d mseq %d"
 					" importer mds%d has peer seq %d mseq %d\n",
 					inode, ceph_vinop(inode), peer,
-					ocap->seq, ocap->mseq, mds,
-					le32_to_cpu(ph->issue_seq),
-					le32_to_cpu(ph->mseq));
+					ocap->seq, ocap->mseq, mds, piseq, pmseq);
 		}
 		ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
 	}
@@ -4360,8 +4361,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 	bool close_sessions = false;
 	bool do_cap_release = false;
 
-	doutc(cl, "from mds%d\n", session->s_mds);
-
 	if (!ceph_inc_mds_stopping_blocker(mdsc, session))
 		return;
 
@@ -4463,12 +4462,11 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 
 	/* lookup ino */
 	inode = ceph_find_inode(mdsc->fsc->sb, vino);
-	doutc(cl, " op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op),
-	      vino.ino, vino.snap, inode);
+	doutc(cl, " caps mds%d op %s ino %llx.%llx inode %p seq %u iseq %u mseq %u\n",
+          session->s_mds, ceph_cap_op_name(op), vino.ino, vino.snap, inode,
+          seq, issue_seq, mseq);
 
 	mutex_lock(&session->s_mutex);
-	doutc(cl, " mds%d seq %lld cap seq %u\n", session->s_mds,
-	      session->s_seq, (unsigned)seq);
 
 	if (!inode) {
 		doutc(cl, " i don't have ino %llx\n", vino.ino);
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ceph: correct ceph_mds_cap_item field name
  2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
                   ` (3 preceding siblings ...)
  2024-10-13  1:16 ` [PATCH 3/3] ceph: improve caps debugging output Patrick Donnelly
@ 2024-10-14  0:57 ` Xiubo Li
  2024-10-21 13:51   ` Patrick Donnelly
  4 siblings, 1 reply; 8+ messages in thread
From: Xiubo Li @ 2024-10-14  0:57 UTC (permalink / raw)
  To: Patrick Donnelly, Ilya Dryomov; +Cc: Patrick Donnelly, ceph-devel, linux-kernel

Hi Patrick,

Thanks for your patches.

BTW, I think this should be the V2, right ?

Then could you explain what's the difference between V1 and V2 ?Usually 
we will add this in the cover-letter.

And also we will add a version tag from the second version of the patch 
series, which is something like:

   [PATCH v2 0/3]
   [PATCH v2 1/3]
   ...
   [PATCH v2 3/3]

At the same time please add a cover-letter if there are more than 1 
patch in the series, which will be the '[PATCH 0/3]', and you can 
generate it by using the '--cover-letter' option:

   $ git patch-format -3 --cover-letter

Please note that in the cover-letter patch you need to add the title, a 
summary about this series and certainly a comment about the changes from 
the last version manually. One example about this please see 
https://lore.kernel.org/all/20240418142019.133191-1-xiubli@redhat.com/.

If there is only one patch in the series, then the cover-letter is not a 
must and you can just do it likes: 
https://patchwork.kernel.org/project/ceph-devel/patch/20240314073915.844541-1-xiubli@redhat.com/,

Thanks

- Xiubo


On 10/13/24 09:16, Patrick Donnelly wrote:
> The issue_seq is sent with bulk cap releases, not the current sequence number.
>
> See also ceph.git commit: "include/ceph_fs: correct ceph_mds_cap_item field name".
>
> See-also: https://tracker.ceph.com/issues/66704
> Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
> ---
>   fs/ceph/mds_client.c         | 2 +-
>   include/linux/ceph/ceph_fs.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index c4a5fd94bbbb..0be82de8a6da 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -2362,7 +2362,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
>   		item->ino = cpu_to_le64(cap->cap_ino);
>   		item->cap_id = cpu_to_le64(cap->cap_id);
>   		item->migrate_seq = cpu_to_le32(cap->mseq);
> -		item->seq = cpu_to_le32(cap->issue_seq);
> +		item->issue_seq = cpu_to_le32(cap->issue_seq);
>   		msg->front.iov_len += sizeof(*item);
>   
>   		ceph_put_cap(mdsc, cap);
> diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> index ee1d0e5f9789..4ff3ad5e9210 100644
> --- a/include/linux/ceph/ceph_fs.h
> +++ b/include/linux/ceph/ceph_fs.h
> @@ -822,7 +822,7 @@ struct ceph_mds_cap_release {
>   struct ceph_mds_cap_item {
>   	__le64 ino;
>   	__le64 cap_id;
> -	__le32 migrate_seq, seq;
> +	__le32 migrate_seq, issue_seq;
>   } __attribute__ ((packed));
>   
>   #define CEPH_MDS_LEASE_REVOKE           1  /*    mds  -> client */
>
> base-commit: 75b607fab38d149f232f01eae5e6392b394dd659


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ceph: extract entity name from device id
  2024-10-14 13:46 [PATCH 0/2] ceph: use entity name from new device string Patrick Donnelly
@ 2024-10-14 13:46 ` Patrick Donnelly
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-14 13:46 UTC (permalink / raw)
  To: Xiubo Li, Ilya Dryomov
  Cc: Patrick Donnelly, stable,
	open list:CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH), open list

From: Patrick Donnelly <pdonnell@redhat.com>

Previously, the "name" in the new device syntax "<name>@<fsid>.<fsname>" was
ignored because (presumably) tests were done using mount.ceph which also passed
the entity name using "-o name=foo". If mounting is done without the mount.ceph
helper, the new device id syntax fails to set the name properly.

Cc: stable@vger.kernel.org
Resolves: https://tracker.ceph.com/issues/68516
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
---
 fs/ceph/super.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 42bdbe5b7ef9..de03cd6eb86e 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -285,7 +285,9 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	size_t len;
 	struct ceph_fsid fsid;
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
+	struct ceph_options *opts = pctx->copts;
 	struct ceph_mount_options *fsopt = pctx->opts;
+	const char *name_start = dev_name;
 	const char *fsid_start, *fs_name_start;
 
 	if (*dev_name_end != '=') {
@@ -296,8 +298,14 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end,
 	fsid_start = strchr(dev_name, '@');
 	if (!fsid_start)
 		return invalfc(fc, "missing cluster fsid");
-	++fsid_start; /* start of cluster fsid */
+	len = fsid_start - name_start;
+	kfree(opts->name);
+	opts->name = kstrndup(name_start, len, GFP_KERNEL);
+	if (!opts->name)
+		return -ENOMEM;
+	dout("using %s entity name", opts->name);
 
+	++fsid_start; /* start of cluster fsid */
 	fs_name_start = strchr(fsid_start, '.');
 	if (!fs_name_start)
 		return invalfc(fc, "missing file system name");
-- 
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ceph: correct ceph_mds_cap_item field name
  2024-10-14  0:57 ` [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Xiubo Li
@ 2024-10-21 13:51   ` Patrick Donnelly
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Donnelly @ 2024-10-21 13:51 UTC (permalink / raw)
  To: Xiubo Li; +Cc: Patrick Donnelly, Ilya Dryomov, ceph-devel, linux-kernel

Hi Xiubo,

On Sun, Oct 13, 2024 at 8:57 PM Xiubo Li <xiubli@redhat.com> wrote:
>
> Hi Patrick,
>
> Thanks for your patches.
>
> BTW, I think this should be the V2, right ?
>
> Then could you explain what's the difference between V1 and V2 ?Usually
> we will add this in the cover-letter.

There's no difference. These patches accidentally got picked up with
the other set I sent out (I already sent a new series for that set:
"ceph: use entity name from new device string"). These are the three
patches:

https://lore.kernel.org/ceph-devel/20241012235529.520289-1-batrick@batbytes.com/T/#r691410e455d5b10da617880b91a6c45703ff764e

I can resend in a new series if you like.


> And also we will add a version tag from the second version of the patch
> series, which is something like:
>
>    [PATCH v2 0/3]
>    [PATCH v2 1/3]
>    ...
>    [PATCH v2 3/3]
>
> At the same time please add a cover-letter if there are more than 1
> patch in the series, which will be the '[PATCH 0/3]', and you can
> generate it by using the '--cover-letter' option:
>
>    $ git patch-format -3 --cover-letter
>
> Please note that in the cover-letter patch you need to add the title, a
> summary about this series and certainly a comment about the changes from
> the last version manually. One example about this please see
> https://lore.kernel.org/all/20240418142019.133191-1-xiubli@redhat.com/.
>
> If there is only one patch in the series, then the cover-letter is not a
> must and you can just do it likes:
> https://patchwork.kernel.org/project/ceph-devel/patch/20240314073915.844541-1-xiubli@redhat.com/,
>
> Thanks
>
> - Xiubo
>
>
> On 10/13/24 09:16, Patrick Donnelly wrote:
> > The issue_seq is sent with bulk cap releases, not the current sequence number.
> >
> > See also ceph.git commit: "include/ceph_fs: correct ceph_mds_cap_item field name".
> >
> > See-also: https://tracker.ceph.com/issues/66704
> > Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
> > ---
> >   fs/ceph/mds_client.c         | 2 +-
> >   include/linux/ceph/ceph_fs.h | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> > index c4a5fd94bbbb..0be82de8a6da 100644
> > --- a/fs/ceph/mds_client.c
> > +++ b/fs/ceph/mds_client.c
> > @@ -2362,7 +2362,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
> >               item->ino = cpu_to_le64(cap->cap_ino);
> >               item->cap_id = cpu_to_le64(cap->cap_id);
> >               item->migrate_seq = cpu_to_le32(cap->mseq);
> > -             item->seq = cpu_to_le32(cap->issue_seq);
> > +             item->issue_seq = cpu_to_le32(cap->issue_seq);
> >               msg->front.iov_len += sizeof(*item);
> >
> >               ceph_put_cap(mdsc, cap);
> > diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> > index ee1d0e5f9789..4ff3ad5e9210 100644
> > --- a/include/linux/ceph/ceph_fs.h
> > +++ b/include/linux/ceph/ceph_fs.h
> > @@ -822,7 +822,7 @@ struct ceph_mds_cap_release {
> >   struct ceph_mds_cap_item {
> >       __le64 ino;
> >       __le64 cap_id;
> > -     __le32 migrate_seq, seq;
> > +     __le32 migrate_seq, issue_seq;
> >   } __attribute__ ((packed));
> >
> >   #define CEPH_MDS_LEASE_REVOKE           1  /*    mds  -> client */
> >
> > base-commit: 75b607fab38d149f232f01eae5e6392b394dd659
>


--
Patrick Donnelly, Ph.D.
He / Him / His
Red Hat Partner Engineer
IBM, Inc.
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-21 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13  1:16 [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Patrick Donnelly
2024-10-13  1:16 ` [PATCH 1/2] ceph: requalify some char pointers as const Patrick Donnelly
2024-10-13  1:16 ` [PATCH 2/3] ceph: correct ceph_mds_cap_peer field name Patrick Donnelly
2024-10-13  1:16 ` [PATCH 2/2] ceph: extract entity name from device id Patrick Donnelly
2024-10-13  1:16 ` [PATCH 3/3] ceph: improve caps debugging output Patrick Donnelly
2024-10-14  0:57 ` [PATCH 1/3] ceph: correct ceph_mds_cap_item field name Xiubo Li
2024-10-21 13:51   ` Patrick Donnelly
  -- strict thread matches above, loose matches on Subject: below --
2024-10-14 13:46 [PATCH 0/2] ceph: use entity name from new device string Patrick Donnelly
2024-10-14 13:46 ` [PATCH 2/2] ceph: extract entity name from device id Patrick Donnelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox