diff mbox series

[2/3] ceph: correct ceph_mds_cap_peer field name

Message ID 20241022144838.1049499-3-batrick@batbytes.com (mailing list archive)
State New, archived
Headers show
Series ceph: use issue_seq for struct field names | expand

Commit Message

Patrick Donnelly Oct. 22, 2024, 2:48 p.m. UTC
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(-)

Comments

Ilya Dryomov Nov. 18, 2024, 10:55 a.m. UTC | #1
On Tue, Oct 22, 2024 at 4:49 PM Patrick Donnelly <batrick@batbytes.com> wrote:
>
> 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;

Hi Patrick,

This isn't just a rename -- a different field is decoded and assigned
to cap->issue_seq now.  What is the impact of this change and should it
be mentioned in the commit message?

Thanks,

                Ilya
Patrick Donnelly Nov. 19, 2024, 2:01 a.m. UTC | #2
On Mon, Nov 18, 2024 at 5:55 AM Ilya Dryomov <idryomov@gmail.com> wrote:
>
> On Tue, Oct 22, 2024 at 4:49 PM Patrick Donnelly <batrick@batbytes.com> wrote:
> >
> > 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;
>
> Hi Patrick,
>
> This isn't just a rename -- a different field is decoded and assigned
> to cap->issue_seq now.  What is the impact of this change and should it
> be mentioned in the commit message?

You are right. This change slipped in by accident with some other
changes I have not yet pushed. I will revert this one.
diff mbox series

Patch

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;