From ecc478b265f5ceeae169690af43ef6927206ded9 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Wed, 19 Jul 2023 10:22:39 +0800 Subject: [PATCH] client: move the Inode to new auth mds session when changing auth cap 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 (cherry picked from commit 8aafa4cd7b1c124f5139ca93591cff61da1d2965) --- src/client/Client.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 8a0033441ea..87c777746cb 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4421,11 +4421,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 = ∩ } } -- 2.39.5