49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
From ec6ba10081488699edaba1c80ef69f5a14bced00 Mon Sep 17 00:00:00 2001
|
|
From: root <root@localhost.localdomain>
|
|
Date: Wed, 13 Mar 2019 22:20:42 +0800
|
|
Subject: [PATCH 15/19] lvmlockd: fix missing LV lock for lvconvert repair
|
|
|
|
Add missing lvmlockd LV lock for lvconvert repair
|
|
on mirror and thin/cache pools.
|
|
---
|
|
tools/lvconvert.c | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
|
index d7a618d..794877e 100644
|
|
--- a/tools/lvconvert.c
|
|
+++ b/tools/lvconvert.c
|
|
@@ -3461,6 +3461,18 @@ static int _lvconvert_repair_pvs_mirror(struct cmd_context *cmd, struct logical_
|
|
struct lvinfo info;
|
|
int ret;
|
|
|
|
+ /*
|
|
+ * We want to allow cmirror active on multiple nodes to be repaired,
|
|
+ * but normal mirror to only be repaired if active exclusively here.
|
|
+ * If the LV is active it already has the necessary lock, but if not
|
|
+ * active, then require ex since we cannot know the active state on
|
|
+ * other hosts.
|
|
+ */
|
|
+ if (!lv_is_active(lv)) {
|
|
+ if (!lockd_lv(cmd, lv, "ex", 0))
|
|
+ return_0;
|
|
+ }
|
|
+
|
|
/*
|
|
* FIXME: temporary use of lp because _lvconvert_mirrors_repair()
|
|
* and _aux() still use lp fields everywhere.
|
|
@@ -3594,6 +3606,10 @@ static int _lvconvert_repair_cachepool_thinpool(struct cmd_context *cmd, struct
|
|
int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
|
|
struct dm_list *use_pvh;
|
|
|
|
+ /* ensure it's not active elsewhere. */
|
|
+ if (!lockd_lv(cmd, lv, "ex", 0))
|
|
+ return_0;
|
|
+
|
|
if (cmd->position_argc > 1) {
|
|
/* First pos arg is required LV, remaining are optional PVs. */
|
|
if (!(use_pvh = create_pv_list(cmd->mem, lv->vg, cmd->position_argc - 1, cmd->position_argv + 1, 0)))
|
|
--
|
|
2.19.1
|
|
|