Skip to contentSkip to conversation

ceph: protect kick_requests() with mdsc->mutex

PATCH In review Yan, Zheng 2 participants 4 messages Sep 11, 2014 – Sep 12, 2014 Ceph client

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/2 ceph: protect kick_requests() with mdsc->mutex

From: "Yan, Zheng" <[email protected]>

---
 fs/ceph/mds_client.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +3 -2
index f751fea..267ba44 100644
@@ -2471,9 +2471,8 @@ static void handle_session(struct ceph_mds_session *session,
 		if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
 			pr_info("mds%d reconnect denied\n", session->s_mds);
 		remove_session_caps(session);
-		wake = 1; /* for good measure */
+		wake = 2; /* for good measure */
 		wake_up_all(&mdsc->session_close_wq);
-		kick_requests(mdsc, mds);
 		break;
 
 	case CEPH_SESSION_STALE:
@@ -2503,6 +2502,8 @@ static void handle_session(struct ceph_mds_session *session,
 	if (wake) {
 		mutex_lock(&mdsc->mutex);
 		__wake_requests(mdsc, &session->s_waiting);
+		if (wake == 2)
+			kick_requests(mdsc, mds);
 		mutex_unlock(&mdsc->mutex);
 	}
 	return;
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 2/2 ceph: make sure request isn't in any waiting list when kicking request.

From: "Yan, Zheng" <[email protected]>

we may corrupt waiting list if a request in the waiting list is kicked.

---
 fs/ceph/mds_client.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/mds_client.c +1 -0
index 267ba44..a17fc49 100644
@@ -2078,6 +2078,7 @@ static void kick_requests(struct ceph_mds_client *mdsc, int mds)
 		if (req->r_session &&
 		    req->r_session->s_mds == mds) {
 			dout(" kicking tid %llu\n", req->r_tid);
+			list_del_init(&req->r_wait);
 			__do_request(mdsc, req);
 		}
 	}
Signature · 1 line
1.9.3
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ceph: make sure request isn't in any waiting list when kicking request.

Quoted 30 lines · Zheng

From: "Yan, Zheng" <[email protected]>

we may corrupt waiting list if a request in the waiting list is kicked.

---
 fs/ceph/mds_client.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/mds_client.c +1 -0
index 267ba44..a17fc49 100644
@@ -2078,6 +2078,7 @@ static void kick_requests(struct ceph_mds_client *mdsc, int mds)
 		if (req->r_session &&
 		    req->r_session->s_mds == mds) {
 			dout(" kicking tid %llu\n", req->r_tid);
+			list_del_init(&req->r_wait);
 			__do_request(mdsc, req);
 		}
 	}
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v1 1/2
#3 lore raw
In reply to Yan, Zheng
Quoted 40 lines · Zheng

From: "Yan, Zheng" <[email protected]>

---
 fs/ceph/mds_client.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +3 -2
index f751fea..267ba44 100644
@@ -2471,9 +2471,8 @@ static void handle_session(struct ceph_mds_session *session,
 		if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
 			pr_info("mds%d reconnect denied\n", session->s_mds);
 		remove_session_caps(session);
-		wake = 1; /* for good measure */
+		wake = 2; /* for good measure */
 		wake_up_all(&mdsc->session_close_wq);
-		kick_requests(mdsc, mds);
 		break;
 
 	case CEPH_SESSION_STALE:
@@ -2503,6 +2502,8 @@ static void handle_session(struct ceph_mds_session *session,
 	if (wake) {
 		mutex_lock(&mdsc->mutex);
 		__wake_requests(mdsc, &session->s_waiting);
+		if (wake == 2)
+			kick_requests(mdsc, mds);
 		mutex_unlock(&mdsc->mutex);
 	}
 	return;
Signature · 6 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html