diff options
author | Alex Elder <elder@inktank.com> | 2013-03-04 23:29:57 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:16:41 -0400 |
commit | ebf18f47093e968105767eed4a0aa155e86b224e (patch) | |
tree | 90122481017a894850e46b8c86987bd31548fddc | |
parent | 27fa83852ba275361eaa1a1283cf6704fa8191a6 (diff) |
ceph: only set message data pointers if non-empty
Change it so we only assign outgoing data information for messages
if there is outgoing data to send.
This then allows us to add a few more (currently commented-out)
assertions.
This is related to:
http://tracker.ceph.com/issues/4284
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
-rw-r--r-- | fs/ceph/mds_client.c | 13 | ||||
-rw-r--r-- | net/ceph/messenger.c | 4 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 9 |
3 files changed, 20 insertions, 6 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 3b2aa8702ae0..600d770d70f7 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1721,7 +1721,11 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
1721 | msg->front.iov_len = p - msg->front.iov_base; | 1721 | msg->front.iov_len = p - msg->front.iov_base; |
1722 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); | 1722 | msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); |
1723 | 1723 | ||
1724 | ceph_msg_data_set_pages(msg, req->r_pages, req->r_data_len, 0); | 1724 | if (req->r_data_len) { |
1725 | /* outbound data set only by ceph_sync_setxattr() */ | ||
1726 | BUG_ON(!req->r_pages); | ||
1727 | ceph_msg_data_set_pages(msg, req->r_pages, req->r_data_len, 0); | ||
1728 | } | ||
1725 | 1729 | ||
1726 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); | 1730 | msg->hdr.data_len = cpu_to_le32(req->r_data_len); |
1727 | msg->hdr.data_off = cpu_to_le16(0); | 1731 | msg->hdr.data_off = cpu_to_le16(0); |
@@ -2603,10 +2607,13 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, | |||
2603 | goto fail; | 2607 | goto fail; |
2604 | } | 2608 | } |
2605 | 2609 | ||
2606 | ceph_msg_data_set_pagelist(reply, pagelist); | ||
2607 | if (recon_state.flock) | 2610 | if (recon_state.flock) |
2608 | reply->hdr.version = cpu_to_le16(2); | 2611 | reply->hdr.version = cpu_to_le16(2); |
2609 | reply->hdr.data_len = cpu_to_le32(pagelist->length); | 2612 | if (pagelist->length) { |
2613 | /* set up outbound data if we have any */ | ||
2614 | reply->hdr.data_len = cpu_to_le32(pagelist->length); | ||
2615 | ceph_msg_data_set_pagelist(reply, pagelist); | ||
2616 | } | ||
2610 | ceph_con_send(&session->s_con, reply); | 2617 | ceph_con_send(&session->s_con, reply); |
2611 | 2618 | ||
2612 | mutex_unlock(&session->s_mutex); | 2619 | mutex_unlock(&session->s_mutex); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index d1183536d5a8..1965d785cf83 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2692,6 +2692,8 @@ EXPORT_SYMBOL(ceph_con_keepalive); | |||
2692 | void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, | 2692 | void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, |
2693 | size_t length, size_t alignment) | 2693 | size_t length, size_t alignment) |
2694 | { | 2694 | { |
2695 | /* BUG_ON(!pages); */ | ||
2696 | /* BUG_ON(!length); */ | ||
2695 | /* BUG_ON(msg->pages); */ | 2697 | /* BUG_ON(msg->pages); */ |
2696 | /* BUG_ON(msg->page_count); */ | 2698 | /* BUG_ON(msg->page_count); */ |
2697 | 2699 | ||
@@ -2705,6 +2707,7 @@ void ceph_msg_data_set_pagelist(struct ceph_msg *msg, | |||
2705 | struct ceph_pagelist *pagelist) | 2707 | struct ceph_pagelist *pagelist) |
2706 | { | 2708 | { |
2707 | /* BUG_ON(!pagelist); */ | 2709 | /* BUG_ON(!pagelist); */ |
2710 | /* BUG_ON(!pagelist->length); */ | ||
2708 | /* BUG_ON(msg->pagelist); */ | 2711 | /* BUG_ON(msg->pagelist); */ |
2709 | 2712 | ||
2710 | msg->pagelist = pagelist; | 2713 | msg->pagelist = pagelist; |
@@ -2723,6 +2726,7 @@ EXPORT_SYMBOL(ceph_msg_data_set_bio); | |||
2723 | void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist *trail) | 2726 | void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist *trail) |
2724 | { | 2727 | { |
2725 | /* BUG_ON(!trail); */ | 2728 | /* BUG_ON(!trail); */ |
2729 | /* BUG_ON(!trail->length); */ | ||
2726 | /* BUG_ON(msg->trail); */ | 2730 | /* BUG_ON(msg->trail); */ |
2727 | 2731 | ||
2728 | msg->trail = trail; | 2732 | msg->trail = trail; |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 387e3123d1ed..4402e917b9b1 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1759,8 +1759,10 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1759 | osd_data = &req->r_data_out; | 1759 | osd_data = &req->r_data_out; |
1760 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { | 1760 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { |
1761 | BUG_ON(osd_data->length > (u64) SIZE_MAX); | 1761 | BUG_ON(osd_data->length > (u64) SIZE_MAX); |
1762 | ceph_msg_data_set_pages(req->r_request, osd_data->pages, | 1762 | if (osd_data->length) |
1763 | osd_data->length, osd_data->alignment); | 1763 | ceph_msg_data_set_pages(req->r_request, |
1764 | osd_data->pages, osd_data->length, | ||
1765 | osd_data->alignment); | ||
1764 | #ifdef CONFIG_BLOCK | 1766 | #ifdef CONFIG_BLOCK |
1765 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { | 1767 | } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { |
1766 | ceph_msg_data_set_bio(req->r_request, osd_data->bio); | 1768 | ceph_msg_data_set_bio(req->r_request, osd_data->bio); |
@@ -1768,7 +1770,8 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1768 | } else { | 1770 | } else { |
1769 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE); | 1771 | BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE); |
1770 | } | 1772 | } |
1771 | ceph_msg_data_set_trail(req->r_request, &req->r_trail); | 1773 | if (req->r_trail.length) |
1774 | ceph_msg_data_set_trail(req->r_request, &req->r_trail); | ||
1772 | 1775 | ||
1773 | register_request(osdc, req); | 1776 | register_request(osdc, req); |
1774 | 1777 | ||