]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: move confirm_receipt() to Capability.cc
authorXiubo Li <xiubli@redhat.com>
Thu, 2 Mar 2023 13:58:56 +0000 (21:58 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 13 Oct 2023 00:38:37 +0000 (08:38 +0800)
Will add the debug logs later in confirm_receipt().

Fixes: https://tracker.ceph.com/issues/57244
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit f9aa17c90ee01b0f6df56af3fa76a80870ecf38a)

src/mds/Capability.cc
src/mds/Capability.h

index b6258e466df38b6013edb1950b01ffcb4a95dff2..5103b240e529d51f84be43f24adceb4be633fc96 100644 (file)
@@ -176,6 +176,35 @@ client_t Capability::get_client() const
   return session ? session->get_client() : client_t(-1);
 }
 
+int Capability::confirm_receipt(ceph_seq_t seq, unsigned caps) {
+  int was_revoking = (_issued & ~_pending);
+  if (seq == last_sent) {
+    _revokes.clear();
+    _issued = caps;
+    // don't add bits
+    _pending &= caps;
+  } else {
+    // can i forget any revocations?
+    while (!_revokes.empty() && _revokes.front().seq < seq)
+      _revokes.pop_front();
+    if (!_revokes.empty()) {
+      if (_revokes.front().seq == seq)
+        _revokes.begin()->before = caps;
+      calc_issued();
+    } else {
+      // seq < last_sent
+      _issued = caps | _pending;
+    }
+  }
+
+  if (was_revoking && _issued == _pending) {
+    item_revoking_caps.remove_myself();
+    item_client_revoking_caps.remove_myself();
+    maybe_clear_notable();
+  }
+  return was_revoking & ~_issued; // return revoked
+}
+
 bool Capability::is_stale() const
 {
   return session ? session->is_stale() : false;
index f7119f002e1381698343a029c2a8ede2b6b4cf7d..3fd6d2ce6d4f0d5924d839099098bd618da68dab 100644 (file)
@@ -182,34 +182,7 @@ public:
     inc_last_seq();
     return last_sent;
   }
-  int confirm_receipt(ceph_seq_t seq, unsigned caps) {
-    int was_revoking = (_issued & ~_pending);
-    if (seq == last_sent) {
-      _revokes.clear();
-      _issued = caps;
-      // don't add bits
-      _pending &= caps;
-    } else {
-      // can i forget any revocations?
-      while (!_revokes.empty() && _revokes.front().seq < seq)
-       _revokes.pop_front();
-      if (!_revokes.empty()) {
-       if (_revokes.front().seq == seq)
-         _revokes.begin()->before = caps;
-       calc_issued();
-      } else {
-       // seq < last_sent
-       _issued = caps | _pending;
-      }
-    }
-
-    if (was_revoking && _issued == _pending) {
-      item_revoking_caps.remove_myself();
-      item_client_revoking_caps.remove_myself();
-      maybe_clear_notable();
-    }
-    return was_revoking & ~_issued; // return revoked
-  }
+  int confirm_receipt(ceph_seq_t seq, unsigned caps);
   // we may get a release racing with revocations, which means our revokes will be ignored
   // by the client.  clean them out of our _revokes history so we don't wait on them.
   void clean_revoke_from(ceph_seq_t li) {