Blame SOURCES/lvm2-2_02_186-lvmlockd-do-not-allow-mirror-LV-to-be-activated-shar.patch

ed3f07
 WHATS_NEW                  |  4 ++++
ed3f07
 lib/commands/toolcontext.h |  1 -
ed3f07
 lib/locking/lvmlockd.c     | 38 +-------------------------------------
ed3f07
 lib/metadata/mirror.c      | 12 ------------
ed3f07
 lib/mirror/mirrored.c      |  9 ---------
ed3f07
 man/lvmlockd.8_main        |  2 +-
ed3f07
 6 files changed, 6 insertions(+), 60 deletions(-)
ed3f07
ed3f07
diff --git a/WHATS_NEW b/WHATS_NEW
ed3f07
index 4e75c6a..106661f 100644
ed3f07
--- a/WHATS_NEW
ed3f07
+++ b/WHATS_NEW
ed3f07
@@ -1,3 +1,7 @@
ed3f07
+Version 2.02.186 - 
ed3f07
+================================
ed3f07
+  Prevent shared active mirror LVs with lvmlockd.
ed3f07
+
ed3f07
 Version 2.02.185 - 13th May 2019
ed3f07
 ================================
ed3f07
   Fix change of monitoring in clustered volumes.
ed3f07
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
ed3f07
index da5d582..485dca9 100644
ed3f07
--- a/lib/commands/toolcontext.h
ed3f07
+++ b/lib/commands/toolcontext.h
ed3f07
@@ -163,7 +163,6 @@ struct cmd_context {
ed3f07
 	unsigned lockd_vg_rescan:1;
ed3f07
 	unsigned lockd_vg_default_sh:1;
ed3f07
 	unsigned lockd_vg_enforce_sh:1;
ed3f07
-	unsigned lockd_lv_sh:1;
ed3f07
 	unsigned vg_notify:1;
ed3f07
 	unsigned lv_notify:1;
ed3f07
 	unsigned pv_notify:1;
ed3f07
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
ed3f07
index 788b62b..1160126 100644
ed3f07
--- a/lib/locking/lvmlockd.c
ed3f07
+++ b/lib/locking/lvmlockd.c
ed3f07
@@ -2076,15 +2076,6 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
ed3f07
 		return 0;
ed3f07
 	}
ed3f07
 
ed3f07
-	/*
ed3f07
-	 * This is a hack for mirror LVs which need to know at a very low level
ed3f07
-	 * which lock mode the LV is being activated with so that it can pick
ed3f07
-	 * a mirror log type during activation.  Do not use this for anything
ed3f07
-	 * else.
ed3f07
-	 */
ed3f07
-	if (mode && !strcmp(mode, "sh"))
ed3f07
-		cmd->lockd_lv_sh = 1;
ed3f07
-
ed3f07
 	if (!mode)
ed3f07
 		mode = "ex";
ed3f07
 
ed3f07
@@ -2209,31 +2200,6 @@ static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
ed3f07
 }
ed3f07
 
ed3f07
 /*
ed3f07
- * Only the combination of dlm + corosync + cmirrord allows
ed3f07
- * mirror LVs to be activated in shared mode on multiple nodes.
ed3f07
- */
ed3f07
-static int _lockd_lv_mirror(struct cmd_context *cmd, struct logical_volume *lv,
ed3f07
-			    const char *def_mode, uint32_t flags)
ed3f07
-{
ed3f07
-	if (!strcmp(lv->vg->lock_type, "sanlock"))
ed3f07
-		flags |= LDLV_MODE_NO_SH;
ed3f07
-
ed3f07
-	else if (!strcmp(lv->vg->lock_type, "dlm") && def_mode && !strcmp(def_mode, "sh")) {
ed3f07
-#ifdef CMIRRORD_PIDFILE
ed3f07
-		if (!cmirrord_is_running()) {
ed3f07
-			log_error("cmirrord must be running to activate an LV in shared mode.");
ed3f07
-			return 0;
ed3f07
-		}
ed3f07
-#else
ed3f07
-		flags |= LDLV_MODE_NO_SH;
ed3f07
-#endif
ed3f07
-	}
ed3f07
-
ed3f07
-	return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
ed3f07
-			     lv->lock_args, def_mode, flags);
ed3f07
-}
ed3f07
-
ed3f07
-/*
ed3f07
  * If the VG has no lock_type, then this function can return immediately.
ed3f07
  * The LV itself may have no lock (NULL lv->lock_args), but the lock request
ed3f07
  * may be directed to another lock, e.g. the pool LV lock in _lockd_lv_thin.
ed3f07
@@ -2286,14 +2252,12 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
ed3f07
 	 */
ed3f07
 	if (lv_is_external_origin(lv) ||
ed3f07
 	    lv_is_thin_type(lv) ||
ed3f07
+	    lv_is_mirror_type(lv) ||
ed3f07
 	    lv_is_raid_type(lv) ||
ed3f07
 	    lv_is_cache_type(lv)) {
ed3f07
 		flags |= LDLV_MODE_NO_SH;
ed3f07
 	}
ed3f07
 
ed3f07
-	if (lv_is_mirror_type(lv))
ed3f07
-		return _lockd_lv_mirror(cmd, lv, def_mode, flags);
ed3f07
-	       
ed3f07
 	return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
ed3f07
 			     lv->lock_args, def_mode, flags);
ed3f07
 }
ed3f07
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
ed3f07
index b1dcaa0..cd8ce1e 100644
ed3f07
--- a/lib/metadata/mirror.c
ed3f07
+++ b/lib/metadata/mirror.c
ed3f07
@@ -2104,18 +2104,6 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
ed3f07
 		}
ed3f07
 	}
ed3f07
 
ed3f07
-	if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "dlm") && cmd->lockd_lv_sh) {
ed3f07
-		if (!cluster_mirror_is_available(cmd)) {
ed3f07
-			log_error("Shared cluster mirrors are not available.");
ed3f07
-			return 0;
ed3f07
-		}
ed3f07
-
ed3f07
-		if (log_count > 1) {
ed3f07
-			log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
ed3f07
-			return 0;
ed3f07
-		}
ed3f07
-	}
ed3f07
-
ed3f07
 	/* For corelog mirror, activation code depends on
ed3f07
 	 * the global mirror_in_sync status. As we are adding
ed3f07
 	 * a new mirror, it should be set as 'out-of-sync'
ed3f07
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
ed3f07
index 7c5c0a6..606bcf0 100644
ed3f07
--- a/lib/mirror/mirrored.c
ed3f07
+++ b/lib/mirror/mirrored.c
ed3f07
@@ -285,15 +285,6 @@ static int _add_log(struct dm_pool *mem, struct lv_segment *seg,
ed3f07
 	if (!laopts->exclusive && vg_is_clustered(seg->lv->vg))
ed3f07
 		clustered = 1;
ed3f07
 
ed3f07
-	else if (seg->lv->vg->lock_type && !strcmp(seg->lv->vg->lock_type, "dlm")) {
ed3f07
-		/*
ed3f07
-		 * If shared lock was used due to -asy, then we set clustered
ed3f07
-		 * to use a clustered mirror log with cmirrod.
ed3f07
-		 */
ed3f07
-		if (seg->lv->vg->cmd->lockd_lv_sh)
ed3f07
-			clustered = 1;
ed3f07
-	}
ed3f07
-
ed3f07
 	if (seg->log_lv) {
ed3f07
 		/* If disk log, use its UUID */
ed3f07
 		if (!(log_dlid = build_dm_uuid(mem, seg->log_lv, NULL))) {
ed3f07
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
ed3f07
index cfb45b2..3f0e3ed 100644
ed3f07
--- a/man/lvmlockd.8_main
ed3f07
+++ b/man/lvmlockd.8_main
ed3f07
@@ -545,7 +545,7 @@ report an error and fail.
ed3f07
 The shared mode is intended for a multi-host/cluster application or
ed3f07
 file system.
ed3f07
 LV types that cannot be used concurrently
ed3f07
-from multiple hosts include thin, cache, raid, and snapshot.
ed3f07
+from multiple hosts include thin, cache, raid, mirror, and snapshot.
ed3f07
 
ed3f07
 .IP \fBn\fP
ed3f07
 The command deactivates the LV.  After deactivating the LV, the command