]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ceph: don't set WRITE_PENDING too early
authorAlex Elder <elder@inktank.com>
Wed, 16 May 2012 20:16:38 +0000 (15:16 -0500)
committerAlex Elder <elder@dreamhost.com>
Thu, 17 May 2012 13:18:12 +0000 (08:18 -0500)
prepare_write_connect() prepares a connect message, then sets
WRITE_PENDING on the connection.  Then *after* this, it calls
prepare_connect_authorizer(), which updates the content of the
connection buffer already queued for sending.  It's also possible it
will result in prepare_write_connect() returning -EAGAIN despite the
WRITE_PENDING big getting set.

Fix this by preparing the connect authorizer first, setting the
WRITE_PENDING bit only after that is done.

Partially addresses http://tracker.newdream.net/issues/2424

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
net/ceph/messenger.c

index 47499dc0e413f575bab80e7790da91fe38524014..cf292939dd1e72c4dc6f0381e45ae05f4c9704ca 100644 (file)
@@ -697,6 +697,7 @@ static int prepare_write_connect(struct ceph_connection *con)
 {
        unsigned global_seq = get_global_seq(con->msgr, 0);
        int proto;
+       int ret;
 
        switch (con->peer_name.type) {
        case CEPH_ENTITY_TYPE_MON:
@@ -723,11 +724,14 @@ static int prepare_write_connect(struct ceph_connection *con)
        con->out_connect.flags = 0;
 
        ceph_con_out_kvec_add(con, sizeof (con->out_connect), &con->out_connect);
+       ret = prepare_connect_authorizer(con);
+       if (ret)
+               return ret;
 
        con->out_more = 0;
        set_bit(WRITE_PENDING, &con->state);
 
-       return prepare_connect_authorizer(con);
+       return 0;
 }
 
 /*