summaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-02-14 14:05:33 -0600
committerAlex Elder <elder@dreamhost.com>2012-03-22 10:47:51 -0500
commit41617d0c9c9832e030667277ddf6b4ffb4ecdc90 (patch)
tree6f943ada9195e794d84506b818ad3d8f0b9a49b9 /net/ceph
parent6173d1f02fb19c0fba02857ae4e1109b5ec95034 (diff)
downloadlinux-3.10-41617d0c9c9832e030667277ddf6b4ffb4ecdc90.tar.gz
linux-3.10-41617d0c9c9832e030667277ddf6b4ffb4ecdc90.tar.bz2
linux-3.10-41617d0c9c9832e030667277ddf6b4ffb4ecdc90.zip
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 c3023a600ad..e1e53bb2d0c 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -240,7 +240,7 @@ static void set_sock_callbacks(struct socket *sock,
/*
* initiate connection to a remote socket.
*/
-static struct socket *ceph_tcp_connect(struct ceph_connection *con)
+static int ceph_tcp_connect(struct ceph_connection *con)
{
struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
struct socket *sock;
@@ -250,7 +250,7 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
IPPROTO_TCP, &sock);
if (ret)
- return ERR_PTR(ret);
+ return ret;
sock->sk->sk_allocation = GFP_NOFS;
#ifdef CONFIG_LOCKDEP
@@ -273,11 +273,11 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
sock_release(sock);
con->error_msg = "connect error";
- return ERR_PTR(ret);
+ return ret;
}
con->sock = sock;
- return sock;
+ return 0;
}
static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len)
@@ -1854,11 +1854,9 @@ more:
con->in_tag = CEPH_MSGR_TAG_READY;
dout("try_write initiating connect on %p new state %lu\n",
con, con->state);
- con->sock = ceph_tcp_connect(con);
- if (IS_ERR(con->sock)) {
- con->sock = NULL;
+ ret = ceph_tcp_connect(con);
+ if (ret < 0) {
con->error_msg = "connect error";
- ret = -1;
goto out;
}
}