]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: move the Inode to new auth mds session when changing auth cap 52335/head
authorXiubo Li <xiubli@redhat.com>
Wed, 19 Jul 2023 02:22:39 +0000 (10:22 +0800)
committerXiubo Li <xiubli@redhat.com>
Wed, 19 Jul 2023 03:02:01 +0000 (11:02 +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>
src/client/Client.cc

index 6a68ce81c7d7f42b1bd0e26585d8f0f69df7cafe..083a82d11a74a671c929ef9aa5641a3a0ef799eb 100644 (file)
@@ -4467,11 +4467,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;
     }
   }