aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osd_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-20 00:43:23 -0500
committerSage Weil <sage@newdream.net>2010-02-23 17:26:29 -0500
commit5b3a4db3e4009aff918abb1353eb3f4925393a7b (patch)
tree0f55666c827c3dfe31309209b69121e431366739 /fs/ceph/osd_client.c
parentbcd2cbd10ce31c950a40c08d7f601f8ff23537b8 (diff)
ceph: fix up unexpected message handling
Fix skipping of unexpected message types from osd, mon. Clean up pr_info and debug output. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osd_client.c')
-rw-r--r--fs/ceph/osd_client.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index fa0f73703954..ffd819c5a5dd 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -1396,31 +1396,30 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
1396 ceph_msg_put(msg); 1396 ceph_msg_put(msg);
1397} 1397}
1398 1398
1399static struct ceph_msg *alloc_msg(struct ceph_connection *con, 1399/*
1400 * lookup and return message for incoming reply
1401 */
1402static struct ceph_msg *get_reply(struct ceph_connection *con,
1400 struct ceph_msg_header *hdr, 1403 struct ceph_msg_header *hdr,
1401 int *skip) 1404 int *skip)
1402{ 1405{
1403 struct ceph_osd *osd = con->private; 1406 struct ceph_osd *osd = con->private;
1404 struct ceph_osd_client *osdc = osd->o_osdc; 1407 struct ceph_osd_client *osdc = osd->o_osdc;
1405 int type = le16_to_cpu(hdr->type);
1406 int front = le32_to_cpu(hdr->front_len);
1407 int data_len = le32_to_cpu(hdr->data_len);
1408 struct ceph_msg *m; 1408 struct ceph_msg *m;
1409 struct ceph_osd_request *req; 1409 struct ceph_osd_request *req;
1410 int front = le32_to_cpu(hdr->front_len);
1411 int data_len = le32_to_cpu(hdr->data_len);
1410 u64 tid; 1412 u64 tid;
1411 int err; 1413 int err;
1412 1414
1413 *skip = 0;
1414 if (type != CEPH_MSG_OSD_OPREPLY)
1415 return NULL;
1416
1417 tid = le64_to_cpu(hdr->tid); 1415 tid = le64_to_cpu(hdr->tid);
1418 mutex_lock(&osdc->request_mutex); 1416 mutex_lock(&osdc->request_mutex);
1419 req = __lookup_request(osdc, tid); 1417 req = __lookup_request(osdc, tid);
1420 if (!req) { 1418 if (!req) {
1421 *skip = 1; 1419 *skip = 1;
1422 m = NULL; 1420 m = NULL;
1423 dout("alloc_msg unknown tid %llu\n", tid); 1421 pr_info("alloc_msg unknown tid %llu from osd%d\n", tid,
1422 osd->o_osd);
1424 goto out; 1423 goto out;
1425 } 1424 }
1426 m = __get_next_reply(con, req, front); 1425 m = __get_next_reply(con, req, front);
@@ -1437,11 +1436,33 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con,
1437 m = ERR_PTR(err); 1436 m = ERR_PTR(err);
1438 } 1437 }
1439 } 1438 }
1439 *skip = 0;
1440 1440
1441out: 1441out:
1442 mutex_unlock(&osdc->request_mutex); 1442 mutex_unlock(&osdc->request_mutex);
1443
1444 return m; 1443 return m;
1444
1445}
1446
1447static struct ceph_msg *alloc_msg(struct ceph_connection *con,
1448 struct ceph_msg_header *hdr,
1449 int *skip)
1450{
1451 struct ceph_osd *osd = con->private;
1452 int type = le16_to_cpu(hdr->type);
1453 int front = le32_to_cpu(hdr->front_len);
1454
1455 switch (type) {
1456 case CEPH_MSG_OSD_MAP:
1457 return ceph_msg_new(type, front, 0, 0, NULL);
1458 case CEPH_MSG_OSD_OPREPLY:
1459 return get_reply(con, hdr, skip);
1460 default:
1461 pr_info("alloc_msg unexpected msg type %d from osd%d\n", type,
1462 osd->o_osd);
1463 *skip = 1;
1464 return NULL;
1465 }
1445} 1466}
1446 1467
1447/* 1468/*