diff options
author | Alex Elder <elder@inktank.com> | 2012-05-16 15:16:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-26 11:38:05 -0800 |
commit | 59a521ebc05d2bd826d19c4a9a6fb00c313f6a52 (patch) | |
tree | 49c30f119f8a9be076ee63355b9baf63e881e8a2 /net | |
parent | 7dd07ab6bdc7634e99747557d6ba342b639b13d9 (diff) |
ceph: don't set WRITE_PENDING too early
(cherry picked from commit e10c758e4031a801ea4d2f8fb39bf14c2658d74b)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/messenger.c | 6 |
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) { 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; } /* |