You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

lib/activate/dev_manager.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 56608e3..a5e026c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1592,6 +1592,9 @@ int dev_manager_thin_percent(struct dev_manager *dm,
return 1;
}
+/*
+ * Explore state of running DM table to obtain currently used deviceId
+ */
int dev_manager_thin_device_id(struct dev_manager *dm,
const struct logical_volume *lv,
uint32_t *device_id)
@@ -1601,10 +1604,16 @@ int dev_manager_thin_device_id(struct dev_manager *dm,
struct dm_info info;
uint64_t start, length;
char *params, *target_type = NULL;
+ const char *layer = lv_layer(lv);
int r = 0;
+ if (lv_is_merging_origin(lv) && !lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
+ /* If the merge has already happened, that table
+ * can already be using correct LV without -real layer */
+ layer = NULL;
+
/* Build dlid for the thin layer */
- if (!(dlid = build_dm_uuid(dm->mem, lv, lv_layer(lv))))
+ if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
if (!(dmt = _setup_task_run(DM_DEVICE_TABLE, &info, NULL, dlid, 0, 0, 0, 0, 1, 0)))