aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-02-14 15:05:33 -0500
committerAlex Elder <elder@dreamhost.com>2012-03-22 11:47:51 -0400
commit41617d0c9c9832e030667277ddf6b4ffb4ecdc90 (patch)
tree6f943ada9195e794d84506b818ad3d8f0b9a49b9 /net/ceph
parent6173d1f02fb19c0fba02857ae4e1109b5ec95034 (diff)
libceph: make ceph_tcp_connect() return int
There is no real need for ceph_tcp_connect() to return the socket pointer it creates, since it already assigns it to con->sock, which is visible to the caller. Instead, have it return an error code, which tidies things up a bit. 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.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index c3023a600ad2..e1e53bb2d0cf 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -240,7 +240,7 @@ static void set_sock_callbacks(struct socket *sock,
240/* 240/*
241 * initiate connection to a remote socket. 241 * initiate connection to a remote socket.
242 */ 242 */
243static struct socket *ceph_tcp_connect(struct ceph_connection *con) 243static int ceph_tcp_connect(struct ceph_connection *con)
244{ 244{
245 struct sockaddr_storage *paddr = &con->peer_addr.in_addr; 245 struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
246 struct socket *sock; 246 struct socket *sock;
@@ -250,7 +250,7 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
250 ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM, 250 ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
251 IPPROTO_TCP, &sock); 251 IPPROTO_TCP, &sock);
252 if (ret) 252 if (ret)
253 return ERR_PTR(ret); 253 return ret;
254 sock->sk->sk_allocation = GFP_NOFS; 254 sock->sk->sk_allocation = GFP_NOFS;
255 255
256#ifdef CONFIG_LOCKDEP 256#ifdef CONFIG_LOCKDEP
@@ -273,11 +273,11 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
273 sock_release(sock); 273 sock_release(sock);
274 con->error_msg = "connect error"; 274 con->error_msg = "connect error";
275 275
276 return ERR_PTR(ret); 276 return ret;
277 } 277 }
278 con->sock = sock; 278 con->sock = sock;
279 279
280 return sock; 280 return 0;
281} 281}
282 282
283static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) 283static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
@@ -1854,11 +1854,9 @@ more:
1854 con->in_tag = CEPH_MSGR_TAG_READY; 1854 con->in_tag = CEPH_MSGR_TAG_READY;
1855 dout("try_write initiating connect on %p new state %lu\n", 1855 dout("try_write initiating connect on %p new state %lu\n",
1856 con, con->state); 1856 con, con->state);
1857 con->sock = ceph_tcp_connect(con); 1857 ret = ceph_tcp_connect(con);
1858 if (IS_ERR(con->sock)) { 1858 if (ret < 0) {
1859 con->sock = NULL;
1860 con->error_msg = "connect error"; 1859 con->error_msg = "connect error";
1861 ret = -1;
1862 goto out; 1860 goto out;
1863 } 1861 }
1864 } 1862 }