Skip to contentSkip to conversation

libceph: Fix ceph_tcp_sendpage()'s more boolean usage

PATCH In review Benoît Canet 3 participants 3 messages Jun 25, 2015 Ceph common code (libceph)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libceph: Fix ceph_tcp_sendpage()'s more boolean usage

Spotted while hunting http://tracker.ceph.com/issues/10905.

From struct ceph_msg_data_cursor in include/linux/ceph/messenger.h:

bool last_piece; /* current is last piece */

In ceph_msg_data_next():

*last_piece = cursor->last_piece;

A call to ceph_msg_data_next() is followed by:

ret = ceph_tcp_sendpage(con->sock, page, page_offset,

			length, last_piece);

while ceph_tcp_sendpage() is:

static int ceph_tcp_sendpage(struct socket *sock, struct page *page,i
int offset, size_t size, bool more)

The logic is inverted: correct it.

---
 net/ceph/messenger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/messenger.c +1 -1
index ec68cd3..eda06fd 100644
@@ -1544,7 +1544,7 @@ static int write_partial_message_data(struct ceph_connection *con)
 		page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
 							&last_piece);
 		ret = ceph_tcp_sendpage(con->sock, page, page_offset,
-				      length, last_piece);
+				      length, !last_piece);
 		if (ret <= 0) {
 			if (do_datacrc)
 				msg->footer.data_crc = cpu_to_le32(crc);
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#1 lore raw
Quoted 32 lines · Benoît Canet

Spotted while hunting http://tracker.ceph.com/issues/10905.

From struct ceph_msg_data_cursor in include/linux/ceph/messenger.h:

bool last_piece; /* current is last piece */

In ceph_msg_data_next():

*last_piece = cursor->last_piece;

A call to ceph_msg_data_next() is followed by:

ret = ceph_tcp_sendpage(con->sock, page, page_offset,

                        length, last_piece);

while ceph_tcp_sendpage() is:

static int ceph_tcp_sendpage(struct socket *sock, struct page *page,i
int offset, size_t size, bool more)

The logic is inverted: correct it.

---
 net/ceph/messenger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/messenger.c +0 -0
index ec68cd3..eda06fd 100644

net/ceph/messenger.c static int write_partial_message_data(struct ceph_connection *con) · line 1550

Quoted 8 lines
net/ceph/messenger.c +1 -1
@@ -1544,7 +1544,7 @@ static int write_partial_message_data(struct ceph_connection *con)
                page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
                                                        &last_piece);
                ret = ceph_tcp_sendpage(con->sock, page, page_offset,
-                                     length, last_piece);
+                                     length, !last_piece);
                if (ret <= 0) {
                        if (do_datacrc)
                                msg->footer.data_crc = cpu_to_le32(crc);

Good catch. Applied.

Thanks,

Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/1
#2 lore raw
In reply to Benoît Canet
Quoted 13 lines · Benoît Canet

Spotted while hunting http://tracker.ceph.com/issues/10905.

From struct ceph_msg_data_cursor in include/linux/ceph/messenger.h:

bool last_piece; /* current is last piece */

In ceph_msg_data_next():

*last_piece = cursor->last_piece;

A call to ceph_msg_data_next() is followed by:

ret = ceph_tcp_sendpage(con->sock, page, page_offset,

Quoted 8 lines
			length, last_piece);

while ceph_tcp_sendpage() is:

static int ceph_tcp_sendpage(struct socket *sock, struct page *page,i
int offset, size_t size, bool more)

The logic is inverted: correct it.

Whoops. I'm surprised we haven't had more trouble from this. This should go to stable too.

Looks good.

Quoted 12 lines
---
  net/ceph/messenger.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/messenger.c +0 -0
index ec68cd3..eda06fd 100644

net/ceph/messenger.c static int write_partial_message_data(struct ceph_connection *con) · line 1550

Quoted 8 lines
net/ceph/messenger.c +1 -1
@@ -1544,7 +1544,7 @@ static int write_partial_message_data(struct ceph_connection *con)
  		page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
  							&last_piece);
  		ret = ceph_tcp_sendpage(con->sock, page, page_offset,
-				      length, last_piece);
+				      length, !last_piece);
  		if (ret <= 0) {
  			if (do_datacrc)
  				msg->footer.data_crc = cpu_to_le32(crc);

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html