]> git-server-git.apps.pok.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@ibm.com>
Thu, 9 Jan 2025 19:40:54 +0000 (14:40 -0500)
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>
(cherry picked from commit cb4ff28af09f0afd5546d87a59cdfc64e64a2b15)

src/client/Client.cc
src/mds/Locker.cc
src/mds/MDCache.cc
src/messages/MClientCaps.h

index dc2cda72c1ebd96a9a91e59961298411c52329e8..1a6a449e746b779d6bc9921ac753bb480da13495 100644 (file)
@@ -3817,6 +3817,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
@@ -3830,7 +3831,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 25c45b04825c45fd6452b1e86fefa4a07757e036..9f9638505be6a3027156ba4178b19b96c2eb5348 100644 (file)
@@ -2597,6 +2597,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);
 
@@ -2645,6 +2646,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);
 
@@ -2671,6 +2673,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, p.first);
@@ -3161,6 +3164,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, client);
@@ -3371,10 +3375,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());
@@ -3496,7 +3500,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());
@@ -3585,7 +3589,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 f00e588c7a2e3644cb21d8f5feffcee394785c25..dd4c581822d40398da669ab6c96acf4cfaf111c2 100644 (file)
@@ -5893,7 +5893,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,