public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2011-09-25 19:37 zkabelac
  0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2011-09-25 19:37 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-09-25 19:37:01

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-command.c clvmd-comms.h 
	                 clvmd-corosync.c clvmd-openais.c 
	                 clvmd-singlenode.c 
Added files:
	test           : t-clvmd-restart.sh 

Log message:
	Restart CLVMD with same cluster manager
	
	Add named cluster_ops to easily learn the name of the active cluster manager,
	so we are able to restart singlenode manager in testing.
	
	Add simple test for clvmd -S  (restart) and -R (refresh)
	(though it needs some extensions).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2138&r2=1.2139
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-comms.h.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-singlenode.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-clvmd-restart.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1

--- LVM2/WHATS_NEW	2011/09/24 21:19:30	1.2138
+++ LVM2/WHATS_NEW	2011/09/25 19:37:00	1.2139
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Restart CLVMD with same cluster manager.
   Fix log_error() usage in raid and unknown segtype initialisation.
   Improve testing Makefile.
   Fix install_ocf make target when srcdir != builddir. (2.02.80)
--- LVM2/daemons/clvmd/clvmd-cman.c	2011/01/19 23:09:31	1.29
+++ LVM2/daemons/clvmd/clvmd-cman.c	2011/09/25 19:37:00	1.30
@@ -479,6 +479,7 @@
 }
 
 static struct cluster_ops _cluster_cman_ops = {
+	.name                     = "cman",
 	.cluster_init_completed   = _cluster_init_completed,
 	.cluster_send_message     = _cluster_send_message,
 	.name_from_csid           = _name_from_csid,
--- LVM2/daemons/clvmd/clvmd-command.c	2011/09/24 20:50:36	1.59
+++ LVM2/daemons/clvmd/clvmd-command.c	2011/09/25 19:37:00	1.60
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -381,7 +381,7 @@
 	} while (hn);
 
 	/* clvmd + locks (-E uuid) + debug (-d X) + NULL */
-	if (!(argv = malloc((max_locks * 2 + 4) * sizeof(*argv))))
+	if (!(argv = malloc((max_locks * 2 + 5) * sizeof(*argv))))
 		goto_out;
 
 	/*
@@ -396,10 +396,8 @@
 		argv[argc++] = debug_arg;
 	}
 
-	/*
-	 * FIXME: specify used cluster backend
-	 * argv[argc++] = strdup("-Isinglenode");
-	 */
+	argv[argc++] = "-I";
+	argv[argc++] = clops->name;
 
 	/* Now add the exclusively-open LVs */
 	hn = NULL;
--- LVM2/daemons/clvmd/clvmd-comms.h	2011/08/09 18:11:00	1.13
+++ LVM2/daemons/clvmd/clvmd-comms.h	2011/09/25 19:37:00	1.14
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -23,6 +23,7 @@
 struct local_client;
 
 struct cluster_ops {
+	const char *name;
 	void (*cluster_init_completed) (void);
 
 	int (*cluster_send_message) (const void *buf, int msglen,
--- LVM2/daemons/clvmd/clvmd-corosync.c	2011/01/19 23:09:31	1.15
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2011/09/25 19:37:00	1.16
@@ -598,6 +598,7 @@
 }
 
 static struct cluster_ops _cluster_corosync_ops = {
+	.name                     = "corosync",
 	.cluster_init_completed   = NULL,
 	.cluster_send_message     = _cluster_send_message,
 	.name_from_csid           = _name_from_csid,
--- LVM2/daemons/clvmd/clvmd-openais.c	2011/03/13 18:08:26	1.17
+++ LVM2/daemons/clvmd/clvmd-openais.c	2011/09/25 19:37:00	1.18
@@ -667,6 +667,7 @@
 }
 
 static struct cluster_ops _cluster_openais_ops = {
+	.name                     = "openais",
 	.cluster_init_completed   = NULL,
 	.cluster_send_message     = _cluster_send_message,
 	.name_from_csid           = _name_from_csid,
--- LVM2/daemons/clvmd/clvmd-singlenode.c	2011/08/04 12:13:51	1.11
+++ LVM2/daemons/clvmd/clvmd-singlenode.c	2011/09/25 19:37:00	1.12
@@ -267,6 +267,7 @@
 }
 
 static struct cluster_ops _cluster_singlenode_ops = {
+	.name                     = "singlenode",
 	.cluster_init_completed   = NULL,
 	.cluster_send_message     = _cluster_send_message,
 	.name_from_csid           = _name_from_csid,
/cvs/lvm2/LVM2/test/t-clvmd-restart.sh,v  -->  standard output
revision 1.1
--- LVM2/test/t-clvmd-restart.sh
+++ -	2011-09-25 19:37:01.914932000 +0000
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+export LVM_CLVMD_BINARY="lib/clvmd"
+export LVM_BINARY="lib/lvm"
+
+. lib/test
+
+# only clvmd based test, skip otherwise
+test -e LOCAL_CLVMD || skip
+
+aux prepare_devs 1
+
+vgcreate --clustered y $vg $(cat DEVICES)
+
+lvcreate -an --zero n -n $lv1 -l1 $vg
+lvcreate -an --zero n -n $lv2 -l1 $vg
+lvcreate -l1 $vg
+
+lvchange -aey $vg/$lv1
+lvchange -aey $vg/$lv2
+
+"$LVM_CLVMD_BINARY" -S
+sleep .2
+# restarted clvmd has the same PID (no fork, only execve)
+NEW_LOCAL_CLVMD=$(pgrep clvmd)
+read LOCAL_CLVMD < LOCAL_CLVMD
+test "$LOCAL_CLVMD" -eq "$NEW_LOCAL_CLVMD"
+
+# FIXME: Hmm - how could we test exclusivity is preserved in singlenode ?
+lvchange -an $vg/$lv1
+lvchange -ay $vg/$lv1
+
+lib/clvmd -R
+
+vgremove -ff $vg


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2011-01-19 23:09 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2011-01-19 23:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2011-01-19 23:09:31

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-command.c clvmd-corosync.c 

Log message:
	In some versions (RHEL6) dlm_create_lockspace() always
	return lockspace reference (even if lockspace already exists)
	and thus increases DLM lockspace count. It means that after
	clvmd restart the lockspace is still in use.
	
	(The only way to clean environment to enable clean cluster
	shutdown is call "dlm_tool leave clvmd" several times.)
	
	Because only one clvmd can run in time, we can use simpler logic,
	try to open lockspace with dlm_open_lockspace() and only if it fails
	try to create new one. This way the lockspace reference doesn not
	increase.
	
	Very easily reproducible with  "clvmd -S" command.
	
	Patch also fixes return code when clvmd_restart fails and fixes
	double free if debug option was specified during restart.
	
	Fixes https://bugzilla.redhat.com/show_bug.cgi?id=612862

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1884&r2=1.1885
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15

--- LVM2/WHATS_NEW	2011/01/17 23:13:14	1.1884
+++ LVM2/WHATS_NEW	2011/01/19 23:09:31	1.1885
@@ -1,6 +1,7 @@
 Version 2.02.82 -
 ===================================
   Add -f (don't fork) option to clvmd and fix clvmd -d<num> description.
+  Fix possible clvmd DLM lockspace increasing reference count.
 
 Version 2.02.81 - 17th January 2011
 ===================================
--- LVM2/daemons/clvmd/clvmd-cman.c	2010/06/21 15:56:58	1.28
+++ LVM2/daemons/clvmd/clvmd-cman.c	2011/01/19 23:09:31	1.29
@@ -89,16 +89,17 @@
 	DEBUGLOG("CMAN initialisation complete\n");
 
 	/* Create a lockspace for LV & VG locks to live in */
-	lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
+	lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
 	if (!lockspace) {
-		if (errno == EEXIST) {
-			lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
-		}
+		lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
 		if (!lockspace) {
-			syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
+			syslog(LOG_ERR, "Unable to create DLM lockspace for CLVM: %m");
 			return -1;
 		}
-	}
+		DEBUGLOG("Created DLM lockspace for CLVMD.\n");
+	} else
+		DEBUGLOG("Opened existing DLM lockspace for CLVMD.\n");
+
 	dlm_ls_pthread_init(lockspace);
 	DEBUGLOG("DLM initialisation complete\n");
 	return 0;
--- LVM2/daemons/clvmd/clvmd-command.c	2011/01/17 23:13:14	1.48
+++ LVM2/daemons/clvmd/clvmd-command.c	2011/01/19 23:09:31	1.49
@@ -147,7 +147,7 @@
 		break;
 
 	case CLVMD_CMD_RESTART:
-		restart_clvmd();
+		status = restart_clvmd();
 		break;
 
 	case CLVMD_CMD_GET_CLUSTERNAME:
@@ -382,8 +382,14 @@
 		    dm_snprintf(debug_arg, 16, "-d%d", (int)clvmd_get_debug()) < 0)
 			goto_out;
 		argv[argc++] = debug_arg;
+		debug_arg = NULL;
 	}
 
+	/*
+	 * FIXME: specify used cluster backend
+	 * argv[argc++] = strdup("-Isinglenode");
+	 */
+
 	/* Now add the exclusively-open LVs */
 	do {
 		hn = get_next_excl_lock(hn, &lv_name);
@@ -402,6 +408,7 @@
 	argv[argc++] = NULL;
 
 	/* Exec new clvmd */
+	DEBUGLOG("--- Restarting %s ---\n", CLVMD_PATH);
 	/* NOTE: This will fail when downgrading! */
 	execve(CLVMD_PATH, argv, NULL);
 out:
@@ -413,5 +420,5 @@
 	free(argv);
 	free(debug_arg);
 
-	return 0;
+	return EIO;
 }
--- LVM2/daemons/clvmd/clvmd-corosync.c	2010/06/21 15:56:58	1.14
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2011/01/19 23:09:31	1.15
@@ -294,19 +294,18 @@
 		return cs_to_errno(err);
 	}
 
-
 	/* Create a lockspace for LV & VG locks to live in */
-	lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
+	lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
 	if (!lockspace) {
-		if (errno == EEXIST) {
-			lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
-		}
+		lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
 		if (!lockspace) {
-			syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
-			quorum_finalize(quorum_handle);
+			syslog(LOG_ERR, "Unable to create DLM lockspace for CLVM: %m");
 			return -1;
 		}
-	}
+		DEBUGLOG("Created DLM lockspace for CLVMD.\n");
+	} else
+		DEBUGLOG("Opened existing DLM lockspace for CLVMD.\n");
+
 	dlm_ls_pthread_init(lockspace);
 	DEBUGLOG("DLM initialisation complete\n");
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2010-06-21 15:57 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2010-06-21 15:57 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-06-21 15:57:00

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-command.c clvmd-corosync.c 
	                 clvmd-gulm.c clvmd-openais.c clvmd-singlenode.c 
	                 clvmd.c lvm-functions.c refresh_clvmd.c 
	                 tcp-comms.c 
	lib/log        : log.h 
	man            : dmeventd.8.in lvextend.8.in lvmconf.8.in 
	                 lvreduce.8.in lvresize.8.in 
Added files:
	daemons/clvmd  : clvmd-common.h 

Log message:
	Various cleanups following recent commits.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1621&r2=1.1622
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-common.h.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-singlenode.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.93&r2=1.94
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.h.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmeventd.8.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvextend.8.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvmconf.8.in.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvreduce.8.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvresize.8.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/WHATS_NEW	2010/06/21 10:45:15	1.1621
+++ LVM2/WHATS_NEW	2010/06/21 15:56:57	1.1622
@@ -1,16 +1,18 @@
 Version 2.02.68 -
 ===============================
-  Add workaround for clvmd -S (socket closed too early and server drops the command).
+  Sleep to workaround clvmd -S race: socket closed early and server drops cmd.
   Use early udev synchronisation and update of dev nodes for clustered mirrors.
-  Unneeded kdev_t.h reference causing harm for cmirrord on some archs.
-  Add man pages for lvmconf and unsupported lvmsadc and lvmsar tools.
-  Fix exit code when requesting help using documented -o help option.
+  Remove incorrect inclusion of kdev_t.h from cmirrord/functions.h.
+  Add man pages for lvmconf and non-existent lvmsadc and lvmsar tools.
+  Exit successfully when using -o help (but not -o +help) with LVM reports.
   Do not use internal DLM lock definitions in generic LVM2 clvmd code.
   Add dmeventd man page.
-  Update lvresize/extend/reduce manpages with --nofsck, --resizefs options.
+  Add --force, --nofsck and --resizefs to lvresize/extend/reduce man pages.
   Fix lvm2cmd example in documentation.
-  Allow use of lvm2app and lvm2cmd headers in C++ mode.
-  Fix wrong lvm path creation from configure introduced in previous release.
+  Allow use of lvm2app and lvm2cmd headers in C++ code.
+  Remove some unused #includes from clvmd files.
+  Use #include "" for libdevmapper.h and configure.h throughout tree.
+  Fix 'make exec_prefix' with LVM_PATH / DMEVENTD_PATH. (2.02.67)
   Fix segfault in clvmd -R if no response from daemon received.
 
 Version 2.02.67 - 4th June 2010
/cvs/lvm2/LVM2/daemons/clvmd/clvmd-common.h,v  -->  standard output
revision 1.1
--- LVM2/daemons/clvmd/clvmd-common.h
+++ -	2010-06-21 15:57:00.489877000 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * This file must be included first by every clvmd source file.
+ */
+#ifndef _LVM_CLVMD_COMMON_H
+#define _LVM_CLVMD_COMMON_H
+
+#include "configure.h"
+
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+
+#include "libdevmapper.h"
+
+#include "lvm-logging.h"
+
+#include <unistd.h>
+#include <sys/stat.h>
+
+#endif
--- LVM2/daemons/clvmd/clvmd-cman.c	2010/06/15 11:00:44	1.27
+++ LVM2/daemons/clvmd/clvmd-cman.c	2010/06/21 15:56:58	1.28
@@ -17,38 +17,19 @@
  * CMAN communication layer for clvmd.
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <syslog.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <errno.h>
-#include "libdevmapper.h"
-#include <libdlm.h>
 
 #include "clvmd-comms.h"
 #include "clvm.h"
-#include "lvm-logging.h"
 #include "clvmd.h"
 #include "lvm-functions.h"
 
+#include <libdlm.h>
+
+#include <syslog.h>
+
 #define LOCKSPACE_NAME "clvmd"
 
 struct clvmd_node
--- LVM2/daemons/clvmd/clvmd-command.c	2010/06/17 12:48:55	1.38
+++ LVM2/daemons/clvmd/clvmd-command.c	2010/06/21 15:56:58	1.39
@@ -50,32 +50,18 @@
 
 */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <errno.h>
-#include "libdevmapper.h"
 
-#include "locking.h"
-#include "lvm-logging.h"
-#include "lvm-functions.h"
 #include "clvmd-comms.h"
 #include "clvm.h"
 #include "clvmd.h"
+#include "lvm-functions.h"
+
+#include "locking.h"
+
+#include <sys/utsname.h>
 
 extern debug_t debug;
 extern struct cluster_ops *clops;
--- LVM2/daemons/clvmd/clvmd-corosync.c	2010/06/15 11:00:45	1.13
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2010/06/21 15:56:58	1.14
@@ -17,46 +17,23 @@
  * and lock manager.
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <utmpx.h>
-#include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
 
-#include <corosync/corotypes.h>
+#include "clvm.h"
+#include "clvmd-comms.h"
+#include "clvmd.h"
+#include "lvm-functions.h"
+
+#include "locking.h"
+
 #include <corosync/cpg.h>
 #include <corosync/quorum.h>
 #include <corosync/confdb.h>
 #include <libdlm.h>
 
-#include "locking.h"
-#include "lvm-logging.h"
-#include "clvm.h"
-#include "clvmd-comms.h"
-#include "lvm-functions.h"
-#include "clvmd.h"
+#include <syslog.h>
 
 /* Timeout value for several corosync calls */
 #define LOCKSPACE_NAME "clvmd"
--- LVM2/daemons/clvmd/clvmd-gulm.c	2010/06/17 12:48:55	1.30
+++ LVM2/daemons/clvmd/clvmd-gulm.c	2010/06/21 15:56:58	1.31
@@ -24,35 +24,27 @@
  * on the cluster nodes. That is done in tcp-comms.c
  */
 
-#include "configure.h"
+#include "clvmd-common.h"
+
 #include <pthread.h>
-#include <sys/types.h>
 #include <sys/utsname.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
 #include <sys/file.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <stdint.h>
 #include <signal.h>
 #include <fcntl.h>
-#include <string.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
 #include <utmpx.h>
 #include <syslog.h>
 #include <assert.h>
-#include "libdevmapper.h"
 #include <ccs.h>
 #include <libgulm.h>
 
 #include "locking.h"
-#include "lvm-logging.h"
 #include "clvm.h"
 #include "clvmd-comms.h"
 #include "lvm-functions.h"
--- LVM2/daemons/clvmd/clvmd-openais.c	2010/06/15 11:00:45	1.14
+++ LVM2/daemons/clvmd/clvmd-openais.c	2010/06/21 15:56:58	1.15
@@ -17,33 +17,11 @@
  * and lock manager.
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
 #include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <utmpx.h>
 #include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
 
 #include <openais/saAis.h>
 #include <openais/saLck.h>
@@ -52,7 +30,6 @@
 #include <corosync/cpg.h>
 
 #include "locking.h"
-#include "lvm-logging.h"
 #include "clvm.h"
 #include "clvmd-comms.h"
 #include "lvm-functions.h"
--- LVM2/daemons/clvmd/clvmd-singlenode.c	2010/06/15 11:00:45	1.3
+++ LVM2/daemons/clvmd/clvmd-singlenode.c	2010/06/21 15:56:58	1.4
@@ -12,26 +12,20 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include <netinet/in.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "libdevmapper.h"
+#include "clvmd-common.h"
 
 #include <pthread.h>
 
 #include "locking.h"
-#include "lvm-logging.h"
 #include "clvm.h"
 #include "clvmd-comms.h"
 #include "lvm-functions.h"
 #include "clvmd.h"
 
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+
 static const char SINGLENODE_CLVMD_SOCKNAME[] = "\0singlenode_clvmd";
 static int listen_fd = -1;
 
--- LVM2/daemons/clvmd/clvmd.c	2010/06/15 11:00:45	1.71
+++ LVM2/daemons/clvmd/clvmd.c	2010/06/21 15:56:58	1.72
@@ -17,44 +17,28 @@
  * CLVMD: Cluster LVM daemon
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include "libdevmapper.h"
+#include "clvmd-common.h"
 
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <syslog.h>
-#include <errno.h>
-#include <limits.h>
-#ifdef HAVE_COROSYNC_CONFDB_H
-#include <corosync/confdb.h>
-#endif
 
 #include "clvmd-comms.h"
-#include "lvm-functions.h"
 #include "clvm.h"
-#include "lvm-version.h"
 #include "clvmd.h"
+#include "lvm-functions.h"
+#include "lvm-version.h"
 #include "refresh_clvmd.h"
-#include "lvm-logging.h"
+
+#ifdef HAVE_COROSYNC_CONFDB_H
+#include <corosync/confdb.h>
+#endif
+
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <signal.h>
+#include <stddef.h>
+#include <syslog.h>
+#include <sys/un.h>
+#include <sys/utsname.h>
 
 #ifndef TRUE
 #define TRUE 1
--- LVM2/daemons/clvmd/lvm-functions.c	2010/06/17 12:48:55	1.93
+++ LVM2/daemons/clvmd/lvm-functions.c	2010/06/21 15:56:58	1.94
@@ -13,28 +13,9 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <errno.h>
-#include <syslog.h>
-#include <assert.h>
-#include "libdevmapper.h"
 
 #include "lvm-types.h"
 #include "clvm.h"
@@ -45,14 +26,13 @@
 /* LVM2 headers */
 #include "toolcontext.h"
 #include "lvmcache.h"
-#include "lvm-logging.h"
 #include "lvm-globals.h"
 #include "activate.h"
-#include "locking.h"
 #include "archiver.h"
-#include "defaults.h"
 #include "memlock.h"
 
+#include <syslog.h>
+
 static struct cmd_context *cmd = NULL;
 static struct dm_hash_table *lv_hash = NULL;
 static pthread_mutex_t lv_hash_lock;
--- LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/21 10:45:16	1.11
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/21 15:56:58	1.12
@@ -17,22 +17,14 @@
  * Send a command to a running clvmd from the command-line
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
+
+#include "clvm.h"
+#include "refresh_clvmd.h"
 
-#include "configure.h"
 #include <stddef.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <errno.h>
-#include <unistd.h>
-#include "libdevmapper.h"
-#include <stdint.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include "clvm.h"
-#include "refresh_clvmd.h"
 
 typedef struct lvm_response {
 	char node[255];
--- LVM2/daemons/clvmd/tcp-comms.c	2010/06/15 11:00:45	1.21
+++ LVM2/daemons/clvmd/tcp-comms.c	2010/06/21 15:56:58	1.22
@@ -20,31 +20,22 @@
  * It can also make outgoing connnections to the other clvmd nodes.
  */
 
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "clvmd-common.h"
 
-#include "configure.h"
 #include <pthread.h>
-#include <sys/types.h>
 #include <sys/utsname.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <stdint.h>
 #include <fcntl.h>
-#include <string.h>
 #include <stddef.h>
 #include <stdint.h>
-#include <unistd.h>
 #include <errno.h>
 #include <syslog.h>
 #include <netdb.h>
 #include <assert.h>
-#include "libdevmapper.h"
 
 #include "clvm.h"
 #include "clvmd-comms.h"
--- LVM2/lib/log/log.h	2010/05/05 22:37:53	1.49
+++ LVM2/lib/log/log.h	2010/06/21 15:56:59	1.50
@@ -16,8 +16,6 @@
 #ifndef _LVM_LOG_H
 #define _LVM_LOG_H
 
-#include <errno.h>
-
 /*
  * printf()-style macros to use for messages:
  *
--- LVM2/man/dmeventd.8.in	2010/06/17 12:14:43	1.1
+++ LVM2/man/dmeventd.8.in	2010/06/21 15:56:59	1.2
@@ -3,29 +3,28 @@
 dmeventd \- Device-mapper event daemon
 .SH SYNOPSIS
 .B dmeventd
-[\-V]
 [\-d]
 [\-f]
 [\-h]
+[\-V]
 [\-?]
 .SH DESCRIPTION
 dmeventd is the event monitoring daemon for device-mapper devices.
-Plugins are supported.
-
-.br
-LVM plugins:
-.TP
-Snapshot: monitor the filling of snapshot and emits a warning through 
-syslog, when the use of snapshot exceedes 80%.
-The warning is repeated when 85%, 90% and 95% of the snapshot are filled.
-(see \fBlvm.conf\fP)
-.TP
-Mirror: attempts to recover from failures (see \fBlvm.conf\fP).
+Library plugins can register and carry out actions triggered when
+particular events occur.
+.SH
+LVM PLUGINS
+.TP
+.I Mirror
+Attempts to handle device failure automatically.  See \fBlvm.conf\fP).
+.TP
+.I Snapshot
+Monitors how full a snapshot is becoming and emits a warning to
+syslog when it exceeds 80% full.
+The warning is repeated when 85%, 90% and 95% of the snapshot is filled.
+See \fBlvm.conf\fP.
 .SH OPTIONS
 .TP
-.I \-V
-Show version of dmeventd.
-.TP
 .I \-d
 Repeat from 1 to 3 times (-d, -dd, -ddd) to increase the detail of
 debug messages sent to syslog.
@@ -36,6 +35,9 @@
 .TP
 .I \-h, \-?
 Show help information.
+.TP
+.I \-V
+Show version of dmeventd.
 
 .SH SEE ALSO
 .BR lvm (8),
--- LVM2/man/lvextend.8.in	2010/06/17 11:25:43	1.7
+++ LVM2/man/lvextend.8.in	2010/06/21 15:56:59	1.8
@@ -65,7 +65,7 @@
 StripeSize must be 2^n (n = 2 to 9)
 .TP
 .I \-f, \-\-force
-Force size extension without any question.
+Proceed with size extension without prompting.
 .TP
 .I \-n, \-\-nofsck
 Do not perform fsck before extending filesystem when filesystem
@@ -73,8 +73,8 @@
 this option.
 .TP
 .I \-r, \-\-resizefs
-Resize underlying filesystem together with logical volume size.
-\fBfsadm\fR tool is used for filesystem resize.
+Resize underlying filesystem together with the logical volume using 
+\fBfsadm\fR(8).
 .SH Examples
 "lvextend -L +54 /dev/vg01/lvol10 /dev/sdk3" tries to extend the size of
 that logical volume by 54MB on physical volume /dev/sdk3.
--- LVM2/man/lvmconf.8.in	2010/06/18 10:19:30	1.1
+++ LVM2/man/lvmconf.8.in	2010/06/21 15:56:59	1.2
@@ -6,33 +6,31 @@
 
 .SH "SYNOPSIS"
 .B lvmconf
-[\-\-enable-cluster]
 [\-\-disable-cluster]
-[\-\-lockinglibdir <dir>]
-[\-\-lockinglib <lib>]
+[\-\-enable-cluster]
 [\-\-file <configfile>]
+[\-\-lockinglib <lib>]
+[\-\-lockinglibdir <dir>]
 
 .SH "DESCRIPTION"
 .B lvmconf
-is a helper tool to modify cluster locking in \fBlvm.conf\fP(5).
+is a script that modifies the locking configuration in an lvm configuration file. See \fBlvm.conf\fP(5).
 
 .SH "OPTIONS"
 .TP
 .BR \-\-disable-cluster
-Set the default non-cluster \fBlocking_type\fR.
+Set \fBlocking_type\fR to the default non-clustered type.
 .TP
 .BR \-\-enable-cluster
-Set a cluster-wide \fBlocking_type\fR available on the system.
+Set \fBlocking_type\fR to the default clustered type on this system.
 .TP
-.BR \-\-lockinglibdir " " \fI<dir>\fR
-Set \fBlocking_dir\fR directory where LVM2 places its files locks.
+.BR \-\-file " " \fI<configfile>\fR
+Apply the changes to \fBconfigfile\fR instead of the default \fB#DEFAULT_SYS_DIR#/lvm.conf\fR.
 .TP
 .BR \-\-lockinglib " " \fI<lib>\fR
-Set external \fBlocking_library\fR locking library to load.
+Set external \fBlocking_library\fR locking library to load if an external locking type is used.
 .TP
-.BR \-\-file " " \fI<configfile>\fR
-Use non-default \fBconfigfile\fR instead of \fB#DEFAULT_SYS_DIR#/lvm.conf\fR.
-
+.BR \-\-lockinglibdir " " \fI<dir>\fR
 .SH FILES
 .I #DEFAULT_SYS_DIR#/lvm.conf
 
--- LVM2/man/lvreduce.8.in	2010/06/17 11:25:43	1.7
+++ LVM2/man/lvreduce.8.in	2010/06/21 15:56:59	1.8
@@ -37,7 +37,7 @@
 See \fBlvm\fP for common options.
 .TP
 .I \-f, \-\-force
-Force size reduction without any question.
+Force size reduction without prompting even when it may cause data loss.
 .TP
 .I \-\-noudevsync
 Disable udev synchronisation. The
@@ -70,11 +70,11 @@
 .I \-n, \-\-nofsck
 Do not perform fsck before resizing filesystem when filesystem
 requires it. You may need to use \fB--force\fR to proceed with 
-this option. Note: using this option is dangerous.
+this option.
 .TP
 .I \-r, \-\-resizefs
-Resize underlying filesystem together with logical volume size.
-\fBfsadm\fR tool is used for filesystem resize.
+Resize underlying filesystem together with the logical volume using 
+\fBfsadm\fR(8).
 .SH Example
 "lvreduce -l -3 vg00/lvol1" reduces the size of logical volume lvol1
 in volume group vg00 by 3 logical extents.
--- LVM2/man/lvresize.8.in	2010/06/17 11:25:43	1.8
+++ LVM2/man/lvresize.8.in	2010/06/21 15:56:59	1.9
@@ -29,12 +29,8 @@
 .SH OPTIONS
 See \fBlvm\fP for common options.
 .TP
-.I \-\-noudevsync
-Disable udev synchronisation. The
-process will not wait for notification from udev.
-It will continue irrespective of any possible udev processing
-in the background.  You should only use this if udev is not running
-or has rules that ignore the devices LVM2 creates.
+.I \-f, \-\-force
+Force resize without prompting even when it may cause data loss.
 .TP
 .I \-l, \-\-extents [+|-]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}]
 Change or set the logical volume size in units of logical extents.
@@ -48,6 +44,22 @@
 Volume Group with the suffix %FREE, or (for a snapshot) as a percentage
 of the total space in the Origin Logical Volume with the suffix %ORIGIN.
 .TP
+.I \-n, \-\-nofsck
+Do not perform fsck before resizing filesystem when filesystem
+requires it. You may need to use \fB--force\fR to proceed with 
+this option.
+.TP
+.I \-\-noudevsync
+Disable udev synchronisation. The
+process will not wait for notification from udev.
+It will continue irrespective of any possible udev processing
+in the background.  You should only use this if udev is not running
+or has rules that ignore the devices LVM2 creates.
+.TP
+.I \-r, \-\-resizefs
+Resize underlying filesystem together with the logical volume using 
+\fBfsadm\fR(8).
+.TP
 .I \-L, \-\-size [+|-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
 Change or set the logical volume size in units of megabytes.
 A size suffix of M for megabytes,
@@ -70,18 +82,6 @@
 must use a single value throughout.
 .br
 StripeSize must be 2^n (n = 2 to 9)
-.TP
-.I \-f, \-\-force
-Force resize without any question.
-.TP
-.I \-n, \-\-nofsck
-Do not perform fsck before resizing filesystem when filesystem
-requires it. You may need to use \fB--force\fR to proceed with 
-this option.
-.TP
-.I \-r, \-\-resizefs
-Resize underlying filesystem together with logical volume size.
-\fBfsadm\fR tool is used for filesystem resize.
 .SH Examples
 .br
 "lvresize -L+16M vg1/lv1 /dev/sda:0-1 /dev/sdb:0-1"


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2009-04-21 13:11 mbroz
  0 siblings, 0 replies; 7+ messages in thread
From: mbroz @ 2009-04-21 13:11 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-04-21 13:11:29

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-corosync.c clvmd-gulm.c 
	                 clvmd-openais.c lvm-functions.c lvm-functions.h 

Log message:
	Tidy lv_hash[_lock] use inside clvmd.
	
	- Rename unlock_all to destroy_lvhash,
	this function is called in cluster shutdown
	unlocks everything and clean up allocated info space.
	
	- Tidy lv_hash_lock use
	.
	Except adding free(lvi) in lv_has destructror
	there is no functional change.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1089&r2=1.1090
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-openais.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/WHATS_NEW	2009/04/21 12:59:18	1.1089
+++ LVM2/WHATS_NEW	2009/04/21 13:11:28	1.1090
@@ -1,5 +1,6 @@
 Version 2.02.46 - 
 ================================
+  Tidy clvmd volume lock cache functions.
   Fix pvs report for orphan PVs when segment attributes are requested.
   Fix pvs -a output to not read volume groups from non-PV devices.
   Add MMC (mmcblk) device type to filters.
--- LVM2/daemons/clvmd/clvmd-cman.c	2009/02/10 11:52:40	1.25
+++ LVM2/daemons/clvmd/clvmd-cman.c	2009/04/21 13:11:28	1.26
@@ -263,7 +263,7 @@
 
 static void _cluster_closedown()
 {
-	unlock_all();
+	destroy_lvhash();
 	dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
 	cman_finish(c_handle);
 }
--- LVM2/daemons/clvmd/clvmd-corosync.c	2009/04/01 07:51:06	1.8
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2009/04/21 13:11:28	1.9
@@ -359,7 +359,7 @@
 static void _cluster_closedown(void)
 {
 	DEBUGLOG("cluster_closedown\n");
-	unlock_all();
+	destroy_lvhash();
 
 	dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
 	cpg_finalize(cpg_handle);
--- LVM2/daemons/clvmd/clvmd-gulm.c	2008/11/04 16:41:47	1.25
+++ LVM2/daemons/clvmd/clvmd-gulm.c	2009/04/21 13:11:28	1.26
@@ -248,7 +248,7 @@
 {
     DEBUGLOG("cluster_closedown\n");
     in_shutdown = 1;
-    unlock_all();
+    destroy_lvhash();
     lg_lock_logout(gulm_if);
     lg_core_logout(gulm_if);
     lg_release(gulm_if);
--- LVM2/daemons/clvmd/clvmd-openais.c	2009/02/02 14:34:25	1.10
+++ LVM2/daemons/clvmd/clvmd-openais.c	2009/04/21 13:11:28	1.11
@@ -382,7 +382,7 @@
 static void _cluster_closedown(void)
 {
 	DEBUGLOG("cluster_closedown\n");
-	unlock_all();
+	destroy_lvhash();
 
 	saLckFinalize(lck_handle);
 	cpg_finalize(cpg_handle);
--- LVM2/daemons/clvmd/lvm-functions.c	2009/04/10 10:00:04	1.59
+++ LVM2/daemons/clvmd/lvm-functions.c	2009/04/21 13:11:28	1.60
@@ -157,32 +157,79 @@
 	return last_error;
 }
 
-/* Return the mode a lock is currently held at (or -1 if not held) */
-static int get_current_lock(char *resource)
+/*
+ * Hash lock info helpers
+ */
+static struct lv_info *lookup_info(const char *resource)
 {
 	struct lv_info *lvi;
 
 	pthread_mutex_lock(&lv_hash_lock);
 	lvi = dm_hash_lookup(lv_hash, resource);
 	pthread_mutex_unlock(&lv_hash_lock);
-	if (lvi) {
+
+	return lvi;
+}
+
+static void insert_info(const char *resource, struct lv_info *lvi)
+{
+	pthread_mutex_lock(&lv_hash_lock);
+	dm_hash_insert(lv_hash, resource, lvi);
+	pthread_mutex_unlock(&lv_hash_lock);
+}
+
+static void remove_info(const char *resource)
+{
+	pthread_mutex_lock(&lv_hash_lock);
+	dm_hash_remove(lv_hash, resource);
+	pthread_mutex_unlock(&lv_hash_lock);
+}
+
+/*
+ * Return the mode a lock is currently held at (or -1 if not held)
+ */
+static int get_current_lock(char *resource)
+{
+	struct lv_info *lvi;
+
+	if ((lvi = lookup_info(resource)))
 		return lvi->lock_mode;
-	} else {
-		return -1;
-	}
+
+	return -1;
+}
+
+
+void init_lvhash()
+{
+	/* Create hash table for keeping LV locks & status */
+	lv_hash = dm_hash_create(100);
+	pthread_mutex_init(&lv_hash_lock, NULL);
+	pthread_mutex_init(&lvm_lock, NULL);
 }
 
 /* Called at shutdown to tidy the lockspace */
-void unlock_all()
+void destroy_lvhash()
 {
 	struct dm_hash_node *v;
+	struct lv_info *lvi;
+	char *resource;
+	int status;
 
 	pthread_mutex_lock(&lv_hash_lock);
+
 	dm_hash_iterate(v, lv_hash) {
-		struct lv_info *lvi = dm_hash_get_data(lv_hash, v);
+		lvi = dm_hash_get_data(lv_hash, v);
+		resource = dm_hash_get_key(lv_hash, v);
 
-		sync_unlock(dm_hash_get_key(lv_hash, v), lvi->lock_id);
+		if ((status = sync_unlock(resource, lvi->lock_id)))
+			DEBUGLOG("unlock_all. unlock failed(%d): %s\n",
+				 status,  strerror(errno));
+		free(lvi);
 	}
+
+	dm_hash_destroy(lv_hash);
+	lv_hash = NULL;
+
 	pthread_mutex_unlock(&lv_hash_lock);
 }
 
@@ -195,10 +242,7 @@
 
 	flags &= LKF_NOQUEUE;	/* Only LKF_NOQUEUE is valid here */
 
-	pthread_mutex_lock(&lv_hash_lock);
-	lvi = dm_hash_lookup(lv_hash, resource);
-	pthread_mutex_unlock(&lv_hash_lock);
-	if (lvi) {
+	if ((lvi = lookup_info(resource))) {
 		/* Already exists - convert it */
 		status =
 		    sync_lock(resource, mode, LKF_CONVERT | flags,
@@ -224,11 +268,9 @@
 			free(lvi);
 			DEBUGLOG("hold_lock. lock at %d failed: %s\n", mode,
 				 strerror(errno));
-		} else {
-		        pthread_mutex_lock(&lv_hash_lock);
-			dm_hash_insert(lv_hash, resource, lvi);
-			pthread_mutex_unlock(&lv_hash_lock);
-		}
+		} else
+			insert_info(resource, lvi);
+
 		errno = saved_errno;
 	}
 	return status;
@@ -241,10 +283,7 @@
 	int status;
 	int saved_errno;
 
-	pthread_mutex_lock(&lv_hash_lock);
-	lvi = dm_hash_lookup(lv_hash, resource);
-	pthread_mutex_unlock(&lv_hash_lock);
-	if (!lvi) {
+	if (!(lvi = lookup_info(resource))) {
 		DEBUGLOG("hold_unlock, lock not already held\n");
 		return 0;
 	}
@@ -252,9 +291,7 @@
 	status = sync_unlock(resource, lvi->lock_id);
 	saved_errno = errno;
 	if (!status) {
-	    	pthread_mutex_lock(&lv_hash_lock);
-		dm_hash_remove(lv_hash, resource);
-		pthread_mutex_unlock(&lv_hash_lock);
+		remove_info(resource);
 		free(lvi);
 	} else {
 		DEBUGLOG("hold_unlock. unlock failed(%d): %s\n", status,
@@ -699,14 +736,6 @@
 	log_error("locking_type not set correctly in lvm.conf, cluster operations will not work.");
 }
 
-void init_lvhash()
-{
-	/* Create hash table for keeping LV locks & status */
-	lv_hash = dm_hash_create(100);
-	pthread_mutex_init(&lv_hash_lock, NULL);
-	pthread_mutex_init(&lvm_lock, NULL);
-}
-
 /* Backups up the LVM metadata if it's changed */
 void lvm_do_backup(const char *vgname)
 {
--- LVM2/daemons/clvmd/lvm-functions.h	2008/05/09 15:13:20	1.8
+++ LVM2/daemons/clvmd/lvm-functions.h	2009/04/21 13:11:28	1.9
@@ -28,10 +28,10 @@
 extern int do_refresh_cache(void);
 extern int init_lvm(int using_gulm);
 extern void init_lvhash(void);
+extern void destroy_lvhash(void);
 extern void lvm_do_backup(const char *vgname);
 extern int hold_unlock(char *resource);
 extern int hold_lock(char *resource, int mode, int flags);
-extern void unlock_all(void);
 extern char *get_last_lvm_error(void);
 extern void drop_metadata(const char *vgname);
 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2009-02-10 11:52 ccaulfield
  0 siblings, 0 replies; 7+ messages in thread
From: ccaulfield @ 2009-02-10 11:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	ccaulfield@sourceware.org	2009-02-10 11:52:40

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-corosync.c 

Log message:
	Allow clvmd to start up if its lockspace already exists.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1038&r2=1.1039
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-corosync.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3

--- LVM2/WHATS_NEW	2009/02/09 09:45:49	1.1038
+++ LVM2/WHATS_NEW	2009/02/10 11:52:40	1.1039
@@ -1,5 +1,6 @@
 Version 2.02.45 - 
 ===================================
+  Allow clvmd to start up if its lockspace already exists.
   Separate PV label attributes which do not need parse metadata when reporting.
   Remove external dependency on the 'cut' command in fsadm.
   Fix pvs segfault when pv mda attributes requested for not available PV.
--- LVM2/daemons/clvmd/clvmd-cman.c	2008/11/04 16:41:47	1.24
+++ LVM2/daemons/clvmd/clvmd-cman.c	2009/02/10 11:52:40	1.25
@@ -110,8 +110,13 @@
 	/* Create a lockspace for LV & VG locks to live in */
 	lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
 	if (!lockspace) {
-		syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
-		return -1;
+		if (errno == EEXIST) {
+			lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
+		}
+		if (!lockspace) {
+			syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
+			return -1;
+		}
 	}
 	dlm_ls_pthread_init(lockspace);
 	DEBUGLOG("DLM initialisation complete\n");
--- LVM2/daemons/clvmd/clvmd-corosync.c	2009/02/02 14:34:25	1.2
+++ LVM2/daemons/clvmd/clvmd-corosync.c	2009/02/10 11:52:40	1.3
@@ -314,9 +314,14 @@
 	/* Create a lockspace for LV & VG locks to live in */
 	lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
 	if (!lockspace) {
-		syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
-		quorum_finalize(quorum_handle);
-		return -1;
+		if (errno == EEXIST) {
+			lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
+		}
+		if (!lockspace) {
+			syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
+			quorum_finalize(quorum_handle);
+			return -1;
+		}
 	}
 	dlm_ls_pthread_init(lockspace);
 	DEBUGLOG("DLM initialisation complete\n");


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2007-05-02 12:22 pcaulfield
  0 siblings, 0 replies; 7+ messages in thread
From: pcaulfield @ 2007-05-02 12:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	pcaulfield@sourceware.org	2007-05-02 12:22:41

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-command.c clvmd-comms.h 
	                 clvmd.c clvmd.h tcp-comms.c tcp-comms.h 

Log message:
	Misc clvmd cleanups from Jim Meyering

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.614&r2=1.615
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-comms.h.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.h.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/WHATS_NEW	2007/05/02 08:23:36	1.614
+++ LVM2/WHATS_NEW	2007/05/02 12:22:40	1.615
@@ -1,6 +1,7 @@
 Version 2.02.26 -
 =================================
   Add some more debuglogs to clvmd startup.
+  Misc clvmd cleanups
 
 Version 2.02.25 - 27th April 2007
 =================================
--- LVM2/daemons/clvmd/clvmd-cman.c	2007/05/02 08:23:36	1.19
+++ LVM2/daemons/clvmd/clvmd-cman.c	2007/05/02 12:22:40	1.20
@@ -58,7 +58,7 @@
 
 static void count_clvmds_running(void);
 static void get_members(void);
-static int nodeid_from_csid(char *csid);
+static int nodeid_from_csid(const char *csid);
 static int name_from_nodeid(int nodeid, char *name);
 static void event_callback(cman_handle_t handle, void *private, int reason, int arg);
 static void data_callback(cman_handle_t handle, void *private,
@@ -131,7 +131,8 @@
 }
 
 /* send_message with the fd check removed */
-static int _cluster_send_message(void *buf, int msglen, char *csid, const char *errtext)
+static int _cluster_send_message(const void *buf, int msglen, const char *csid,
+				 const char *errtext)
 {
 	int nodeid = 0;
 
@@ -140,7 +141,7 @@
 
 	if (cman_send_data(c_handle, buf, msglen, 0, CLUSTER_PORT_CLVMD, nodeid) <= 0)
 	{
-		log_error(errtext);
+		log_error("%s", errtext);
 	}
 	return msglen;
 }
@@ -155,7 +156,8 @@
 
 /* Call a callback routine for each node is that known (down means not running a clvmd) */
 static int _cluster_do_node_callback(struct local_client *client,
-				     void (*callback) (struct local_client *, char *,
+				     void (*callback) (struct local_client *,
+						       const char *,
 						       int))
 {
 	int i;
@@ -208,7 +210,8 @@
 }
 
 static struct local_client *cman_client;
-static int _cluster_fd_callback(struct local_client *fd, char *buf, int len, char *csid,
+static int _cluster_fd_callback(struct local_client *fd, char *buf, int len,
+				const char *csid,
 				struct local_client **new_client)
 {
 
@@ -231,7 +234,7 @@
 	process_message(cman_client, buf, len, (char *)&nodeid);
 }
 
-static void _add_up_node(char *csid)
+static void _add_up_node(const char *csid)
 {
 	/* It's up ! */
 	int nodeid = nodeid_from_csid(csid);
@@ -323,17 +326,16 @@
 	}
 
 	if (node_updown == NULL) {
-		node_updown =
-			(int *) malloc(sizeof(int) *
-				       max(num_nodes, max_updown_nodes));
-		memset(node_updown, 0,
-		       sizeof(int) * max(num_nodes, max_updown_nodes));
+		size_t buf_len = sizeof(int) * max(num_nodes, max_updown_nodes);
+		node_updown = malloc(buf_len);
+		if (node_updown)
+			memset(node_updown, 0, buf_len);
 	}
 }
 
 
 /* Convert a node name to a CSID */
-static int _csid_from_name(char *csid, char *name)
+static int _csid_from_name(char *csid, const char *name)
 {
 	int i;
 
@@ -347,7 +349,7 @@
 }
 
 /* Convert a CSID to a node name */
-static int _name_from_csid(char *csid, char *name)
+static int _name_from_csid(const char *csid, char *name)
 {
 	int i;
 
@@ -379,7 +381,7 @@
 }
 
 /* Convert a CSID to a node ID */
-static int nodeid_from_csid(char *csid)
+static int nodeid_from_csid(const char *csid)
 {
         int nodeid;
 
--- LVM2/daemons/clvmd/clvmd-command.c	2007/04/27 17:46:16	1.15
+++ LVM2/daemons/clvmd/clvmd-command.c	2007/05/02 12:22:40	1.16
@@ -95,13 +95,22 @@
 		/* Just a test message */
 	case CLVMD_CMD_TEST:
 		if (arglen > buflen) {
+			char *new_buf;
 			buflen = arglen + 200;
-			*buf = realloc(*buf, buflen);
+			new_buf = realloc(*buf, buflen);
+			if (new_buf == NULL) {
+				status = errno;
+				free (*buf);
+			}
+			*buf = new_buf;
+		}
+		if (*buf) {
+			uname(&nodeinfo);
+			*retlen = 1 + snprintf(*buf, buflen,
+					       "TEST from %s: %s v%s",
+					       nodeinfo.nodename, args,
+					       nodeinfo.release);
 		}
-		uname(&nodeinfo);
-		*retlen = 1 + snprintf(*buf, buflen, "TEST from %s: %s v%s",
-				       nodeinfo.nodename, args,
-				       nodeinfo.release);
 		break;
 
 	case CLVMD_CMD_LOCK_VG:
@@ -118,7 +127,7 @@
 		/* Replace EIO with something less scary */
 		if (status == EIO) {
 			*retlen =
-			    1 + snprintf(*buf, buflen,
+			    1 + snprintf(*buf, buflen, "%s",
 					 get_last_lvm_error());
 			return EIO;
 		}
@@ -131,7 +140,7 @@
 	case CLVMD_CMD_GET_CLUSTERNAME:
 		status = clops->get_cluster_name(*buf, buflen);
 		if (!status)
-			*retlen = strlen(*buf);
+			*retlen = strlen(*buf)+1;
 		break;
 
 	default:
@@ -141,7 +150,7 @@
 
 	/* Check the status of the command and return the error text */
 	if (status) {
-		*retlen = 1 + snprintf(*buf, buflen, strerror(status));
+		*retlen = 1 + snprintf(*buf, buflen, "%s", strerror(status));
 	}
 
 	return status;
--- LVM2/daemons/clvmd/clvmd-comms.h	2006/10/09 14:11:57	1.6
+++ LVM2/daemons/clvmd/clvmd-comms.h	2007/05/02 12:22:40	1.7
@@ -25,27 +25,31 @@
 struct cluster_ops {
 	void (*cluster_init_completed) (void);
 
-	int (*cluster_send_message) (void *buf, int msglen, char *csid,
-				const char *errtext);
-	int (*name_from_csid) (char *csid, char *name);
-	int (*csid_from_name) (char *csid, char *name);
+	int (*cluster_send_message) (const void *buf, int msglen,
+				     const char *csid,
+				     const char *errtext);
+	int (*name_from_csid) (const char *csid, char *name);
+	int (*csid_from_name) (char *csid, const char *name);
 	int (*get_num_nodes) (void);
 	int (*cluster_fd_callback) (struct local_client *fd, char *buf, int len,
-			       char *csid, struct local_client **new_client);
+				    const char *csid,
+				    struct local_client **new_client);
 	int (*get_main_cluster_fd) (void);	/* gets accept FD or cman cluster socket */
 	int (*cluster_do_node_callback) (struct local_client *client,
-				    void (*callback) (struct local_client *,
-						      char *csid, int node_up));
+					 void (*callback) (struct local_client *,
+							   const char *csid,
+							   int node_up));
 	int (*is_quorate) (void);
 
 	void (*get_our_csid) (char *csid);
-	void (*add_up_node) (char *csid);
+	void (*add_up_node) (const char *csid);
 	void (*reread_config) (void);
 	void (*cluster_closedown) (void);
 
 	int (*get_cluster_name)(char *buf, int buflen);
 
-	int (*sync_lock) (const char *resource, int mode, int flags, int *lockid);
+	int (*sync_lock) (const char *resource, int mode,
+			  int flags, int *lockid);
 	int (*sync_unlock) (const char *resource, int lockid);
 
 };
--- LVM2/daemons/clvmd/clvmd.c	2007/04/27 17:46:16	1.35
+++ LVM2/daemons/clvmd/clvmd.c	2007/05/02 12:22:40	1.36
@@ -115,31 +115,32 @@
 static void free_reply(struct local_client *client);
 static void send_version_message(void);
 static void *pre_and_post_thread(void *arg);
-static int send_message(void *buf, int msglen, char *csid, int fd,
+static int send_message(void *buf, int msglen, const char *csid, int fd,
 			const char *errtext);
 static int read_from_local_sock(struct local_client *thisfd);
 static int process_local_command(struct clvm_header *msg, int msglen,
 				 struct local_client *client,
 				 unsigned short xid);
 static void process_remote_command(struct clvm_header *msg, int msglen, int fd,
-				   char *csid);
-static int process_reply(struct clvm_header *msg, int msglen, char *csid);
+				   const char *csid);
+static int process_reply(const struct clvm_header *msg, int msglen,
+			 const char *csid);
 static int open_local_sock(void);
 static struct local_client *find_client(int clientid);
 static void main_loop(int local_sock, int cmd_timeout);
 static void be_daemon(int start_timeout);
 static int check_all_clvmds_running(struct local_client *client);
 static int local_rendezvous_callback(struct local_client *thisfd, char *buf,
-				     int len, char *csid,
+				     int len, const char *csid,
 				     struct local_client **new_client);
 static void *lvm_thread_fn(void *);
 static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg,
-			   int msglen, char *csid);
+			   int msglen, const char *csid);
 static int distribute_command(struct local_client *thisfd);
 static void hton_clvm(struct clvm_header *hdr);
 static void ntoh_clvm(struct clvm_header *hdr);
 static void add_reply_to_list(struct local_client *client, int status,
-			      char *csid, const char *buf, int len);
+			      const char *csid, const char *buf, int len);
 
 static void usage(char *prog, FILE *file)
 {
@@ -359,7 +360,8 @@
 
 /* Data on a connected socket */
 static int local_sock_callback(struct local_client *thisfd, char *buf, int len,
-			       char *csid, struct local_client **new_client)
+			       const char *csid,
+			       struct local_client **new_client)
 {
 	*new_client = NULL;
 	return read_from_local_sock(thisfd);
@@ -367,7 +369,7 @@
 
 /* Data on a connected socket */
 static int local_rendezvous_callback(struct local_client *thisfd, char *buf,
-				     int len, char *csid,
+				     int len, const char *csid,
 				     struct local_client **new_client)
 {
 	/* Someone connected to our local socket, accept it. */
@@ -408,7 +410,7 @@
 }
 
 static int local_pipe_callback(struct local_client *thisfd, char *buf,
-			       int maxlen, char *csid,
+			       int maxlen, const char *csid,
 			       struct local_client **new_client)
 {
 	int len;
@@ -484,7 +486,7 @@
    add one with "ETIMEDOUT".
    NOTE: This won't race with real replies because they happen in the same thread.
 */
-static void timedout_callback(struct local_client *client, char *csid,
+static void timedout_callback(struct local_client *client, const char *csid,
 			      int node_up)
 {
 	if (node_up) {
@@ -1152,7 +1154,7 @@
 
 /* Process a command from a remote node and return the result */
 static void process_remote_command(struct clvm_header *msg, int msglen, int fd,
-			    	   char *csid)
+			    	   const char *csid)
 {
 	char *replyargs;
 	char nodename[max_cluster_member_name_len];
@@ -1352,7 +1354,7 @@
    If we have got a full set then send them to the waiting client down the local
    socket */
 static void add_reply_to_list(struct local_client *client, int status,
-			      char *csid, const char *buf, int len)
+			      const char *csid, const char *buf, int len)
 {
 	struct node_reply *reply;
 
@@ -1529,7 +1531,7 @@
 	return status;
 }
 
-static int process_reply(struct clvm_header *msg, int msglen, char *csid)
+static int process_reply(const struct clvm_header *msg, int msglen, const char *csid)
 {
 	struct local_client *client = NULL;
 
@@ -1679,7 +1681,7 @@
 }
 
 /* Send a message to either a local client or another server */
-static int send_message(void *buf, int msglen, char *csid, int fd,
+static int send_message(void *buf, int msglen, const char *csid, int fd,
 			const char *errtext)
 {
 	int len;
@@ -1701,7 +1703,7 @@
 			if (retry_cnt > MAX_RETRIES)
 			{
 				errno = saved_errno;
-				log_error(errtext);
+				log_error("%s", errtext);
 				errno = saved_errno;
 				break;
 			}
@@ -1725,7 +1727,7 @@
 
 					continue;
 				}
-				log_error(errtext);
+				log_error("%s", errtext);
 				break;
 			}
 			ptr += len;
@@ -1811,7 +1813,7 @@
 
 /* Pass down some work to the LVM thread */
 static int add_to_lvmqueue(struct local_client *client, struct clvm_header *msg,
-			   int msglen, char *csid)
+			   int msglen, const char *csid)
 {
 	struct lvm_thread_cmd *cmd;
 
@@ -1889,7 +1891,8 @@
 	return local_socket;
 }
 
-void process_message(struct local_client *client, char *buf, int len, char *csid)
+void process_message(struct local_client *client, const char *buf, int len,
+		     const char *csid)
 {
 	struct clvm_header *inheader;
 
@@ -1902,7 +1905,7 @@
 }
 
 
-static void check_all_callback(struct local_client *client, char *csid,
+static void check_all_callback(struct local_client *client, const char *csid,
 			       int node_up)
 {
 	if (!node_up)
--- LVM2/daemons/clvmd/clvmd.h	2006/11/30 13:19:42	1.8
+++ LVM2/daemons/clvmd/clvmd.h	2007/05/02 12:22:40	1.9
@@ -76,7 +76,8 @@
 };
 
 typedef int (*fd_callback_t) (struct local_client * fd, char *buf, int len,
-			      char *csid, struct local_client ** new_client);
+			      const char *csid,
+			      struct local_client ** new_client);
 
 /* One of these for each fd we are listening on */
 struct local_client {
@@ -112,7 +113,8 @@
 extern int add_client(struct local_client *new_client);
 
 extern void clvmd_cluster_init_completed(void);
-extern void process_message(struct local_client *client, char *buf, int len, char *csid);
+extern void process_message(struct local_client *client, const char *buf,
+			    int len, const char *csid);
 extern void debuglog(const char *fmt, ... );
 
 int sync_lock(const char *resource, int mode, int flags, int *lockid);
--- LVM2/daemons/clvmd/tcp-comms.c	2007/04/27 17:46:16	1.16
+++ LVM2/daemons/clvmd/tcp-comms.c	2007/05/02 12:22:40	1.17
@@ -92,41 +92,37 @@
     return 0;
 }
 
-void tcp_remove_client(char *csid)
- {
+void tcp_remove_client(const char *c_csid)
+{
     struct local_client *client;
+    char csid[GULM_MAX_CSID_LEN];
+    unsigned int i;
+    memcpy(csid, c_csid, sizeof csid);
     DEBUGLOG("tcp_remove_client\n");
 
     /* Don't actually close the socket here - that's the
        job of clvmd.c whch will do the job when it notices the
        other end has gone. We just need to remove the client(s) from
        the hash table so we don't try to use it for sending any more */
-    client = dm_hash_lookup_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
-    if (client)
+    for (i = 0; i < 2; i++)
     {
-	dm_hash_remove_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
-	client->removeme = 1;
-	close(client->fd);
-    }
-
-    /* Look for a mangled one too */
-    csid[0] ^= 0x80;
-
-    client = dm_hash_lookup_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
-    if (client)
-    {
-	dm_hash_remove_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
-	client->removeme = 1;
-	close(client->fd);
+	client = dm_hash_lookup_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
+	if (client)
+	{
+	    dm_hash_remove_binary(sock_hash, csid, GULM_MAX_CSID_LEN);
+	    client->removeme = 1;
+	    close(client->fd);
+	}
+	/* Look for a mangled one too, on the 2nd iteration. */
+	csid[0] ^= 0x80;
     }
-
-    /* Put it back as we found it */
-    csid[0] ^= 0x80;
 }
 
-int alloc_client(int fd, char *csid, struct local_client **new_client)
+int alloc_client(int fd, const char *c_csid, struct local_client **new_client)
 {
     struct local_client *client;
+    char csid[GULM_MAX_CSID_LEN];
+    memcpy(csid, c_csid, sizeof csid);
 
     DEBUGLOG("alloc_client %d csid = %s\n", fd, print_csid(csid));
 
@@ -315,7 +311,7 @@
     return status;
 }
 
-int gulm_connect_csid(char *csid, struct local_client **newclient)
+int gulm_connect_csid(const char *csid, struct local_client **newclient)
 {
     int fd;
     struct sockaddr_in6 addr;
@@ -366,7 +362,7 @@
 }
 
 /* Send a message to a known CSID */
-static int tcp_send_message(void *buf, int msglen, unsigned char *csid, const char *errtext)
+static int tcp_send_message(void *buf, int msglen, const char *csid, const char *errtext)
 {
     int status;
     struct local_client *client;
@@ -465,7 +461,7 @@
 }
 
 /* Get someone else's IP address from DNS */
-int get_ip_address(char *node, char *addr)
+int get_ip_address(const char *node, char *addr)
 {
     struct hostent *he;
 
@@ -493,7 +489,7 @@
     return 0;
 }
 
-char *print_csid(char *csid)
+char *print_csid(const char *csid)
 {
     static char buf[128];
     int *icsid = (int *)csid;
--- LVM2/daemons/clvmd/tcp-comms.h	2005/02/22 16:26:21	1.4
+++ LVM2/daemons/clvmd/tcp-comms.h	2007/05/02 12:22:40	1.5
@@ -5,9 +5,9 @@
 #define GULM_MAX_CLUSTER_MEMBER_NAME_LEN 128
 
 extern int init_comms(unsigned short);
-extern char *print_csid(char *);
+extern char *print_csid(const char *);
 int get_main_gulm_cluster_fd(void);
 int cluster_fd_gulm_callback(struct local_client *fd, char *buf, int len, char *csid, struct local_client **new_client);
 int gulm_cluster_send_message(void *buf, int msglen, char *csid, const char *errtext);
 void get_our_gulm_csid(char *csid);
-int gulm_connect_csid(char *csid, struct local_client **newclient);
+int gulm_connect_csid(const char *csid, struct local_client **newclient);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
@ 2005-03-07 17:03 pcaulfield
  0 siblings, 0 replies; 7+ messages in thread
From: pcaulfield @ 2005-03-07 17:03 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	pcaulfield@sourceware.org	2005-03-07 17:03:44

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-cman.c clvmd-command.c clvmd-gulm.c 
	                 clvmd.c lvm-functions.c lvm-functions.h 
	                 tcp-comms.c 

Log message:
	make clvmd FDs close-on-exec, to avoid warnings when running lvm via popen.
	clvmd-gulm unlocks VG & orphan locks at startup in case they are stale.
	clvmd-gulm now unlocks VG & orphan locks if client dies.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.196&r2=1.197
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-cman.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-gulm.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/tcp-comms.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-25 19:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-25 19:37 LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2011-01-19 23:09 mbroz
2010-06-21 15:57 agk
2009-04-21 13:11 mbroz
2009-02-10 11:52 ccaulfield
2007-05-02 12:22 pcaulfield
2005-03-07 17:03 pcaulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).