From 679830cf580b77305bf1c34f84d6e40d0453bdd1 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Wed, 19 Jan 2011 23:09:31 +0000 Subject: 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 --- daemons/clvmd/clvmd-cman.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'daemons/clvmd/clvmd-cman.c') diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c index 52da2acb..c7a2b2d7 100644 --- a/daemons/clvmd/clvmd-cman.c +++ b/daemons/clvmd/clvmd-cman.c @@ -89,16 +89,17 @@ static int _init_cluster(void) 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; -- cgit