[patch 2/9] dlm: don't add duplicate node addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If an address has already been set for a node, don't add it again.

Signed-off-by: David Teigland <[email protected]>

Index: linux/drivers/dlm/lowcomms.c
===================================================================
--- linux.orig/drivers/dlm/lowcomms.c	2005-06-02 12:28:30.000000000 +0800
+++ linux/drivers/dlm/lowcomms.c	2005-06-02 12:52:51.391577056 +0800
@@ -272,6 +272,7 @@
 int dlm_set_local(int nodeid, int weight, char *addr_buf)
 {
 	struct sockaddr_storage *addr;
+	int i;
 
 	if (local_count > DLM_MAX_ADDR_COUNT - 1) {
 		log_print("too many local addresses set %d", local_count);
@@ -284,7 +285,15 @@
 	if (!addr)
 		return -ENOMEM;
 	memcpy(addr, addr_buf, sizeof(*addr));
+
+	for (i = 0; i < local_count; i++) {
+		if (!memcmp(local_addr[i], addr, sizeof(*addr))) {
+			kfree(addr);
+			goto out;
+		}
+	}
 	local_addr[local_count++] = addr;
+ out:
 	return 0;
 }
 

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux