ceph: skip reconnecting if MDS is not ready
authorXiubo Li <xiubli@redhat.com>
Thu, 24 Aug 2023 09:55:51 +0000 (17:55 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 15 Jan 2024 14:40:50 +0000 (15:40 +0100)
When MDS closed the session the kclient will send to reconnect to
it immediately, but if the MDS just restarted and still not ready
yet, such as still in the up:replay state and the sessionmap journal
logs hasn't be replayed, the MDS will close the session.

And then the kclient could remove the session and later when the
mdsmap is in RECONNECT phrase it will skip reconnecting. But the MDS
will wait until timeout and then evict the kclient.

Just skip sending the reconnection request until the MDS is ready.

Link: https://tracker.ceph.com/issues/62489
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c

index d95eb525519a644148af693ba68972c84b2ba941..be00c189ed460c7721c348866de088407e53bfd3 100644 (file)
@@ -5870,7 +5870,8 @@ static void mds_peer_reset(struct ceph_connection *con)
 
        pr_warn_client(mdsc->fsc->client, "mds%d closed our session\n",
                       s->s_mds);
-       if (READ_ONCE(mdsc->fsc->mount_state) != CEPH_MOUNT_FENCE_IO)
+       if (READ_ONCE(mdsc->fsc->mount_state) != CEPH_MOUNT_FENCE_IO &&
+           ceph_mdsmap_get_state(mdsc->mdsmap, s->s_mds) >= CEPH_MDS_STATE_RECONNECT)
                send_mds_reconnect(mdsc, s);
 }