SHA256
1
0
forked from pool/lvm2
lvm2/call_cpg_leave_before_shutdown.diff

45 lines
1.6 KiB
Diff

Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd-openais.c 2009-04-01 20:12:52.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd-openais.c 2009-04-01 20:13:23.000000000 +0800
@@ -342,7 +342,7 @@
err = cpg_join(cpg_handle, &cpg_group_name);
if (err != SA_AIS_OK) {
cpg_finalize(cpg_handle);
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
syslog(LOG_ERR, "Cannot join clvmd process group");
DEBUGLOG("Cannot join clvmd process group: %d\n", err);
return ais_to_errno(err);
@@ -351,8 +351,9 @@
err = cpg_local_get(cpg_handle,
&our_nodeid);
if (err != SA_AIS_OK) {
+ cpg_leave(cpg_handle, &cpg_group_name);
cpg_finalize(cpg_handle);
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
syslog(LOG_ERR, "Cannot get local node id\n");
return ais_to_errno(err);
}
@@ -369,15 +370,11 @@
unlock_all();
int r;
- r = dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
- if (r == -1) {
- if (errno == EBUSY) {
- syslog(LOG_ERR, "Some locks still active, close by force\n");
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
- } else {
- syslog(LOG_ERR, "dlm_release_lockspace failed\n");
- }
+ r = dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ if (r != 0) {
+ syslog(LOG_ERR, "dlm_release_lockspace failed: %d\n", errno);
}
+ cpg_leave(cpg_handle, &cpg_group_name);
cpg_finalize(cpg_handle);
}