Skip to content

Commit 300e42a

Browse files
lxbszidryomov
authored andcommitted
ceph: add session already open notify support
If the connection was accidently closed due to the socket issue or something else the clients will try to open the opened sessions, the MDSes will send the session open reply one more time if the clients support the notify feature. When the clients retry to open the sessions the s_seq will be 0 as default, we need to update it anyway. Link: https://tracker.ceph.com/issues/53911 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 4868e53 commit 300e42a

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

fs/ceph/mds_client.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,11 +3540,26 @@ static void handle_session(struct ceph_mds_session *session,
35403540
case CEPH_SESSION_OPEN:
35413541
if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
35423542
pr_info("mds%d reconnect success\n", session->s_mds);
3543-
session->s_state = CEPH_MDS_SESSION_OPEN;
3544-
session->s_features = features;
3545-
renewed_caps(mdsc, session, 0);
3546-
if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT, &session->s_features))
3547-
metric_schedule_delayed(&mdsc->metric);
3543+
3544+
if (session->s_state == CEPH_MDS_SESSION_OPEN) {
3545+
pr_notice("mds%d is already opened\n", session->s_mds);
3546+
} else {
3547+
session->s_state = CEPH_MDS_SESSION_OPEN;
3548+
session->s_features = features;
3549+
renewed_caps(mdsc, session, 0);
3550+
if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
3551+
&session->s_features))
3552+
metric_schedule_delayed(&mdsc->metric);
3553+
}
3554+
3555+
/*
3556+
* The connection maybe broken and the session in client
3557+
* side has been reinitialized, need to update the seq
3558+
* anyway.
3559+
*/
3560+
if (!session->s_seq && seq)
3561+
session->s_seq = seq;
3562+
35483563
wake = 1;
35493564
if (mdsc->stopping)
35503565
__close_session(mdsc, session);

fs/ceph/mds_client.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ enum ceph_feature_type {
2929
CEPHFS_FEATURE_MULTI_RECONNECT,
3030
CEPHFS_FEATURE_DELEG_INO,
3131
CEPHFS_FEATURE_METRIC_COLLECT,
32+
CEPHFS_FEATURE_ALTERNATE_NAME,
33+
CEPHFS_FEATURE_NOTIFY_SESSION_STATE,
3234

33-
CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_METRIC_COLLECT,
35+
CEPHFS_FEATURE_MAX = CEPHFS_FEATURE_NOTIFY_SESSION_STATE,
3436
};
3537

3638
#define CEPHFS_FEATURES_CLIENT_SUPPORTED { \
@@ -41,6 +43,7 @@ enum ceph_feature_type {
4143
CEPHFS_FEATURE_MULTI_RECONNECT, \
4244
CEPHFS_FEATURE_DELEG_INO, \
4345
CEPHFS_FEATURE_METRIC_COLLECT, \
46+
CEPHFS_FEATURE_NOTIFY_SESSION_STATE, \
4447
}
4548

4649
/*

0 commit comments

Comments
 (0)