]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: add issue_seq to all cap messages
authorPatrick Donnelly <pdonnell@redhat.com>
Wed, 26 Jun 2024 16:50:32 +0000 (12:50 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Sun, 13 Oct 2024 00:41:37 +0000 (20:41 -0400)
Right now only the clients tell the MDS what they believe the issue_seq to be.
The clients are expected to figure out issue_seq updates at

Fixes: https://tracker.ceph.com/issues/68515
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/client/Client.cc
src/mds/Locker.cc
src/mds/MDCache.cc
src/messages/MClientCaps.h

index 43c740467453a41f7c38869c10ba112c6865a04c..6a00e7debcece3d4503289fdd38e5fcc28276d02 100644 (file)
@@ -3840,6 +3840,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
                                   want,
                                   flush,
                                   cap->mseq,
+                                   cap->issue_seq,
                                    cap_epoch_barrier);
   /*
    * Since the setattr will check the cephx mds auth access before
@@ -3853,7 +3854,6 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
   m->caller_uid = -1;
   m->caller_gid = -1;
 
-  m->head.issue_seq = cap->issue_seq;
   m->set_tid(flush_tid);
 
   m->head.uid = in->uid;
index f65704a017635b188236976a87bdb137135d0ecd..d64f176acb6d795095791dd021c5f660d2b2ae87 100644 (file)
@@ -2599,6 +2599,7 @@ int Locker::issue_caps(CInode *in, Capability *only_cap)
                                           in->find_snaprealm()->inode->ino(),
                                           cap->get_cap_id(), cap->get_last_seq(),
                                           pending, wanted, 0, cap->get_mseq(),
+                                           cap->get_last_issue(),
                                           mds->get_osd_epoch_barrier());
        in->encode_cap_message(m, cap);
 
@@ -2649,6 +2650,7 @@ int Locker::issue_caps(CInode *in, Capability *only_cap)
                                         in->find_snaprealm()->inode->ino(),
                                         cap->get_cap_id(), cap->get_last_seq(),
                                         after, wanted, 0, cap->get_mseq(),
+                                         cap->get_last_issue(),
                                         mds->get_osd_epoch_barrier());
       in->encode_cap_message(m, cap);
 
@@ -2675,6 +2677,7 @@ void Locker::issue_truncate(CInode *in)
                                        cap->get_cap_id(), cap->get_last_seq(),
                                        cap->pending(), cap->wanted(), 0,
                                        cap->get_mseq(),
+                                       cap->get_last_issue(),
                                        mds->get_osd_epoch_barrier());
     in->encode_cap_message(m, cap);                         
     mds->send_message_client_counted(m, cap->get_session());
@@ -3165,6 +3168,7 @@ void Locker::share_inode_max_size(CInode *in, Capability *only_cap)
                                          cap->pending(),
                                          cap->wanted(), 0,
                                          cap->get_mseq(),
+                                         cap->get_last_issue(),
                                          mds->get_osd_epoch_barrier());
       in->encode_cap_message(m, cap);
       mds->send_message_client_counted(m, cap->get_session());
@@ -3375,10 +3379,10 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
     ref_t<MClientCaps> ack;
     if (op == CEPH_CAP_OP_FLUSHSNAP) {
       if (mds->logger) mds->logger->inc(l_mdss_ceph_cap_op_flushsnap_ack);
-      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, m->get_ino(), 0, 0, 0, 0, 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
     } else {
       if (mds->logger) mds->logger->inc(l_mdss_ceph_cap_op_flush_ack);
-      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, m->get_ino(), 0, m->get_cap_id(), m->get_seq(), m->get_caps(), 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
     }
     ack->set_snap_follows(follows);
     ack->set_client_tid(m->get_client_tid());
@@ -3500,7 +3504,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
     // case we get a dup response, so whatever.)
     ref_t<MClientCaps> ack;
     if (dirty) {
-      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, mds->get_osd_epoch_barrier());
+      ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSHSNAP_ACK, in->ino(), 0, 0, 0, 0, 0, dirty, 0, 0, mds->get_osd_epoch_barrier());
       ack->set_snap_follows(follows);
       ack->set_client_tid(m->get_client_tid());
       ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
@@ -3589,7 +3593,7 @@ void Locker::handle_client_caps(const cref_t<MClientCaps> &m)
       dout(7) << " flush client." << client << " dirty " << ccap_string(dirty)
              << " seq " << m->get_seq() << " on " << *in << dendl;
       ack = make_message<MClientCaps>(CEPH_CAP_OP_FLUSH_ACK, in->ino(), 0, cap->get_cap_id(), m->get_seq(),
-          m->get_caps(), 0, dirty, 0, mds->get_osd_epoch_barrier());
+          m->get_caps(), 0, dirty, 0, cap->get_last_issue(), mds->get_osd_epoch_barrier());
       ack->set_client_tid(m->get_client_tid());
       ack->set_oldest_flush_tid(m->get_oldest_flush_tid());
     }
index c433c77b45378af9d2dcec601791d74e3e5bef7d..d5d4215ce2cf0289acb060edf30166fa6c452007 100644 (file)
@@ -5898,7 +5898,7 @@ void MDCache::do_cap_import(Session *session, CInode *in, Capability *cap,
   auto reap = make_message<MClientCaps>(CEPH_CAP_OP_IMPORT,
                                        in->ino(), realm->inode->ino(), cap->get_cap_id(),
                                        cap->get_last_seq(), cap->pending(), cap->wanted(),
-                                       0, cap->get_mseq(), mds->get_osd_epoch_barrier());
+                                       0, cap->get_mseq(), cap->get_last_issue(), mds->get_osd_epoch_barrier());
   in->encode_cap_message(reap, cap);
   reap->snapbl = mds->server->get_snap_trace(session, realm);
   reap->set_cap_peer(p_cap_id, p_seq, p_mseq, peer, p_flags);
index fc2b85bd63afd5ea1023060e8beefe6836b63235..b001032225e2434f56ca1ae46ff6502c17fdf174 100644 (file)
@@ -142,6 +142,7 @@ protected:
              int wanted,
              int dirty,
              ceph_seq_t mseq,
+              ceph_seq_t issue_seq,
               epoch_t oeb)
     : SafeMessage{CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION},
       osd_epoch_barrier(oeb) {
@@ -155,6 +156,7 @@ protected:
     head.wanted = wanted;
     head.dirty = dirty;
     head.migrate_seq = mseq;
+    head.issue_seq = issue_seq;
     memset(&peer, 0, sizeof(peer));
   }
   MClientCaps(int op,