From 25d1410592aa4b928a8449038dab2eefab3d6e61 Mon Sep 17 00:00:00 2001 From: Jonathan Earl Brassow Date: Fri, 20 Jan 2012 00:27:18 +0000 Subject: Preserve exclusive activation of cluster mirror when converting. This patch to the suspend code - like the similar change for resume - queries the lock mode of a cluster volume and records whether it is active exclusively. This is necessary for suspend due to the possibility of preloading targets. Failure to check to exclusivity causes the cluster target of an exclusively activated mirror to be used when converting - rather than the single machine target. --- daemons/clvmd/lvm-functions.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'daemons/clvmd') diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index 9f11d22a..6c2fbfe3 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -430,6 +430,7 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo int oldmode; struct lvinfo lvi; unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0; + unsigned exclusive; /* Is it open ? */ oldmode = get_current_lock(resource); @@ -438,11 +439,14 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo return 0; /* Not active, so it's OK */ } + exclusive = (oldmode == LCK_EXCL) ? 1 : 0; + /* Only suspend it if it exists */ if (!lv_info_by_lvid(cmd, resource, origin_only, &lvi, 0, 0)) return EIO; - if (lvi.exists && !lv_suspend_if_active(cmd, resource, origin_only)) + if (lvi.exists && + !lv_suspend_if_active(cmd, resource, origin_only, exclusive)) return EIO; return 0; -- cgit