The idea here is to not create a kernel socket until we know we
have a valid node address. That's how it's done in the sctp version.
This patch changes function tcp_connect_to_sock to match the sctp
function more closely.

Signed-off-by: Bob Peterson <rpete...@redhat.com>
---
 fs/dlm/lowcomms.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index dc9ae6d..977c73b 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1087,12 +1087,6 @@ static void tcp_connect_to_sock(struct connection *con)
        if (con->sock)
                goto out;
 
-       /* Create a socket to communicate with */
-       result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family,
-                                 SOCK_STREAM, IPPROTO_TCP, &sock);
-       if (result < 0)
-               goto out_err;
-
        memset(&saddr, 0, sizeof(saddr));
        result = nodeid_to_addr(con->nodeid, &saddr, NULL, false);
        if (result < 0) {
@@ -1100,6 +1094,12 @@ static void tcp_connect_to_sock(struct connection *con)
                goto out_err;
        }
 
+       /* Create a socket to communicate with */
+       result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family,
+                                 SOCK_STREAM, IPPROTO_TCP, &sock);
+       if (result < 0)
+               goto out_err;
+
        sock->sk->sk_user_data = con;
        con->rx_action = receive_from_sock;
        con->connect_action = tcp_connect_to_sock;
-- 
2.5.0

Reply via email to