[lvm-devel] [PATCH 3/6] Unlock shared lock if activation calls failed.
Milan Broz
mbroz at redhat.com
Sat Jan 23 20:58:45 UTC 2010
Clvmd should unlock new lock if activation in device-mapper fails.
---
daemons/clvmd/lvm-functions.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 74c660e..02d401b 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -373,17 +373,22 @@ static int do_activate_lv(char *resource, unsigned char lock_flags, int mode)
/* If it's suspended then resume it */
if (!lv_info_by_lvid(cmd, resource, &lvi, 0, 0))
- return EIO;
+ goto error;
if (lvi.suspended)
if (!lv_resume(cmd, resource))
- return EIO;
+ goto error;
/* Now activate it */
if (!lv_activate(cmd, resource, exclusive))
- return EIO;
+ goto error;
return 0;
+
+error:
+ if (oldmode == -1 || oldmode != mode)
+ (void)hold_unlock(resource);
+ return EIO;
}
/* Resume the LV if it was active */
--
1.6.6
More information about the lvm-devel
mailing list