]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: move the Inode to new auth mds session when changing auth cap 53664/head
authorXiubo Li <xiubli@redhat.com>
Wed, 19 Jul 2023 02:22:39 +0000 (10:22 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 26 Sep 2023 05:08:04 +0000 (13:08 +0800)
When the auth cap changes we need to move the Inode to the new session's
dirty cap list.

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

src/client/Client.cc

index 6d5958a40a0b9c4e0b735c02d42a491f57bfcd41..9b79e434b40151a0b907a4eeb6652e9e95983bba 100644 (file)
@@ -4410,11 +4410,19 @@ void Client::add_update_cap(Inode *in, MetaSession *mds_session, uint64_t cap_id
   if (flags & CEPH_CAP_FLAG_AUTH) {
     if (in->auth_cap != &cap &&
         (!in->auth_cap || ceph_seq_cmp(in->auth_cap->mseq, mseq) < 0)) {
-      if (in->auth_cap && in->flushing_cap_item.is_on_list()) {
-       ldout(cct, 10) << __func__ << " changing auth cap: "
-                      << "add myself to new auth MDS' flushing caps list" << dendl;
-       adjust_session_flushing_caps(in, in->auth_cap->session, mds_session);
+      if (in->auth_cap) {
+        if (in->flushing_cap_item.is_on_list()) {
+          ldout(cct, 10) << __func__ << " changing auth cap: "
+                         << "add myself to new auth MDS' flushing caps list" << dendl;
+          adjust_session_flushing_caps(in, in->auth_cap->session, mds_session);
+        }
+        if (in->dirty_cap_item.is_on_list()) {
+          ldout(cct, 10) << __func__ << " changing auth cap: "
+                         << "add myself to new auth MDS' dirty caps list" << dendl;
+          mds_session->get_dirty_list().push_back(&in->dirty_cap_item);
+        }
       }
+
       in->auth_cap = &cap;
     }
   }