Skip to contentSkip to conversation

libceph: no outbound zero data

PATCH In review Alex Elder 2 participants 2 messages Mar 13, 2013 – Mar 14, 2013 Ceph common code (libceph)

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 libceph: no outbound zero data

There is handling in write_partial_message_data() for the case where only the length of--and no other information about--the data to be sent has been specified. It uses the zero page as the source of data to send in this case.

This case doesn't occur. All message senders set up a page array, pagelist, or bio describing the data to be sent. So eliminate the block of code that handles this (but check and issue a warning for now, just in case it happens for some reason).

This resolves:

    http://tracker.ceph.com/issues/4426
---
 net/ceph/messenger.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
net/ceph/messenger.c +0 -0
index 0d54ca4..c3f2fa1 100644
@@ -1506,13 +1506,10 @@ static int write_partial_message_data(struct

ceph_connection *con)
&length, &last_piece);
#endif
} else {
- size_t resid = data_len - msg_pos->data_pos;
-
- page = zero_page;
- page_offset = msg_pos->page_pos;
- length = PAGE_SIZE - page_offset;
- length = min(resid, length);
- last_piece = length == resid;
+ WARN(1, "con %p data_len %u but no outbound data\n",
+ con, data_len);
+ ret = -EINVAL;
+ goto out;
}
if (do_datacrc && !msg_pos->did_page_crc) {
u32 crc = le32_to_cpu(msg->footer.data_crc);

Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 42 lines · Alex Elder

There is handling in write_partial_message_data() for the case where only the length of--and no other information about--the data to be sent has been specified. It uses the zero page as the source of data to send in this case.

This case doesn't occur. All message senders set up a page array, pagelist, or bio describing the data to be sent. So eliminate the block of code that handles this (but check and issue a warning for now, just in case it happens for some reason).

This resolves:

     http://tracker.ceph.com/issues/4426
---
  net/ceph/messenger.c |   11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)
net/ceph/messenger.c +4 -7
index 0d54ca4..c3f2fa1 100644
@@ -1506,13 +1506,10 @@ static int write_partial_message_data(struct
 ceph_connection *con)
  							&length, &last_piece);
  #endif
  		} else {
-			size_t resid = data_len - msg_pos->data_pos;
-
-			page = zero_page;
-			page_offset = msg_pos->page_pos;
-			length = PAGE_SIZE - page_offset;
-			length = min(resid, length);
-			last_piece = length == resid;
+			WARN(1, "con %p data_len %u but no outbound data\n",
+				con, data_len);
+			ret = -EINVAL;
+			goto out;
  		}
  		if (do_datacrc && !msg_pos->did_page_crc) {
  			u32 crc = le32_to_cpu(msg->footer.data_crc);