Skip to contentSkip to conversation

ceph: reinitialize mds feature bit even when session in open

PATCH In review Venky Shankar 2 participants 6 messages Nov 3, 2023 – Nov 6, 2023 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: reinitialize mds feature bit even when session in open

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
 fs/ceph/mds_client.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/mds_client.c +1 -0
index a7bffb030036..48d75e17115c 100644
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
 		if (session->s_state == CEPH_MDS_SESSION_OPEN) {
 			pr_notice_client(cl, "mds%d is already opened\n",
 					 session->s_mds);
+			session->s_features = features;
 		} else {
 			session->s_state = CEPH_MDS_SESSION_OPEN;
 			session->s_features = features;
Signature · 1 line
2.39.3
#1 lore raw
Quoted 19 lines · Venky Shankar

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
 fs/ceph/mds_client.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/mds_client.c +0 -0
index a7bffb030036..48d75e17115c 100644

fs/ceph/mds_client.c static void handle_session(struct ceph_mds_session *session, · line 4195

Quoted 4 lines
fs/ceph/mds_client.c +1 -0
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
                if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                        pr_notice_client(cl, "mds%d is already opened\n",
                                         session->s_mds);
+                       session->s_features = features;

Xiubo, the metrics stuff isn't done here (as it's done in the else case). That's probably required I guess??

Quoted 6 lines
fs/ceph/mds_client.c +0 -1
                } else {
                        session->s_state = CEPH_MDS_SESSION_OPEN;
                        session->s_features = features;
--

2.39.3

Signature · 2 lines
Cheers,
Venky
#2 lore raw
Quoted 14 lines · Venky Shankar
Quoted 13 lines · Venky Shankar

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
  fs/ceph/mds_client.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

fs/ceph/mds_client.c static void handle_session(struct ceph_mds_session *session, · line 4195

Quoted 9 lines
fs/ceph/mds_client.c +1 -0
index a7bffb030036..48d75e17115c 100644
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
                 if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                         pr_notice_client(cl, "mds%d is already opened\n",
                                          session->s_mds);
+                       session->s_features = features;

Xiubo, the metrics stuff isn't done here (as it's done in the else case). That's probably required I guess??

That should be okay, but it harmless to do it here.

So let's just fix it by:

fs/ceph/mds_client.c +0 -0
index 41be58baaa57..de3c6b6cbd07 100644
@@ -4263,17 +4263,16 @@ static void handle_session(struct ceph_mds_session *session,

                        pr_info_client(cl, "mds%d reconnect success\n", session->s_mds);

-               if (session->s_state == CEPH_MDS_SESSION_OPEN) { +               if (session->s_state == CEPH_MDS_SESSION_OPEN) pr_notice_client(cl, "mds%d is already opened\n", session->s_mds);
-               } else {
+               else
                        session->s_state = CEPH_MDS_SESSION_OPEN; -                       session->s_features = features;
-                       renewed_caps(mdsc, session, 0);
-                       if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT, -                                    &session->s_features))
- metric_schedule_delayed(&mdsc->metric);
-               }
+               session->s_features = features;
+               renewed_caps(mdsc, session, 0);
+               if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
+                            &session->s_features))
+ metric_schedule_delayed(&mdsc->metric);

                /*
                 * The connection maybe broken and the session in client

Thanks

- Xiubo

Quoted 8 lines
Quoted 7 lines
fs/ceph/mds_client.c +0 -1
                 } else {
                         session->s_state = CEPH_MDS_SESSION_OPEN;
                         session->s_features = features;
--

2.39.3

#3 lore raw
Quoted 47 lines · Xiubo Li
Quoted 14 lines · Venky Shankar
Quoted 13 lines · Venky Shankar

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
  fs/ceph/mds_client.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

fs/ceph/mds_client.c static void handle_session(struct ceph_mds_session *session, · line 4195

Quoted 9 lines
fs/ceph/mds_client.c +1 -0
index a7bffb030036..48d75e17115c 100644
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
                 if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                         pr_notice_client(cl, "mds%d is already opened\n",
                                          session->s_mds);
+                       session->s_features = features;

Xiubo, the metrics stuff isn't done here (as it's done in the else case). That's probably required I guess??

That should be okay, but it harmless to do it here.

So let's just fix it by:

fs/ceph/mds_client.c +1 -2
index 41be58baaa57..de3c6b6cbd07 100644
@@ -4263,17 +4263,16 @@ static void handle_session(struct
 ceph_mds_session *session,
                         pr_info_client(cl, "mds%d reconnect success\n",
                                        session->s_mds);
 
-               if (session->s_state == CEPH_MDS_SESSION_OPEN) {
+               if (session->s_state == CEPH_MDS_SESSION_OPEN)
                         pr_notice_client(cl, "mds%d is already opened\n",
                                          session->s_mds);
-               } else {

fs/ceph/mds_client.c static void handle_session(struct · line 4273

Quoted 10 lines
fs/ceph/mds_client.c +3 -6
+               else
                         session->s_state = CEPH_MDS_SESSION_OPEN;
-                       session->s_features = features;
-                       renewed_caps(mdsc, session, 0);
-                       if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
-                                    &session->s_features))
- metric_schedule_delayed(&mdsc->metric);
-               }
+               session->s_features = features;
+               renewed_caps(mdsc, session, 0);

Call to renewed_caps() isn't really required if the session state is already open, isn't it? Doesn't harm to call it I guess, but...

Quoted 21 lines
fs/ceph/mds_client.c +3 -0
+               if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
+                            &session->s_features))
+ metric_schedule_delayed(&mdsc->metric);
 
                 /*

* The connection maybe broken and the session in client

Thanks

- Xiubo

Quoted 8 lines
Quoted 7 lines
fs/ceph/mds_client.c +0 -1
                 } else {
                         session->s_state = CEPH_MDS_SESSION_OPEN;
                         session->s_features = features;
--

2.39.3

Signature · 2 lines
Cheers,
Venky
#4 lore raw
Quoted 50 lines · Venky Shankar
Quoted 49 lines · Xiubo Li
Quoted 14 lines · Venky Shankar
Quoted 13 lines · Venky Shankar

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
   fs/ceph/mds_client.c | 1 +
   1 file changed, 1 insertion(+)
Quoted 11 lines

fs/ceph/mds_client.c static void handle_session(struct ceph_mds_session *session, · line 4195

Quoted 9 lines
fs/ceph/mds_client.c +1 -0
index a7bffb030036..48d75e17115c 100644
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
                  if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                          pr_notice_client(cl, "mds%d is already opened\n",
                                           session->s_mds);
+                       session->s_features = features;

Xiubo, the metrics stuff isn't done here (as it's done in the else case). That's probably required I guess??

That should be okay, but it harmless to do it here.

So let's just fix it by:

fs/ceph/mds_client.c +2 -4
index 41be58baaa57..de3c6b6cbd07 100644
@@ -4263,17 +4263,16 @@ static void handle_session(struct
 ceph_mds_session *session,
                          pr_info_client(cl, "mds%d reconnect success\n",
                                         session->s_mds);
 
-               if (session->s_state == CEPH_MDS_SESSION_OPEN) {
+               if (session->s_state == CEPH_MDS_SESSION_OPEN)
                          pr_notice_client(cl, "mds%d is already opened\n",
                                           session->s_mds);
-               } else {
+               else
                          session->s_state = CEPH_MDS_SESSION_OPEN;
-                       session->s_features = features;
-                       renewed_caps(mdsc, session, 0);
Quoted 8 lines

fs/ceph/mds_client.c static void handle_session(struct · line 4273

Quoted 6 lines
fs/ceph/mds_client.c +2 -4
-                       if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
-                                    &session->s_features))
- metric_schedule_delayed(&mdsc->metric);
-               }
+               session->s_features = features;
+               renewed_caps(mdsc, session, 0);

Call to renewed_caps() isn't really required if the session state is already open, isn't it? Doesn't harm to call it I guess, but...

Yeah.

Then let's just do:

fs/ceph/mds_client.c +0 -0
index 41be58baaa57..45d0f445cdef 100644
@@ -4263,12 +4263,12 @@ static void handle_session(struct ceph_mds_session *session,

                        pr_info_client(cl, "mds%d reconnect success\n", session->s_mds);

+               session->s_features = features;
                if (session->s_state == CEPH_MDS_SESSION_OPEN) { pr_notice_client(cl, "mds%d is already opened\n", session->s_mds);
                } else {
                        session->s_state = CEPH_MDS_SESSION_OPEN; -                       session->s_features = features; renewed_caps(mdsc, session, 0);
                        if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT, &session->s_features))

Thanks

- Xiubo

Quoted 19 lines
Quoted 18 lines
fs/ceph/mds_client.c +3 -0
+               if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
+                            &session->s_features))
+ metric_schedule_delayed(&mdsc->metric);
 
                  /*

* The connection maybe broken and the session in client

Thanks

- Xiubo

Quoted 6 lines
Quoted 6 lines
fs/ceph/mds_client.c +0 -1
                  } else {
                          session->s_state = CEPH_MDS_SESSION_OPEN;
                          session->s_features = features;
--

2.39.3

#5 lore raw

Done - updated (didn't add v2 to the pathset though).

Quoted 111 lines · Xiubo Li
Quoted 50 lines · Venky Shankar
Quoted 49 lines · Xiubo Li
Quoted 14 lines · Venky Shankar
Quoted 13 lines · Venky Shankar

Following along the same lines as per the user-space fix. Right now this isn't really an issue with the ceph kernel driver because of the feature bit laginess, however, that can change over time (when the new snaprealm info type is ported to the kernel driver) and depending on the MDS version that's being upgraded can cause message decoding issues - so, fix that early on.

URL: Fixes: http://tracker.ceph.com/issues/63188

---
   fs/ceph/mds_client.c | 1 +
   1 file changed, 1 insertion(+)
Quoted 11 lines

fs/ceph/mds_client.c static void handle_session(struct ceph_mds_session *session, · line 4195

Quoted 9 lines
fs/ceph/mds_client.c +1 -0
index a7bffb030036..48d75e17115c 100644
@@ -4192,6 +4192,7 @@ static void handle_session(struct ceph_mds_session *session,
                  if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                          pr_notice_client(cl, "mds%d is already opened\n",
                                           session->s_mds);
+                       session->s_features = features;

Xiubo, the metrics stuff isn't done here (as it's done in the else case). That's probably required I guess??

That should be okay, but it harmless to do it here.

So let's just fix it by:

fs/ceph/mds_client.c +2 -4
index 41be58baaa57..de3c6b6cbd07 100644
@@ -4263,17 +4263,16 @@ static void handle_session(struct
 ceph_mds_session *session,
                          pr_info_client(cl, "mds%d reconnect success\n",
                                         session->s_mds);
 
-               if (session->s_state == CEPH_MDS_SESSION_OPEN) {
+               if (session->s_state == CEPH_MDS_SESSION_OPEN)
                          pr_notice_client(cl, "mds%d is already opened\n",
                                           session->s_mds);
-               } else {
+               else
                          session->s_state = CEPH_MDS_SESSION_OPEN;
-                       session->s_features = features;
-                       renewed_caps(mdsc, session, 0);
Quoted 8 lines

fs/ceph/mds_client.c static void handle_session(struct · line 4273

Quoted 6 lines
fs/ceph/mds_client.c +2 -4
-                       if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
-                                    &session->s_features))
- metric_schedule_delayed(&mdsc->metric);
-               }
+               session->s_features = features;
+               renewed_caps(mdsc, session, 0);

Call to renewed_caps() isn't really required if the session state is already open, isn't it? Doesn't harm to call it I guess, but...

Yeah.

Then let's just do:

fs/ceph/mds_client.c +1 -1
index 41be58baaa57..45d0f445cdef 100644
@@ -4263,12 +4263,12 @@ static void handle_session(struct
 ceph_mds_session *session,
                         pr_info_client(cl, "mds%d reconnect success\n",
                                        session->s_mds);
 
+               session->s_features = features;
                 if (session->s_state == CEPH_MDS_SESSION_OPEN) {
                         pr_notice_client(cl, "mds%d is already opened\n",
                                          session->s_mds);
                 } else {
                         session->s_state = CEPH_MDS_SESSION_OPEN;
-                       session->s_features = features;
                         renewed_caps(mdsc, session, 0);
                         if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
                                      &session->s_features))

Thanks

- Xiubo

Quoted 19 lines
Quoted 18 lines
fs/ceph/mds_client.c +3 -0
+               if (test_bit(CEPHFS_FEATURE_METRIC_COLLECT,
+                            &session->s_features))
+ metric_schedule_delayed(&mdsc->metric);
 
                  /*

* The connection maybe broken and the session in client

Thanks

- Xiubo

Quoted 6 lines
Quoted 6 lines
fs/ceph/mds_client.c +0 -1
                  } else {
                          session->s_state = CEPH_MDS_SESSION_OPEN;
                          session->s_features = features;
--

2.39.3

Signature · 2 lines
Cheers,
Venky