diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-23 22:49:27 +0100 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 16:47:45 +0100 |
commit | a5bc3129a296fd4663c3ef0be5575e82453739dd (patch) | |
tree | 96024ed3b2cb7afef2fe860da26be030ec483e0b /net/ceph | |
parent | ceph: use a shared zero page rather than one per messenger (diff) | |
download | linux-a5bc3129a296fd4663c3ef0be5575e82453739dd.tar.xz linux-a5bc3129a296fd4663c3ef0be5575e82453739dd.zip |
ceph: make use of "else" where appropriate
Rearrange ceph_tcp_connect() a bit, making use of "else" rather than
re-testing a value with consecutive "if" statements. Don't record a
connection's socket pointer unless the connect operation is
successful.
Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 738356255e0b..b5536e4e39a1 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -251,7 +251,6 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) IPPROTO_TCP, &sock); if (ret) return ERR_PTR(ret); - con->sock = sock; sock->sk->sk_allocation = GFP_NOFS; #ifdef CONFIG_LOCKDEP @@ -268,18 +267,16 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) dout("connect %s EINPROGRESS sk_state = %u\n", ceph_pr_addr(&con->peer_addr.in_addr), sock->sk->sk_state); - ret = 0; - } - if (ret < 0) { + } else if (ret < 0) { pr_err("connect %s error %d\n", ceph_pr_addr(&con->peer_addr.in_addr), ret); sock_release(sock); - con->sock = NULL; con->error_msg = "connect error"; - } - if (ret < 0) return ERR_PTR(ret); + } + con->sock = sock; + return sock; } |