Skip to content

Commit

Permalink
client: flush the dirty caps immediately when the MDS is stopping
Browse files Browse the repository at this point in the history
Trigger to flush the dirty caps when the MDS is stopping, or the
caps could be dropped if the MDS stopped before the client could
receiving the mdsmap.

Fixes: https://tracker.ceph.com/issues/61914
Signed-off-by: Xiubo Li <xiubli@redhat.com>
  • Loading branch information
lxbsz committed Jul 7, 2023
1 parent f1dcc9c commit 6d5b09c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3091,7 +3091,19 @@ void Client::handle_mds_map(const MConstRef<MMDSMap>& m)
continue;
}
if (newstate >= MDSMap::STATE_ACTIVE) {
if (oldstate < MDSMap::STATE_ACTIVE) {
if (oldstate <= MDSMap::STATE_ACTIVE) {
ceph_assert(newstate != oldstate);

// flush the delayed caps in case this MDS is stopping
for (auto p = delayed_list.begin(); p != delayed_list.end(); ) {
Inode *in = *p;
++p;
if (!mount_aborted && in->auth_cap->session == session.get()) {
in->delay_cap_item.remove_myself();
check_caps(in, CHECK_CAPS_NODELAY);
}
}

// kick new requests
kick_requests(session.get());
kick_flushing_caps(session.get());
Expand Down

0 comments on commit 6d5b09c

Please sign in to comment.