diff options
author | Milan Broz <mbroz@redhat.com> | 2011-01-19 23:09:31 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2011-01-19 23:09:31 +0000 |
commit | 679830cf580b77305bf1c34f84d6e40d0453bdd1 (patch) | |
tree | fba7db48fd0306b9f4d8109ebeb9b03cc127619a /daemons/clvmd/clvmd-cman.c | |
parent | dbc8e5098c518645ddae991e17ded204b5ecc7e4 (diff) | |
download | lvm2-679830cf580b77305bf1c34f84d6e40d0453bdd1.tar.gz lvm2-679830cf580b77305bf1c34f84d6e40d0453bdd1.tar.xz lvm2-679830cf580b77305bf1c34f84d6e40d0453bdd1.zip |
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
Diffstat (limited to 'daemons/clvmd/clvmd-cman.c')
-rw-r--r-- | daemons/clvmd/clvmd-cman.c | 13 |
1 files changed, 7 insertions, 6 deletions
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; |