dlm: fix lowcomms_connect_node for sctp
authorDavid Teigland <teigland@redhat.com>
Fri, 18 Sep 2009 19:31:47 +0000 (14:31 -0500)
committerDavid Teigland <teigland@redhat.com>
Wed, 30 Sep 2009 17:19:44 +0000 (12:19 -0500)
The recently added dlm_lowcomms_connect_node() from
391fbdc5d527149578490db2f1619951d91f3561 does not work
when using SCTP instead of TCP.  The sctp connection code
has nothing to do without data to send.  Check for no data
in the sctp connection code and do nothing instead of
triggering a BUG.  Also have connect_node() do nothing
when the protocol is sctp.

Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lowcomms.c

index 240cef14fe58b84b95e9c89934e5c322bd896ca6..a3350e4c8184212d0ad9a5b4f759ec4b3e0a8d55 100644 (file)
@@ -316,6 +316,10 @@ int dlm_lowcomms_connect_node(int nodeid)
 {
        struct connection *con;
 
+       /* with sctp there's no connecting without sending */
+       if (dlm_config.ci_protocol != 0)
+               return 0;
+
        if (nodeid == dlm_our_nodeid())
                return 0;
 
@@ -855,11 +859,14 @@ static void sctp_init_assoc(struct connection *con)
        outmessage.msg_flags = MSG_EOR;
 
        spin_lock(&con->writequeue_lock);
-       e = list_entry(con->writequeue.next, struct writequeue_entry,
-                      list);
 
-       BUG_ON((struct list_head *) e == &con->writequeue);
+       if (list_empty(&con->writequeue)) {
+               spin_unlock(&con->writequeue_lock);
+               log_print("writequeue empty for nodeid %d", con->nodeid);
+               return;
+       }
 
+       e = list_first_entry(&con->writequeue, struct writequeue_entry, list);
        len = e->len;
        offset = e->offset;
        spin_unlock(&con->writequeue_lock);