[DLM] PATCH 2/3 dlm: lowcomms close
authorDavid Teigland <teigland@redhat.com>
Fri, 28 Apr 2006 14:50:41 +0000 (10:50 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 28 Apr 2006 14:50:41 +0000 (10:50 -0400)
When a node is removed from a lockspace configuration, close our
connection to it, clearing any remaining messages for it.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Patrick Caulfield <pcaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/dlm/config.c
fs/dlm/lowcomms.c
fs/dlm/lowcomms.h
fs/dlm/member.c

index 87df9616415e5d38bacd1359a8d64625b1055562..88553054bbfa4cd7a03efdf41036e75b54255d7a 100644 (file)
@@ -17,6 +17,7 @@
 #include <net/sock.h>
 
 #include "config.h"
+#include "lowcomms.h"
 
 /*
  * /config/dlm/<cluster>/spaces/<space>/nodes/<node>/nodeid
@@ -429,6 +430,7 @@ static void drop_comm(struct config_group *g, struct config_item *i)
        struct comm *cm = to_comm(i);
        if (local_comm == cm)
                local_comm = NULL;
+       dlm_lowcomms_close(cm->nodeid);
        while (cm->addr_count--)
                kfree(cm->addr[cm->addr_count]);
        config_item_put(i);
index 09b0124f7fc41cfbe61605de8ed082e9832c68b2..cdd168e4bf450cb944399ceee62c710339c23f71 100644 (file)
@@ -1063,6 +1063,27 @@ static void dealloc_nodeinfo(void)
        }
 }
 
+int dlm_lowcomms_close(int nodeid)
+{
+       struct nodeinfo *ni;
+
+       ni = nodeid2nodeinfo(nodeid, 0);
+       if (!ni)
+               return -1;
+
+       spin_lock(&ni->lock);
+       if (ni->assoc_id) {
+               ni->assoc_id = 0;
+               /* Don't send shutdown here, sctp will just queue it
+                  till the node comes back up! */
+       }
+       spin_unlock(&ni->lock);
+
+       clean_one_writequeue(ni);
+       clear_bit(NI_INIT_PENDING, &ni->flags);
+       return 0;
+}
+
 static int write_list_empty(void)
 {
        int status;
index 3af8035ff12fcd11c61c35822c98276d706fc297..6c04bb09cfa8dc73b081b39fe3625f5904ff7686 100644 (file)
@@ -18,6 +18,7 @@ int dlm_lowcomms_init(void);
 void dlm_lowcomms_exit(void);
 int dlm_lowcomms_start(void);
 void dlm_lowcomms_stop(void);
+int dlm_lowcomms_close(int nodeid);
 void *dlm_lowcomms_get_buffer(int nodeid, int len, int allocation, char **ppc);
 void dlm_lowcomms_commit_buffer(void *mh);
 
index 926cd0cb6bffff1017c2cbebcd860a3053f9f597..cd0c51e724e07aae24b2b1ea3fa4463accc9faf5 100644 (file)
@@ -15,7 +15,6 @@
 #include "member.h"
 #include "recoverd.h"
 #include "recover.h"
-#include "lowcomms.h"
 #include "rcom.h"
 #include "config.h"