]> git.karo-electronics.de Git - linux-beck.git/commitdiff
dlm: fix reconnecting but not sending data
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tue, 11 Aug 2015 22:22:25 +0000 (19:22 -0300)
committerDavid Teigland <teigland@redhat.com>
Mon, 17 Aug 2015 21:22:21 +0000 (16:22 -0500)
There are cases on which lowcomms_connect_sock() is called directly,
which caused the CF_WRITE_PENDING flag to not bet set upon reconnect,
specially on send_to_sock() error handling. On this last, the flag was
already cleared and no further attempt on transmitting would be done.

As dlm tends to connect when it needs to transmit something, it makes
sense to always mark this flag right after the connect.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lowcomms.c

index 4ea64e93e6b19ea24132606cffaca8bb502d18ab..cd008c94efb8bbec0cc1f0123c9bebf7a58b48b5 100644 (file)
@@ -1020,6 +1020,7 @@ socket_err:
 
 out:
        mutex_unlock(&con->sock_mutex);
+       set_bit(CF_WRITE_PENDING, &con->flags);
 }
 
 /* Connect a new socket to its peer */
@@ -1114,6 +1115,7 @@ out_err:
        }
 out:
        mutex_unlock(&con->sock_mutex);
+       set_bit(CF_WRITE_PENDING, &con->flags);
        return;
 }
 
@@ -1502,10 +1504,8 @@ static void process_send_sockets(struct work_struct *work)
 {
        struct connection *con = container_of(work, struct connection, swork);
 
-       if (test_and_clear_bit(CF_CONNECT_PENDING, &con->flags)) {
+       if (test_and_clear_bit(CF_CONNECT_PENDING, &con->flags))
                con->connect_action(con);
-               set_bit(CF_WRITE_PENDING, &con->flags);
-       }
        if (test_and_clear_bit(CF_WRITE_PENDING, &con->flags))
                send_to_sock(con);
 }