Skip to contentSkip to conversation

ceph: if we are blacklisted, __do_request returns directly

PATCH Superseded Yanhu Cao 2 participants 3 messages Apr 17, 2020 Ceph client

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yanhu Cao

author
#0 lore raw

PATCH v2 1/1 ceph: if we are blacklisted, __do_request returns directly

If we mount cephfs by the recover_session option,
__do_request can return directly until the client automatically reconnects.

---
 fs/ceph/mds_client.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/ceph/mds_client.c +6 -0
index 486f91f9685b..e6cda256b136 100644
@@ -2708,6 +2708,12 @@ static void __do_request(struct ceph_mds_client *mdsc,
 
 	put_request_session(req);
 
+	if (mdsc->fsc->blacklisted &&
+	    ceph_test_mount_opt(mdsc->fsc, CLEANRECOVER)) {
+		err = -EACCES;
+		goto finish;
+	}
+
 	mds = __choose_mds(mdsc, req, &random);
 	if (mds < 0 ||
 	    ceph_mdsmap_get_state(mdsc->mdsmap, mds) < CEPH_MDS_STATE_ACTIVE) {
Signature · 1 line
2.24.2 (Apple Git-127)
#1 lore raw
Quoted 15 lines · Yanhu Cao

If we mount cephfs by the recover_session option,
__do_request can return directly until the client automatically reconnects.

---
 fs/ceph/mds_client.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/ceph/mds_client.c +0 -0
index 486f91f9685b..e6cda256b136 100644
@@ -2708,6 +2708,12 @@ static void __do_request(struct ceph_mds_client *mdsc,
 
 	put_request_session(req);

fs/ceph/mds_client.c static void __do_request(struct ceph_mds_client *mdsc, · line 2719

Quoted 10 lines
fs/ceph/mds_client.c +6 -0
 
+	if (mdsc->fsc->blacklisted &&
+	    ceph_test_mount_opt(mdsc->fsc, CLEANRECOVER)) {
+		err = -EACCES;
+		goto finish;
+	}
+
 	mds = __choose_mds(mdsc, req, &random);
 	if (mds < 0 ||
 	    ceph_mdsmap_get_state(mdsc->mdsmap, mds) < CEPH_MDS_STATE_ACTIVE) {

We do have an EBLACKLISTED error defined, which is the same as ESHUTDOWN. The read and write code can return that when the client is blacklisted. Same for cap handling (in __ceph_pool_perm_get. Should this return -EBLACKLISTED instead?

Signature · 1 line
Jeff Layton <[email protected]>
author
#2 lore raw

Yeah, patch the next commit.

Quoted 36 lines · Jeff Layton
Quoted 15 lines · Yanhu Cao

If we mount cephfs by the recover_session option,
__do_request can return directly until the client automatically reconnects.

---
 fs/ceph/mds_client.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/ceph/mds_client.c +0 -0
index 486f91f9685b..e6cda256b136 100644
@@ -2708,6 +2708,12 @@ static void __do_request(struct ceph_mds_client *mdsc,
 
      put_request_session(req);

fs/ceph/mds_client.c static void __do_request(struct ceph_mds_client *mdsc, · line 2719

Quoted 10 lines
fs/ceph/mds_client.c +6 -0
 
+     if (mdsc->fsc->blacklisted &&
+         ceph_test_mount_opt(mdsc->fsc, CLEANRECOVER)) {
+             err = -EACCES;
+             goto finish;
+     }
+
      mds = __choose_mds(mdsc, req, &random);
      if (mds < 0 ||
          ceph_mdsmap_get_state(mdsc->mdsmap, mds) < CEPH_MDS_STATE_ACTIVE) {

We do have an EBLACKLISTED error defined, which is the same as ESHUTDOWN. The read and write code can return that when the client is blacklisted. Same for cap handling (in __ceph_pool_perm_get. Should this return -EBLACKLISTED instead?

--
Jeff Layton <[email protected]>