[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] get exclusive lock on an LV before removing it.



This patch is for BZ#209370 and prevents removing of an LV that is activated exclusively on another node.

patrick


Index: tools/lvremove.c
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/lvremove.c,v
retrieving revision 1.48
diff -u -p -r1.48 lvremove.c
--- tools/lvremove.c	9 May 2006 21:23:51 -0000	1.48
+++ tools/lvremove.c	23 Oct 2006 10:10:48 -0000
@@ -75,6 +75,16 @@ static int lvremove_single(struct cmd_co
 	if (!archive(vg))
 		return ECMD_FAILED;

+	/* If the VG is clustered then make sure no-one else is using the LV
+	   we are about to remove */
+	if (vg->status & CLUSTERED) {
+		if (!activate_lv_excl(cmd, lv)) {
+			log_error("Can't get exclusive access to volume \"%s\"",
+				  lv->name);
+			return ECMD_FAILED;
+		}
+	}
+
 	/* FIXME Snapshot commit out of sequence if it fails after here? */
 	if (!deactivate_lv(cmd, lv)) {
 		log_error("Unable to deactivate logical volume \"%s\"",


-- 

patrick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]