This is a note to let you know that I've just added the patch titled

    ceph: messenger: update "to" in read_partial() caller

to the 3.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     0008-ceph-messenger-update-to-in-read_partial-caller.patch
and it can be found in the queue-3.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 9421e64f2c08f167f10bf34879b4b2ed32060b5c Mon Sep 17 00:00:00 2001
From: Alex Elder <[email protected]>
Date: Thu, 10 May 2012 10:29:50 -0500
Subject: ceph: messenger: update "to" in read_partial() caller

From: Alex Elder <[email protected]>

(cherry picked from commit e6cee71fac27c946a0bbad754dd076e66c4e9dbd)

read_partial() always increases whatever "to" value is supplied by
adding the requested size to it, and that's the only thing it does
with that pointed-to value.

Do that pointer advance in the caller (and then only when the
updated value will be subsequently used), and change the "to"
parameter to be an in-only and non-pointer value.

Signed-off-by: Alex Elder <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 net/ceph/messenger.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -992,11 +992,12 @@ static int prepare_read_message(struct c
 
 
 static int read_partial(struct ceph_connection *con,
-                       int *to, int size, void *object)
+                       int to, int size, void *object)
 {
-       *to += size;
-       while (con->in_base_pos < *to) {
-               int left = *to - con->in_base_pos;
+       int end = to + size;
+
+       while (con->in_base_pos < end) {
+               int left = end - con->in_base_pos;
                int have = size - left;
                int ret = ceph_tcp_recvmsg(con->sock, object + have, left);
                if (ret <= 0)
@@ -1017,14 +1018,16 @@ static int read_partial_banner(struct ce
        dout("read_partial_banner %p at %d\n", con, con->in_base_pos);
 
        /* peer's banner */
-       ret = read_partial(con, &to, strlen(CEPH_BANNER), con->in_banner);
+       ret = read_partial(con, to, strlen(CEPH_BANNER), con->in_banner);
        if (ret <= 0)
                goto out;
-       ret = read_partial(con, &to, sizeof(con->actual_peer_addr),
+       to += strlen(CEPH_BANNER);
+       ret = read_partial(con, to, sizeof(con->actual_peer_addr),
                           &con->actual_peer_addr);
        if (ret <= 0)
                goto out;
-       ret = read_partial(con, &to, sizeof(con->peer_addr_for_me),
+       to += sizeof(con->actual_peer_addr);
+       ret = read_partial(con, to, sizeof(con->peer_addr_for_me),
                           &con->peer_addr_for_me);
        if (ret <= 0)
                goto out;
@@ -1038,10 +1041,11 @@ static int read_partial_connect(struct c
 
        dout("read_partial_connect %p at %d\n", con, con->in_base_pos);
 
-       ret = read_partial(con, &to, sizeof(con->in_reply), &con->in_reply);
+       ret = read_partial(con, to, sizeof(con->in_reply), &con->in_reply);
        if (ret <= 0)
                goto out;
-       ret = read_partial(con, &to, le32_to_cpu(con->in_reply.authorizer_len),
+       to += sizeof(con->in_reply);
+       ret = read_partial(con, to, le32_to_cpu(con->in_reply.authorizer_len),
                           con->auth_reply_buf);
        if (ret <= 0)
                goto out;
@@ -1491,9 +1495,7 @@ static int process_connect(struct ceph_c
  */
 static int read_partial_ack(struct ceph_connection *con)
 {
-       int to = 0;
-
-       return read_partial(con, &to, sizeof(con->in_temp_ack),
+       return read_partial(con, 0, sizeof(con->in_temp_ack),
                            &con->in_temp_ack);
 }
 
@@ -1638,8 +1640,7 @@ static int read_partial_message(struct c
        dout("read_partial_message con %p msg %p\n", con, m);
 
        /* header */
-       to = 0;
-       ret = read_partial(con, &to, sizeof (con->in_hdr), &con->in_hdr);
+       ret = read_partial(con, 0, sizeof (con->in_hdr), &con->in_hdr);
        if (ret <= 0)
                return ret;
 
@@ -1755,7 +1756,7 @@ static int read_partial_message(struct c
 
        /* footer */
        to = sizeof (m->hdr);
-       ret = read_partial(con, &to, sizeof (m->footer), &m->footer);
+       ret = read_partial(con, to, sizeof (m->footer), &m->footer);
        if (ret <= 0)
                return ret;
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.4/0005-crush-fix-memory-leak-when-destroying-tree-buckets.patch
queue-3.4/0002-crush-adjust-local-retry-threshold.patch
queue-3.4/0003-crush-be-more-tolerant-of-nonsensical-crush-maps.patch
queue-3.4/0001-crush-clean-up-types-const-ness.patch
queue-3.4/0008-ceph-messenger-update-to-in-read_partial-caller.patch
queue-3.4/0007-ceph-messenger-use-read_partial-in-read_partial_mess.patch
queue-3.4/0004-crush-fix-tree-node-weight-lookup.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to