diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-23 16:49:27 -0500 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 11:47:45 -0400 |
commit | a5bc3129a296fd4663c3ef0be5575e82453739dd (patch) | |
tree | 96024ed3b2cb7afef2fe860da26be030ec483e0b /net/ceph | |
parent | 5766651971e81298732466c9aa462ff47898ba37 (diff) |
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) | |||
251 | IPPROTO_TCP, &sock); | 251 | IPPROTO_TCP, &sock); |
252 | if (ret) | 252 | if (ret) |
253 | return ERR_PTR(ret); | 253 | return ERR_PTR(ret); |
254 | con->sock = sock; | ||
255 | sock->sk->sk_allocation = GFP_NOFS; | 254 | sock->sk->sk_allocation = GFP_NOFS; |
256 | 255 | ||
257 | #ifdef CONFIG_LOCKDEP | 256 | #ifdef CONFIG_LOCKDEP |
@@ -268,18 +267,16 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) | |||
268 | dout("connect %s EINPROGRESS sk_state = %u\n", | 267 | dout("connect %s EINPROGRESS sk_state = %u\n", |
269 | ceph_pr_addr(&con->peer_addr.in_addr), | 268 | ceph_pr_addr(&con->peer_addr.in_addr), |
270 | sock->sk->sk_state); | 269 | sock->sk->sk_state); |
271 | ret = 0; | 270 | } else if (ret < 0) { |
272 | } | ||
273 | if (ret < 0) { | ||
274 | pr_err("connect %s error %d\n", | 271 | pr_err("connect %s error %d\n", |
275 | ceph_pr_addr(&con->peer_addr.in_addr), ret); | 272 | ceph_pr_addr(&con->peer_addr.in_addr), ret); |
276 | sock_release(sock); | 273 | sock_release(sock); |
277 | con->sock = NULL; | ||
278 | con->error_msg = "connect error"; | 274 | con->error_msg = "connect error"; |
279 | } | ||
280 | 275 | ||
281 | if (ret < 0) | ||
282 | return ERR_PTR(ret); | 276 | return ERR_PTR(ret); |
277 | } | ||
278 | con->sock = sock; | ||
279 | |||
283 | return sock; | 280 | return sock; |
284 | } | 281 | } |
285 | 282 | ||