Skip to contentSkip to conversation

master - lvmlockd: use lock on thin pool when command names tdata

PATCH David Teigland 1 participant 1 message Jul 7, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0f6135e5c53af8bb361932ebe8fec55a1804cc9
Commit:        a0f6135e5c53af8bb361932ebe8fec55a1804cc9
Parent:        fdd00ecdd1fd51605be1b616d712a2220ced8875
Author:        David Teigland <[email protected]>
AuthorDate:    Fri Jul 7 12:06:53 2017 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Fri Jul 7 12:06:53 2017 -0500

lvmlockd: use lock on thin pool when command names tdata

Some lvconvert commands can be used directly on the data sublv:
lvconvert ... vg/pool_tdata

The correct LV lock to use in lvmlockd is the one on the pool LV.

---
 lib/locking/lvmlockd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
lib/locking/lvmlockd.c +4 -0
index 92a970a..34b3882 100644
@@ -2077,6 +2077,10 @@ static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
 	} else if (lv_is_thin_pool(lv)) {
 		pool_lv = lv;
 
+	} else if (lv_is_thin_pool_data(lv)) {
+		/* FIXME: there should be a function to get pool lv from data lv. */
+		pool_lv = lv_parent(lv);
+
 	} else {
 		/* This should not happen AFAIK. */
 		log_error("Lock on incorrect thin lv type %s/%s",