public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mbroz@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-cman.c da ...
Date: Wed, 19 Jan 2011 23:09:00 -0000	[thread overview]
Message-ID: <20110119230932.22038.qmail@sourceware.org> (raw)

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");
 


             reply	other threads:[~2011-01-19 23:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 23:09 mbroz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-09-25 19:37 zkabelac
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110119230932.22038.qmail@sourceware.org \
    --to=mbroz@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).