stable-2.02 - snapshot: correctly check device id of merged thin
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=20d94e4072a93c19978...
Commit: 20d94e4072a93c199781e282d142ba7c80c9a437
Parent: bc200e0b16676398eb0e2244ffa14315d25a1a5a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 25 23:31:08 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:39:20 2019 +0200
snapshot: correctly check device id of merged thin
When checking device id of a thin device that is just being
merged - the snapshot actually could have been already finished
which means '-real' suffix for the LV is already gone and just LV
is there - so check explicitely for this condition and use
correct UUID for this case.
---
lib/activate/dev_manager.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 886e11b..becbf6d 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1594,6 +1594,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)
@@ -1603,10 +1606,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)))
4 years, 6 months
stable-2.02 - tests: really check disabling of lvmetad
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc200e0b16676398eb0...
Commit: bc200e0b16676398eb0e2244ffa14315d25a1a5a
Parent: 36b8b9ed5c4b96d3a6482d76ca3eae54c62f9f2b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 24 16:43:06 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:29:44 2019 +0200
tests: really check disabling of lvmetad
Since lvconvert validated LV types that can be repaired,
the test was not working properly for longer time...
---
test/shell/lvmetad-disabled.sh | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/shell/lvmetad-disabled.sh b/test/shell/lvmetad-disabled.sh
index 84d7b54..389d191 100644
--- a/test/shell/lvmetad-disabled.sh
+++ b/test/shell/lvmetad-disabled.sh
@@ -55,13 +55,14 @@ grep "$dev1" out
grep "$dev2" out
not grep "WARNING: Not using lvmetad" out
-# We don't care about the repair, and we know it's
-# not valid on this lv. We are just running repair
-# because we know one side effect is to disable lvmetad.
-# FIXME: we should install lvmetactl so that we can
-# use that to directly disable lvmetad for tests like this.
-not lvconvert --repair $vg1/$lv1 2>&1 | tee out
+if aux have_raid 1 7 0 ; then
+# lvconvert validates repairable volumes.
+# We want to excercise if disabling of lvmetad works when it's running.
+# For this we create 'raid1' array and run repair on it.
+lvcreate --type raid1 -m1 --nosync -l1 --alloc anywhere -n $lv2 $vg1
+lvconvert -y --repair $vg1/$lv2 2>&1 | tee out
grep "WARNING: Disabling lvmetad cache" out
+fi
pvs -vvvv 2>&1 | tee out
grep "$dev1" out
4 years, 6 months
stable-2.02 - debug: avoid to slashes in debug message
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=36b8b9ed5c4b96d3a64...
Commit: 36b8b9ed5c4b96d3a6482d76ca3eae54c62f9f2b
Parent: cd39b67b7e91c06937d422b1f230b3b3f6e5a1ca
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 24 16:36:01 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:29:44 2019 +0200
debug: avoid to slashes in debug message
---
lib/device/dev-cache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index a429b10..f705ea3 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1590,7 +1590,7 @@ struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
sysfs_dir = dm_sysfs_dir();
if (sysfs_dir && *sysfs_dir) {
/* First check if dev is sysfs to avoid useless scan */
- if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d",
+ if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d",
sysfs_dir, (int)MAJOR(dev), (int)MINOR(dev)) < 0) {
log_error("dm_snprintf partition failed.");
return NULL;
4 years, 6 months
stable-2.02 - pvmove: detect exclusively active LVs
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cd39b67b7e91c06937d...
Commit: cd39b67b7e91c06937d422b1f230b3b3f6e5a1ca
Parent: 96fd312e85ce38a8fc8cb80f106f3fdc49c31a97
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 23 21:49:50 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:29:44 2019 +0200
pvmove: detect exclusively active LVs
Before pvmove start, it need to decide if exlusive mode of pvmove
must be used - this mode needs to be used if some move LV is
already exclusively activated.
---
tools/pvmove.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 3a447c4..cecff00 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -397,7 +397,8 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
/* Presence of exclusive LV decides whether pvmove must be also exclusive */
if (!seg_only_exclusive(seg)) {
holder = lv_lock_holder(lv);
- if (seg_only_exclusive(first_seg(holder)) || lv_is_origin(holder) || lv_is_cow(holder))
+ if (seg_only_exclusive(first_seg(holder)) || lv_is_origin(holder) ||
+ lv_is_cow(holder) || lv_is_active_exclusive(holder))
needs_exclusive = 1;
} else
needs_exclusive = 1;
4 years, 6 months
master - WHATS_NEW
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6163b733e1564b4c322...
Commit: 6163b733e1564b4c322204b9a8208e2ea4e63181
Parent: e88fd2edfd0d723bb26f7f29460ac668d794313f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 26 00:48:00 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:50:23 2019 +0200
WHATS_NEW
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 19b7ada..589e7cd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.07 -
===================================
+ Fix activation order when removing merged snapshot.
Version 2.03.06 - 23rd October 2019
===================================
4 years, 6 months
master - tests: explicit testing of thin snapshot
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e88fd2edfd0d723bb26...
Commit: e88fd2edfd0d723bb26f7f29460ac668d794313f
Parent: 0e5f39a5accf777db0cb5934f5adfd983c5e4491
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 26 00:15:31 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:49:16 2019 +0200
tests: explicit testing of thin snapshot
Check merging of old snapshot of thin LV.
---
test/shell/snapshot-merge-thin.sh | 49 +++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-merge-thin.sh b/test/shell/snapshot-merge-thin.sh
new file mode 100644
index 0000000..80969d1
--- /dev/null
+++ b/test/shell/snapshot-merge-thin.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2019 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Exercise merge of old snapshots over thin
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux target_at_least dm-snapshot-merge 1 0 0 || skip
+aux have_thin 1 0 0 || skip
+
+aux prepare_vg 2
+
+lvcreate -T -L1 -V1 -n $lv1 $vg/pool "$dev1"
+lvcreate -s -n $lv2 -L2 $vg/$lv1 "$dev2"
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync
+
+# Initiate background merge
+lvconvert -b --merge $vg/$lv2
+
+# Query status of snapshot immediatelly after start
+# - may hit race of checking already in-progress merge
+lvs -a -o+lv_merging,lv_merge_failed $vg
+
+sleep 1
+
+# Here should be everything already merged
+lvs -a -o+lv_merging,lv_merge_failed $vg
+
+# -real must not exist for $vg/$lv1
+not dmsetup info ${vg}-${lv1}-real 2>&1 | tee out
+grep "not exist" out
+
+not dmsetup info ${vg}-${lv2}-cow 2>&1 | tee out
+grep "not exist" out
+
+check lv_not_exists $vg $lv2
+
+vgremove -f $vg
4 years, 6 months
master - snapshot: use single merging sequence
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e5f39a5accf777db0c...
Commit: 0e5f39a5accf777db0cb5934f5adfd983c5e4491
Parent: 855b16ce14f09523132ea624a7b4d1edaccc2450
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 25 23:29:16 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:49:16 2019 +0200
snapshot: use single merging sequence
The resume of 'released' 'COW' should preceed the resume of origin.
The fact we need to do the sequence differently for merge was
cause by bugs fixed in 2 previous commits - so we no longer need
to recognize 'merging' and we should always go with single
sequence.
The importance of this order is - to properly remove '-real' device
from origin LV. When COW is activated as 2nd. '-real' device is
kept in table as it cannot be removed during 1st. resume of origin,
and later activation of COW LV no longer builds tree associated
with origin LV.
---
lib/metadata/snapshot_manip.c | 19 +------------------
1 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index d105942..e58aea4 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -286,7 +286,6 @@ int vg_add_snapshot(struct logical_volume *origin,
int vg_remove_snapshot(struct logical_volume *cow)
{
- int merging_snapshot = 0;
struct logical_volume *origin = origin_from_cow(cow);
int is_origin_active = lv_is_active(origin);
@@ -315,17 +314,6 @@ int vg_remove_snapshot(struct logical_volume *cow)
* preload origin IFF "snapshot-merge" target is active
* - IMPORTANT: avoids preload if inactivate merge is pending
*/
- if (lv_has_target_type(origin->vg->vgmem, origin, NULL,
- TARGET_NAME_SNAPSHOT_MERGE)) {
- /*
- * preload origin to:
- * - allow proper release of -cow
- * - avoid allocations with other devices suspended
- * when transitioning from "snapshot-merge" to
- * "snapshot-origin after a merge completes.
- */
- merging_snapshot = 1;
- }
}
if (!lv_remove(cow->snapshot->lv)) {
@@ -356,7 +344,7 @@ int vg_remove_snapshot(struct logical_volume *cow)
* the LV lock on cluster has to be grabbed, so use
* activate_lv() which resumes suspend cow device.
*/
- if (!merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
+ if (!activate_lv(cow->vg->cmd, cow)) {
log_error("Failed to activate %s.", cow->name);
return 0;
}
@@ -365,11 +353,6 @@ int vg_remove_snapshot(struct logical_volume *cow)
log_error("Failed to resume %s.", origin->name);
return 0;
}
-
- if (merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
- log_error("Failed to activate %s.", cow->name);
- return 0;
- }
}
return 1;
4 years, 6 months
master - snapshot: fix checking of merged thin volume
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=855b16ce14f09523132...
Commit: 855b16ce14f09523132ea624a7b4d1edaccc2450
Parent: 9968be55edcf6e9c56c0767aeecfaa65f8eb3785
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 25 23:30:26 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:49:16 2019 +0200
snapshot: fix checking of merged thin volume
When merging of thin snapshot is taking place, the origin target will
be of thin type.
---
lib/activate/activate.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 6f5fa1a..232d581 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -763,7 +763,8 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
with_open_count, with_read_ahead))
return_0;
- if (status->seg_status.type == SEG_STATUS_SNAPSHOT) {
+ if (status->seg_status.type == SEG_STATUS_SNAPSHOT ||
+ (lv_is_thin_volume(olv) && (status->seg_status.type == SEG_STATUS_THIN))) {
log_debug_activation("Snapshot merge is in progress, querying status of %s instead.",
display_lvname(lv));
/*
4 years, 6 months
master - snapshot: correctly check device id of merged thin
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9968be55edcf6e9c56c...
Commit: 9968be55edcf6e9c56c0767aeecfaa65f8eb3785
Parent: 6a8bd0c50979d5975b74055ca9d1535737bdaadf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 25 23:31:08 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 26 00:49:16 2019 +0200
snapshot: correctly check device id of merged thin
When checking device id of a thin device that is just being
merged - the snapshot actually could have been already finished
which means '-real' suffix for the LV is already gone and just LV
is there - so check explicitely for this condition and use
correct UUID for this case.
---
lib/activate/dev_manager.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index a2e9039..c87076c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1679,6 +1679,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)
@@ -1688,10 +1691,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)))
4 years, 6 months
master - lvmlockd: fix cachevol locking
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6a8bd0c50979d5975b7...
Commit: 6a8bd0c50979d5975b74055ca9d1535737bdaadf
Parent: 221edf40305de4cab7441d88adf6a15b73c556c3
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 24 17:09:00 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Oct 25 14:08:59 2019 -0500
lvmlockd: fix cachevol locking
When a cachevol LV is attached, have the LV keep it's lock
allocated. The lock on the cachevol won't be used while
it's attached. When the cachevol is split a new lock does
not need to be allocated. (Applies to cachevol usage by
both dm-cache and dm-writecache.)
---
lib/locking/lvmlockd.c | 8 +++++++
lib/metadata/metadata.c | 4 ++-
tools/lvconvert.c | 52 ++++++++++++++++++++++------------------------
3 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index bdd567d..f396478 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2368,6 +2368,14 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
/*
+ * A cachevol LV is one exception, where the LV keeps lock_args (so
+ * they do not need to be reallocated on split) but the lvmlockd lock
+ * is not used.
+ */
+ if (lv_is_cache_vol(lv))
+ return 1;
+
+ /*
* LV type cannot be active concurrently on multiple hosts,
* so shared mode activation is not allowed.
*/
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 45a83bd..c4f7247 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2670,7 +2670,9 @@ int vg_validate(struct volume_group *vg)
}
} else {
- if (lvl->lv->lock_args) {
+ if (lv_is_cache_vol(lvl->lv)) {
+ log_debug("lock_args will be ignored on cache vol");
+ } else if (lvl->lv->lock_args) {
log_error(INTERNAL_ERROR "LV %s/%s shouldn't have lock_args",
vg->name, lvl->lv->name);
r = 0;
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c312956..d0d277b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3475,6 +3475,18 @@ static int _cache_vol_attach(struct cmd_context *cmd,
goto_out;
/*
+ * lv/cache_lv keeps the same lockd lock it had before, the lock for
+ * lv_fast is kept but is not used while it's attached, and
+ * lv_corig has no lock. (When the cachevol is split a new lvmlockd
+ * lock does not need to be created for it again.)
+ */
+ if (vg_is_shared(vg) && lv_fast->lock_args) {
+ lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args);
+ lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name);
+ memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
+ }
+
+ /*
* The lvm tradition is to rename an LV with a special role-specific
* suffix when it becomes hidden. Here the _cvol suffix is added to
* the fast LV name. When the cache is detached, it's renamed back.
@@ -3518,18 +3530,6 @@ static int _cache_vol_attach(struct cmd_context *cmd,
}
/*
- * lv/cache_lv keeps the same lockd lock it had before, the lock for
- * lv_fast is freed, and lv_corig has no lock.
- */
-
- if (vg_is_shared(vg) && lv_fast->lock_args) {
- lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args);
- lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name);
- memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
- lv_fast->lock_args = NULL;
- }
-
- /*
* vg_write(), suspend_lv(), vg_commit(), resume_lv(),
* where the old LV is suspended and the new LV is resumed.
*/
@@ -3538,10 +3538,9 @@ static int _cache_vol_attach(struct cmd_context *cmd,
goto_out;
if (lockd_fast_name) {
- /* unlock and free lockd lock for lv_fast */
+ /* lockd unlock for lv_fast */
if (!lockd_lv_name(cmd, vg, lockd_fast_name, &lockd_fast_id, lockd_fast_args, "un", LDLV_PERSISTENT))
log_error("Failed to unlock fast LV %s/%s", vg->name, lockd_fast_name);
- lockd_free_lv(cmd, vg, lockd_fast_name, &lockd_fast_id, lockd_fast_args);
}
r = 1;
@@ -5608,6 +5607,17 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
goto_bad;
/*
+ * lv keeps the same lockd lock it had before, the lock for
+ * lv_fast is kept but is not used while it's attached, and
+ * lv_wcorig gets no lock.
+ */
+ if (vg_is_shared(vg) && lv_fast->lock_args) {
+ lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args);
+ lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name);
+ memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
+ }
+
+ /*
* TODO: use libblkid to get the sector size of lv. If it doesn't
* match the block_size we are using for the writecache, then warn that
* an existing file system on lv may become unmountable with the
@@ -5651,17 +5661,6 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
goto_bad;
/*
- * lv keeps the same lockd lock it had before, the lock for
- * lv_fast is freed, and lv_wcorig gets no lock.
- */
- if (vg_is_shared(vg) && lv_fast->lock_args) {
- lockd_fast_args = dm_pool_strdup(cmd->mem, lv_fast->lock_args);
- lockd_fast_name = dm_pool_strdup(cmd->mem, lv_fast->name);
- memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
- lv_fast->lock_args = NULL;
- }
-
- /*
* vg_write(), suspend_lv(), vg_commit(), resume_lv(),
* where the old LV is suspended and the new LV is resumed.
*/
@@ -5672,10 +5671,9 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
lockd_lv(cmd, lv, "un", 0);
if (lockd_fast_name) {
- /* unlock and free lockd lock for lv_fast */
+ /* lockd unlock for lv_fast */
if (!lockd_lv_name(cmd, vg, lockd_fast_name, &lockd_fast_id, lockd_fast_args, "un", 0))
log_error("Failed to unlock fast LV %s/%s", vg->name, lockd_fast_name);
- lockd_free_lv(cmd, vg, lockd_fast_name, &lockd_fast_id, lockd_fast_args);
}
log_print_unless_silent("Logical volume %s now has write cache.",
4 years, 6 months