lkml.org 
[lkml]   [2005]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 2/9] dlm: don't add duplicate node addresses
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;
}

--

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

\
 
 \ /
  Last update: 2005-06-02 10:05    [W:0.034 / U:6.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site