mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 2/9] dlm: don't add duplicate node addresses
@ 2005-06-02  8:02 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2005-06-02  8:02 UTC (permalink / raw)
  To: akpm, linux-kernel

[-- Attachment #1: no-duplicate-addrs.patch --]
[-- Type: text/plain, Size: 895 bytes --]

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

Signed-off-by: David Teigland <teigland@redhat.com>

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;
 }
 

--


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-02  7:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-02  8:02 [patch 2/9] dlm: don't add duplicate node addresses David Teigland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®