mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_02_187-thin-activate-layer-pool-aas-read-only-LV.patch

2b52f6
From c1a6e218334ac561a695fa4cefd69208ba93107e Mon Sep 17 00:00:00 2001
2b52f6
From: Zdenek Kabelac <zkabelac@redhat.com>
2b52f6
Date: Sat, 14 Sep 2019 01:08:14 +0200
2b52f6
Subject: [PATCH 6/6] thin: activate layer pool aas read-only LV
2b52f6
2b52f6
When lvm2 is activating layered pool LV (to basically keep pool opened,
2b52f6
the other function used to be 'locking' be in sync with DM table)
2b52f6
use this LV in read-only mode - this prevents 'write' access into
2b52f6
data volume content of thin-pool.
2b52f6
2b52f6
Note: since EMPTY/unused thin-pool is created as 'public LV' for generic
2b52f6
use by any user who i.e. wish to maintain thin-pool and thins himself.
2b52f6
At this moment, thin-pool appears as writable LV.  As soon as the 1st.
2b52f6
thinLV is created, layer volume will appear is 'read-only' LV from this moment.
2b52f6
2b52f6
(cherry picked from commit 2e51535b18f3a05428f087f3916ebce5c08d58d1)
2b52f6
2b52f6
Conflicts:
2b52f6
	WHATS_NEW
2b52f6
---
2b52f6
 WHATS_NEW                  | 1 +
2b52f6
 lib/activate/dev_manager.c | 5 +++++
2b52f6
 2 files changed, 6 insertions(+)
2b52f6
2b52f6
diff --git a/WHATS_NEW b/WHATS_NEW
2b52f6
index d1f4530..00b84f9 100644
2b52f6
--- a/WHATS_NEW
2b52f6
+++ b/WHATS_NEW
2b52f6
@@ -2,6 +2,7 @@ Version 2.02.187 -
2b52f6
 ===================================
2b52f6
   Prevent creating VGs with PVs with different logical block sizes.
2b52f6
   Pvmove runs in exlusively activating mode for exclusively active LVs.
2b52f6
+  Activate thin-pool layered volume as 'read-only' device.
2b52f6
   Enhance validation for thin and cache pool conversion and swapping.
2b52f6
 
2b52f6
 Version 2.02.186 - 27th August 2019
2b52f6
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
2b52f6
index dc64159..56608e3 100644
2b52f6
--- a/lib/activate/dev_manager.c
2b52f6
+++ b/lib/activate/dev_manager.c
2b52f6
@@ -84,6 +84,11 @@ int read_only_lv(const struct logical_volume *lv, const struct lv_activate_opts
2b52f6
 	if (lv_is_raid_image(lv) || lv_is_raid_metadata(lv))
2b52f6
 		return 0; /* Keep RAID SubLvs writable */
2b52f6
 
2b52f6
+	if (!layer) {
2b52f6
+		if (lv_is_thin_pool(lv))
2b52f6
+			return 1;
2b52f6
+	}
2b52f6
+
2b52f6
 	return (laopts->read_only || !(lv->status & LVM_WRITE));
2b52f6
 }
2b52f6
 
2b52f6
-- 
2b52f6
1.8.3.1
2b52f6