Skip to contentSkip to conversation

ceph: use frag's MDS in either mode

PATCH In review Yanhu Cao 2 participants 3 messages Jul 31, 2020 – Aug 3, 2020 Ceph client

lore
Share & tools
lore

Yanhu Cao

author
#0 lore raw

PATCH v2 1/1 ceph: use frag's MDS in either mode

When doing some tests with multiple mds, there are many mds forwarding requests between them and then the client request is resent.

If the request is a modification operation and the mode is set to USE_AUTH_MDS. Auth mds should be selected to handle the request, and if auth mds for frag is already set, it can be returned directly without the logic behind it.

But the current logic doesn't return directly because the condition 'mode == USE_AUTH_MDS', and sometimes frag's mds is not equal to cap's session mds, which then causes the request to be resent.

---
 fs/ceph/mds_client.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ceph/mds_client.c +1 -2
index a50497142e59..b2255a9be7c0 100644
@@ -1103,8 +1103,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
 				     frag.frag, mds);
 				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
 				    CEPH_MDS_STATE_ACTIVE) {
-					if (mode == USE_ANY_MDS &&
-					    !ceph_mdsmap_is_laggy(mdsc->mdsmap,
+					if (!ceph_mdsmap_is_laggy(mdsc->mdsmap,
 								  mds))
 						goto out;
 				}
Signature · 1 line
2.24.3 (Apple Git-128)
#1 lore raw
Quoted 22 lines · Yanhu Cao

When doing some tests with multiple mds, there are many mds forwarding requests between them and then the client request is resent.

If the request is a modification operation and the mode is set to USE_AUTH_MDS. Auth mds should be selected to handle the request, and if auth mds for frag is already set, it can be returned directly without the logic behind it.

But the current logic doesn't return directly because the condition 'mode == USE_AUTH_MDS', and sometimes frag's mds is not equal to cap's session mds, which then causes the request to be resent.

---
 fs/ceph/mds_client.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ceph/mds_client.c +0 -0
index a50497142e59..b2255a9be7c0 100644

fs/ceph/mds_client.c static int __choose_mds(struct ceph_mds_client *mdsc, · line 1109

Quoted 9 lines
fs/ceph/mds_client.c +1 -2
@@ -1103,8 +1103,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
 				     frag.frag, mds);
 				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
 				    CEPH_MDS_STATE_ACTIVE) {
-					if (mode == USE_ANY_MDS &&
-					    !ceph_mdsmap_is_laggy(mdsc->mdsmap,
+					if (!ceph_mdsmap_is_laggy(mdsc->mdsmap,
 								  mds))
 						goto out;
 				}

Much better! A good changelog is as important as the patch, esp in code like this that is quite non-obvious.

Merged into testing branch. I did clean up the changelog a bit before I merged it. Please take a look when you have time and let me know if you think I got it wrong.

Thanks!

Signature · 1 line
Jeff Layton <[email protected]>
author
#2 lore raw
Quoted 38 lines · Jeff Layton
Quoted 22 lines · Yanhu Cao

When doing some tests with multiple mds, there are many mds forwarding requests between them and then the client request is resent.

If the request is a modification operation and the mode is set to USE_AUTH_MDS. Auth mds should be selected to handle the request, and if auth mds for frag is already set, it can be returned directly without the logic behind it.

But the current logic doesn't return directly because the condition 'mode == USE_AUTH_MDS', and sometimes frag's mds is not equal to cap's session mds, which then causes the request to be resent.

---
 fs/ceph/mds_client.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ceph/mds_client.c +0 -0
index a50497142e59..b2255a9be7c0 100644

fs/ceph/mds_client.c static int __choose_mds(struct ceph_mds_client *mdsc, · line 1109

Quoted 9 lines
fs/ceph/mds_client.c +1 -2
@@ -1103,8 +1103,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
                                   frag.frag, mds);
                              if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
                                  CEPH_MDS_STATE_ACTIVE) {
-                                     if (mode == USE_ANY_MDS &&
-                                         !ceph_mdsmap_is_laggy(mdsc->mdsmap,
+                                     if (!ceph_mdsmap_is_laggy(mdsc->mdsmap,
                                                                mds))
                                              goto out;
                              }

Much better! A good changelog is as important as the patch, esp in code like this that is quite non-obvious.

Quoted 3 lines

Merged into testing branch. I did clean up the changelog a bit before I merged it. Please take a look when you have time and let me know if you think I got it wrong.

LGTM.

Thanks.

Quoted 5 lines

Thanks!
--
Jeff Layton <[email protected]>