aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-16 16:16:38 -0400
committerAlex Elder <elder@dreamhost.com>2012-05-17 09:18:12 -0400
commite10c758e4031a801ea4d2f8fb39bf14c2658d74b (patch)
treedb67e6d84e5fa76b4d573d4f551019141115af01 /net/ceph/messenger.c
parente825a66df97776d30a48a187e3a986736af43945 (diff)
ceph: don't set WRITE_PENDING too early
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>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 47499dc0e41..cf292939dd1 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -697,6 +697,7 @@ static int prepare_write_connect(struct ceph_connection *con)
697{ 697{
698 unsigned global_seq = get_global_seq(con->msgr, 0); 698 unsigned global_seq = get_global_seq(con->msgr, 0);
699 int proto; 699 int proto;
700 int ret;
700 701
701 switch (con->peer_name.type) { 702 switch (con->peer_name.type) {
702 case CEPH_ENTITY_TYPE_MON: 703 case CEPH_ENTITY_TYPE_MON:
@@ -723,11 +724,14 @@ static int prepare_write_connect(struct ceph_connection *con)
723 con->out_connect.flags = 0; 724 con->out_connect.flags = 0;
724 725
725 ceph_con_out_kvec_add(con, sizeof (con->out_connect), &con->out_connect); 726 ceph_con_out_kvec_add(con, sizeof (con->out_connect), &con->out_connect);
727 ret = prepare_connect_authorizer(con);
728 if (ret)
729 return ret;
726 730
727 con->out_more = 0; 731 con->out_more = 0;
728 set_bit(WRITE_PENDING, &con->state); 732 set_bit(WRITE_PENDING, &con->state);
729 733
730 return prepare_connect_authorizer(con); 734 return 0;
731} 735}
732 736
733/* 737/*