aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-03-18 17:45:05 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:35 -0400
commit29790f26ab3e63b2a083f0811b80e2f086e4fcb2 (patch)
tree0d254b23871db399e036c019c121f6d5c7c7b3db /fs/ceph
parentaab53dd9e81ccefa7b8d88eec5138dd73639a783 (diff)
ceph: wait for mds OPEN reply to indicate reconnect success
We used to infer reconnect success by watching the MDS state, essentially assuming that hearing nothing meant things were ok. That wasn't particularly reliable. Instead, the MDS replies with an explicit OPEN message to indicate success. Strictly speaking, this is a protocol change, but it is a backwards compatible one that does not break new clients + old servers or old clients + new servers. At least not yet. Drop unused @all argument from kick_requests while we're at it. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/mds_client.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index d45787470fb..972ec5ae2ac 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1660,10 +1660,9 @@ static void __wake_requests(struct ceph_mds_client *mdsc,
1660 1660
1661/* 1661/*
1662 * Wake up threads with requests pending for @mds, so that they can 1662 * Wake up threads with requests pending for @mds, so that they can
1663 * resubmit their requests to a possibly different mds. If @all is set, 1663 * resubmit their requests to a possibly different mds.
1664 * wake up if their requests has been forwarded to @mds, too.
1665 */ 1664 */
1666static void kick_requests(struct ceph_mds_client *mdsc, int mds, int all) 1665static void kick_requests(struct ceph_mds_client *mdsc, int mds)
1667{ 1666{
1668 struct ceph_mds_request *req; 1667 struct ceph_mds_request *req;
1669 struct rb_node *p; 1668 struct rb_node *p;
@@ -2026,6 +2025,8 @@ static void handle_session(struct ceph_mds_session *session,
2026 2025
2027 switch (op) { 2026 switch (op) {
2028 case CEPH_SESSION_OPEN: 2027 case CEPH_SESSION_OPEN:
2028 if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
2029 pr_info("mds%d reconnect success\n", session->s_mds);
2029 session->s_state = CEPH_MDS_SESSION_OPEN; 2030 session->s_state = CEPH_MDS_SESSION_OPEN;
2030 renewed_caps(mdsc, session, 0); 2031 renewed_caps(mdsc, session, 0);
2031 wake = 1; 2032 wake = 1;
@@ -2039,10 +2040,12 @@ static void handle_session(struct ceph_mds_session *session,
2039 break; 2040 break;
2040 2041
2041 case CEPH_SESSION_CLOSE: 2042 case CEPH_SESSION_CLOSE:
2043 if (session->s_state == CEPH_MDS_SESSION_RECONNECTING)
2044 pr_info("mds%d reconnect denied\n", session->s_mds);
2042 remove_session_caps(session); 2045 remove_session_caps(session);
2043 wake = 1; /* for good measure */ 2046 wake = 1; /* for good measure */
2044 complete(&mdsc->session_close_waiters); 2047 complete(&mdsc->session_close_waiters);
2045 kick_requests(mdsc, mds, 0); /* cur only */ 2048 kick_requests(mdsc, mds);
2046 break; 2049 break;
2047 2050
2048 case CEPH_SESSION_STALE: 2051 case CEPH_SESSION_STALE:
@@ -2258,7 +2261,6 @@ send:
2258 reply->nr_pages = calc_pages_for(0, pagelist->length); 2261 reply->nr_pages = calc_pages_for(0, pagelist->length);
2259 ceph_con_send(&session->s_con, reply); 2262 ceph_con_send(&session->s_con, reply);
2260 2263
2261 session->s_state = CEPH_MDS_SESSION_OPEN;
2262 mutex_unlock(&session->s_mutex); 2264 mutex_unlock(&session->s_mutex);
2263 2265
2264 mutex_lock(&mdsc->mutex); 2266 mutex_lock(&mdsc->mutex);
@@ -2334,7 +2336,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,
2334 } 2336 }
2335 2337
2336 /* kick any requests waiting on the recovering mds */ 2338 /* kick any requests waiting on the recovering mds */
2337 kick_requests(mdsc, i, 1); 2339 kick_requests(mdsc, i);
2338 } else if (oldstate == newstate) { 2340 } else if (oldstate == newstate) {
2339 continue; /* nothing new with this mds */ 2341 continue; /* nothing new with this mds */
2340 } 2342 }
@@ -2347,18 +2349,14 @@ static void check_new_map(struct ceph_mds_client *mdsc,
2347 send_mds_reconnect(mdsc, i); 2349 send_mds_reconnect(mdsc, i);
2348 2350
2349 /* 2351 /*
2350 * kick requests on any mds that has gone active. 2352 * kick request on any mds that has gone active.
2351 *
2352 * kick requests on cur or forwarder: we may have sent
2353 * the request to mds1, mds1 told us it forwarded it
2354 * to mds2, but then we learn mds1 failed and can't be
2355 * sure it successfully forwarded our request before
2356 * it died.
2357 */ 2353 */
2358 if (oldstate < CEPH_MDS_STATE_ACTIVE && 2354 if (oldstate < CEPH_MDS_STATE_ACTIVE &&
2359 newstate >= CEPH_MDS_STATE_ACTIVE) { 2355 newstate >= CEPH_MDS_STATE_ACTIVE) {
2360 pr_info("mds%d reconnect completed\n", s->s_mds); 2356 if (oldstate != CEPH_MDS_STATE_CREATING &&
2361 kick_requests(mdsc, i, 1); 2357 oldstate != CEPH_MDS_STATE_STARTING)
2358 pr_info("mds%d recovery completed\n", s->s_mds);
2359 kick_requests(mdsc, i);
2362 ceph_kick_flushing_caps(mdsc, s); 2360 ceph_kick_flushing_caps(mdsc, s);
2363 wake_up_session_caps(s, 1); 2361 wake_up_session_caps(s, 1);
2364 } 2362 }