diff options
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 0e8157ee5d43..b6ff4a1519ab 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -97,11 +97,9 @@ struct workqueue_struct *ceph_msgr_wq; | |||
97 | int ceph_msgr_init(void) | 97 | int ceph_msgr_init(void) |
98 | { | 98 | { |
99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); | 99 | ceph_msgr_wq = create_workqueue("ceph-msgr"); |
100 | if (IS_ERR(ceph_msgr_wq)) { | 100 | if (!ceph_msgr_wq) { |
101 | int ret = PTR_ERR(ceph_msgr_wq); | 101 | pr_err("msgr_init failed to create workqueue\n"); |
102 | pr_err("msgr_init failed to create workqueue: %d\n", ret); | 102 | return -ENOMEM; |
103 | ceph_msgr_wq = NULL; | ||
104 | return ret; | ||
105 | } | 103 | } |
106 | return 0; | 104 | return 0; |
107 | } | 105 | } |
@@ -540,8 +538,7 @@ static void prepare_write_message(struct ceph_connection *con) | |||
540 | /* initialize page iterator */ | 538 | /* initialize page iterator */ |
541 | con->out_msg_pos.page = 0; | 539 | con->out_msg_pos.page = 0; |
542 | if (m->pages) | 540 | if (m->pages) |
543 | con->out_msg_pos.page_pos = | 541 | con->out_msg_pos.page_pos = m->page_alignment; |
544 | le16_to_cpu(m->hdr.data_off) & ~PAGE_MASK; | ||
545 | else | 542 | else |
546 | con->out_msg_pos.page_pos = 0; | 543 | con->out_msg_pos.page_pos = 0; |
547 | con->out_msg_pos.data_pos = 0; | 544 | con->out_msg_pos.data_pos = 0; |
@@ -1491,7 +1488,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
1491 | struct ceph_msg *m = con->in_msg; | 1488 | struct ceph_msg *m = con->in_msg; |
1492 | int ret; | 1489 | int ret; |
1493 | int to, left; | 1490 | int to, left; |
1494 | unsigned front_len, middle_len, data_len, data_off; | 1491 | unsigned front_len, middle_len, data_len; |
1495 | int datacrc = con->msgr->nocrc; | 1492 | int datacrc = con->msgr->nocrc; |
1496 | int skip; | 1493 | int skip; |
1497 | u64 seq; | 1494 | u64 seq; |
@@ -1527,19 +1524,17 @@ static int read_partial_message(struct ceph_connection *con) | |||
1527 | data_len = le32_to_cpu(con->in_hdr.data_len); | 1524 | data_len = le32_to_cpu(con->in_hdr.data_len); |
1528 | if (data_len > CEPH_MSG_MAX_DATA_LEN) | 1525 | if (data_len > CEPH_MSG_MAX_DATA_LEN) |
1529 | return -EIO; | 1526 | return -EIO; |
1530 | data_off = le16_to_cpu(con->in_hdr.data_off); | ||
1531 | 1527 | ||
1532 | /* verify seq# */ | 1528 | /* verify seq# */ |
1533 | seq = le64_to_cpu(con->in_hdr.seq); | 1529 | seq = le64_to_cpu(con->in_hdr.seq); |
1534 | if ((s64)seq - (s64)con->in_seq < 1) { | 1530 | if ((s64)seq - (s64)con->in_seq < 1) { |
1535 | pr_info("skipping %s%lld %s seq %lld, expected %lld\n", | 1531 | pr_info("skipping %s%lld %s seq %lld expected %lld\n", |
1536 | ENTITY_NAME(con->peer_name), | 1532 | ENTITY_NAME(con->peer_name), |
1537 | ceph_pr_addr(&con->peer_addr.in_addr), | 1533 | ceph_pr_addr(&con->peer_addr.in_addr), |
1538 | seq, con->in_seq + 1); | 1534 | seq, con->in_seq + 1); |
1539 | con->in_base_pos = -front_len - middle_len - data_len - | 1535 | con->in_base_pos = -front_len - middle_len - data_len - |
1540 | sizeof(m->footer); | 1536 | sizeof(m->footer); |
1541 | con->in_tag = CEPH_MSGR_TAG_READY; | 1537 | con->in_tag = CEPH_MSGR_TAG_READY; |
1542 | con->in_seq++; | ||
1543 | return 0; | 1538 | return 0; |
1544 | } else if ((s64)seq - (s64)con->in_seq > 1) { | 1539 | } else if ((s64)seq - (s64)con->in_seq > 1) { |
1545 | pr_err("read_partial_message bad seq %lld expected %lld\n", | 1540 | pr_err("read_partial_message bad seq %lld expected %lld\n", |
@@ -1576,7 +1571,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
1576 | 1571 | ||
1577 | con->in_msg_pos.page = 0; | 1572 | con->in_msg_pos.page = 0; |
1578 | if (m->pages) | 1573 | if (m->pages) |
1579 | con->in_msg_pos.page_pos = data_off & ~PAGE_MASK; | 1574 | con->in_msg_pos.page_pos = m->page_alignment; |
1580 | else | 1575 | else |
1581 | con->in_msg_pos.page_pos = 0; | 1576 | con->in_msg_pos.page_pos = 0; |
1582 | con->in_msg_pos.data_pos = 0; | 1577 | con->in_msg_pos.data_pos = 0; |
@@ -2301,6 +2296,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) | |||
2301 | 2296 | ||
2302 | /* data */ | 2297 | /* data */ |
2303 | m->nr_pages = 0; | 2298 | m->nr_pages = 0; |
2299 | m->page_alignment = 0; | ||
2304 | m->pages = NULL; | 2300 | m->pages = NULL; |
2305 | m->pagelist = NULL; | 2301 | m->pagelist = NULL; |
2306 | m->bio = NULL; | 2302 | m->bio = NULL; |
@@ -2370,6 +2366,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con, | |||
2370 | type, front_len); | 2366 | type, front_len); |
2371 | return NULL; | 2367 | return NULL; |
2372 | } | 2368 | } |
2369 | msg->page_alignment = le16_to_cpu(hdr->data_off); | ||
2373 | } | 2370 | } |
2374 | memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); | 2371 | memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); |
2375 | 2372 | ||