Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f7de58e96a2ba84…
Commit: 3f7de58e96a2ba84bf2590465ee9f5f7929cb74d
Parent: f84f12a6a3edaac5220699dd9c6937139429d852
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 24 23:41:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
man: lvextend --use-policies
Add missing man info.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 2 +-
man/lvextend.8.in | 29 ++++++++++++++++++-----------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5c97eff..27ebcec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Document lvextend --use-policies option in man.
Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index d22994e..d7300d8 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -284,7 +284,7 @@ Repair a mirror after suffering a disk failure. The mirror will be brought back
into a consistent state. By default, the original number of mirrors will be
restored if possible. Specify \fB\-y\fP on the command line to skip
the prompts. Use \fB\-f\fP if you do not want any replacement.
-Additionally, you may use \fB\-\-use-policies\fP to use the device
+Additionally, you may use \fB\-\-use\-policies\fP to use the device
replacement policy specified in \fBlvm.conf\fP(5),
viz. activation/mirror_log_fault_policy or
activation/mirror_device_fault_policy.
diff --git a/man/lvextend.8.in b/man/lvextend.8.in
index ee62a2f..c51a9dc 100644
--- a/man/lvextend.8.in
+++ b/man/lvextend.8.in
@@ -9,7 +9,7 @@ lvextend \- extend the size of a logical volume
.RI { y | n }]
.RB [ \-d | \-\-debug ]
.RB [ \-h | \-? | \-\-help ]
-.RB [ \-\-noudevsync]
+.RB [ \-f | \-\-force ]
.RB [ \-i | \-\-stripes
.I Stripes
.RB [ \-I | \-\-stripesize
@@ -19,9 +19,10 @@ lvextend \- extend the size of a logical volume
|
.BR \-L | \-\-size
.RI [ + ] LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
-.RB [ \-f | \-\-force ]
.RB [ \-n | \-\-nofsck ]
+.RB [ \-\-noudevsync]
.RB [ \-r | \-\-resizefs ]
+.RB [ \-\-use\-policies ]
.RB [ \-t | \-\-test ]
.RB [ \-v | \-\-verbose ]
.I LogicalVolumePath
@@ -37,12 +38,8 @@ volume use
.SH OPTIONS
See \fBlvm\fP(8) for common options.
.TP
-.B \-\-noudevsync
-Disable udev synchronisation. The
-process will not wait for notification from udev.
-It will continue irrespective of any possible udev processing
-in the background. You should only use this if udev is not running
-or has rules that ignore the devices LVM2 creates.
+.BR \-f ", " \-\-force
+Proceed with size extension without prompting.
.TP
.IR \fB\-l ", " \fB\-\-extents " [" + ] LogicalExtentsNumber [ % { VG | LV | PVS | FREE | ORIGIN }]
Extend or set the logical volume size in units of logical extents.
@@ -77,17 +74,26 @@ use a single value throughout.
.br
StripeSize must be 2^n (n = 2 to 9)
.TP
-.BR \-f ", " \-\-force
-Proceed with size extension without prompting.
-.TP
.BR \-n ", " \-\-nofsck
Do not perform fsck before extending filesystem when filesystem
requires it. You may need to use \fB\-\-force\fR to proceed with
this option.
.TP
+.B \-\-noudevsync
+Disable udev synchronisation. The
+process will not wait for notification from udev.
+It will continue irrespective of any possible udev processing
+in the background. You should only use this if udev is not running
+or has rules that ignore the devices LVM2 creates.
+.TP
.BR \-r ", " \-\-resizefs
Resize underlying filesystem together with the logical volume using
\fBfsadm\fR(8).
+.TP
+.B \-\-use\-policies
+Resizes the logical volume according to configured policy. See
+\fBlvm.conf\fR(5) for some details.
+
.SH Examples
Extends the size of the logical volume "vg01/lvol10" by 54MiB on physical
volume /dev/sdk3. This is only possible if /dev/sdk3 is a member of
@@ -109,6 +115,7 @@ Extends a logical volume "vg01/lvol01" by 16MiB using physical extents
.SH SEE ALSO
.BR fsadm (8),
.BR lvm (8),
+.BR lvm.conf (5),
.BR lvcreate (8),
.BR lvconvert (8),
.BR lvreduce (8),
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f84f12a6a3edaac5…
Commit: f84f12a6a3edaac5220699dd9c6937139429d852
Parent: d51b7e54044518ed8e20ce3ea617a28d2313730d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 21 10:37:52 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
snapshot: rework cluster creation and removal
Support for exclusive activation of snapshots revealed some problems.
When snapshot is created, COW LV is activated first (for clearing) and
then it's transformed into snapshot's COW LV, but it has left the lock
for such LV active in cluster and this lock could not have been removed
from dlm, unless snapshot has been removed within same dlm session.
If the user tried to remove snapshot after rebooting node, the lock was
missing, and COW LV could not have been detached.
Patch modifes the approach in this way:
Always deactivate COW LV for clustered vg after clearing (so it's
activated again via imlicit snapshot activation rule when snapshot is activated).
When snapshot is removed, activate COW LV as independend LV, so the lock
will exist for such LV, but only when the snapshot is active.
Also add test case for testing snapshot removal after cluster reboot.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 24 ++++++++++++++----------
lib/metadata/snapshot_manip.c | 37 ++++++++++++++++++++++++++++---------
test/shell/clvmd-restart.sh | 12 +++++++++++-
4 files changed, 54 insertions(+), 20 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ceaed00..5c97eff 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
Fix assignment order for vg fid for lvm1 and pool format.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 7580464..42e0fab 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4393,7 +4393,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
struct logical_volume *lv, *org = NULL;
struct logical_volume *pool_lv;
struct lv_list *lvl;
- int origin_active = 0;
const char *thin_name = NULL;
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
@@ -4480,9 +4479,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
/* Must zero cow */
status |= LVM_WRITE;
- if (lp->voriginsize)
- origin_active = 1;
- else {
+ if (!lp->voriginsize) {
if (!(org = find_lv(vg, lp->origin))) {
log_error("Couldn't find origin volume '%s'.",
@@ -4526,8 +4523,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
}
- if ((origin_active = lv_is_active(org)) &&
- vg_is_clustered(vg) &&
+ if (vg_is_clustered(vg) && lv_is_active(org) &&
!lv_is_active_exclusive_locally(org)) {
log_error("%s must be active exclusively to"
" create snapshot", org->name);
@@ -4821,8 +4817,14 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
if (!(lp->permission & LVM_WRITE))
lv->status &= ~LVM_WRITE;
- /* COW area must be deactivated if origin is not active */
- if (!origin_active && !deactivate_lv(cmd, lv)) {
+ /*
+ * For clustered VG deactivate zeroed COW to not keep
+ * the LV lock. For non-clustered VG, deactivate
+ * if origin is real (not virtual) inactive device.
+ */
+ if ((vg_is_clustered(vg) ||
+ (!lp->voriginsize && !lv_is_active(org))) &&
+ !deactivate_lv(cmd, lv)) {
log_error("Aborting. Couldn't deactivate snapshot "
"COW area. Manual intervention required.");
return NULL;
@@ -4841,8 +4843,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
goto deactivate_and_revert_new_lv;
}
- /* cow LV remains active and becomes snapshot LV */
-
+ /*
+ * COW LV is activated via implicit activation of origin LV
+ * Only the snapshot origin holds the LV lock in cluster
+ */
if (!vg_add_snapshot(org, lv, NULL,
org->le_count, lp->chunk_size)) {
log_error("Couldn't create snapshot.");
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 5766d0b..0c10104 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -176,6 +176,7 @@ 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);
dm_list_del(&cow->snapshot->origin_list);
origin->origin_count--;
@@ -209,25 +210,43 @@ int vg_remove_snapshot(struct logical_volume *cow)
lv_set_visible(cow);
/* format1 must do the change in one step, with the commit last. */
- if (!(origin->vg->fid->fmt->features & FMT_MDAS))
+ if (!(origin->vg->fid->fmt->features & FMT_MDAS)) {
+ /* Get the lock for COW volume */
+ if (is_origin_active && !activate_lv(cow->vg->cmd, cow)) {
+ log_error("Unable to activate logical volume \"%s\"",
+ cow->name);
+ return 0;
+ }
return 1;
+ }
if (!vg_write(origin->vg))
return_0;
- if (!suspend_lv(origin->vg->cmd, origin)) {
+
+ /* Skip call suspend, if device is not active */
+ if (is_origin_active && !suspend_lv(origin->vg->cmd, origin)) {
log_error("Failed to refresh %s without snapshot.",
origin->name);
return 0;
}
if (!vg_commit(origin->vg))
return_0;
- if (!merging_snapshot && !resume_lv(origin->vg->cmd, cow)) {
- log_error("Failed to resume %s.", cow->name);
- return 0;
- }
- if (!resume_lv(origin->vg->cmd, origin)) {
- log_error("Failed to resume %s.", origin->name);
- return 0;
+
+ if (is_origin_active) {
+ /*
+ * If the snapshot was active and the COW LV is taken away
+ * 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)) {
+ log_error("Failed to activate %s.", cow->name);
+ return 0;
+ }
+
+ if (!resume_lv(origin->vg->cmd, origin)) {
+ log_error("Failed to resume %s.", origin->name);
+ return 0;
+ }
}
return 1;
diff --git a/test/shell/clvmd-restart.sh b/test/shell/clvmd-restart.sh
index 2b341e5..e88e187 100644
--- a/test/shell/clvmd-restart.sh
+++ b/test/shell/clvmd-restart.sh
@@ -46,8 +46,18 @@ test "$LOCAL_CLVMD" -eq "$NEW_LOCAL_CLVMD"
# FIXME: Hmm - how could we test exclusivity is preserved in singlenode ?
lvchange -an $vg/$lv1
-lvchange -ay $vg/$lv1
+lvchange -aey $vg/$lv1
+lvcreate -s -l3 -n snap $vg/$lv1
"$LVM_CLVMD_BINARY" -R
+vgchange -an $vg
+
+# Test what happens after 'reboot'
+kill "$LOCAL_CLVMD"
+aux prepare_clvmd
+
+vgchange -ay $vg
+lvremove -f $vg/snap
+
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d51b7e54044518ed…
Commit: d51b7e54044518ed8e20ce3ea617a28d2313730d
Parent: 320d7f3596f78972d5fa843b9d56510ff299a958
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 21 10:11:29 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:22 2013 +0200
clvmd: avoid pretesting of dev availability
Patch fixes hidden problem with lvm metadata caching.
When the pretest was made, only the commited data have been cached back
since the call lv_info_by_lvid() triggers mda read operation.
However call of lv_suspend_if_active() also reads precommited metadata.
The problem is visible in this sequence of calls:
vg_write(), suspend_lv(), vg_commit(), resume_lv()
which may end with leaving outdated mda in lvm cache, since vg_write()
drops cached metadata and vg_commit() only transforms precommited
to commited metadata, but in the case of pretesting we have
no precommited mda available so the cache will continue to use
old metadata. This happens, when suspend LV is inactive.
---
WHATS_NEW | 1 +
daemons/clvmd/lvm-functions.c | 9 ++-------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4139557..ceaed00 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
Fix assignment order for vg fid for lvm1 and pool format.
Fix memleak in dmeventd thin plugin in device list obtaining err path.
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 6d78090..5e83454 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -437,7 +437,6 @@ static int do_resume_lv(char *resource, unsigned char command, unsigned char loc
static int do_suspend_lv(char *resource, unsigned char command, unsigned char lock_flags)
{
int oldmode;
- struct lvinfo lvi;
unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
unsigned exclusive;
@@ -450,12 +449,8 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo
exclusive = (oldmode == LCK_EXCL) ? 1 : 0;
- /* Only suspend it if it exists */
- if (!lv_info_by_lvid(cmd, resource, origin_only, &lvi, 0, 0))
- return EIO;
-
- if (lvi.exists &&
- !lv_suspend_if_active(cmd, resource, origin_only, exclusive))
+ /* Always call lv_suspend to read commited and precommited data */
+ if (!lv_suspend_if_active(cmd, resource, origin_only, exclusive))
return EIO;
return 0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=23775c8fe8cdd82d…
Commit: 23775c8fe8cdd82dee33cd397eeab5a84181380b
Parent: 67fc56f5ca1e05f78cedc5f729745e176447c6b2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 23 14:36:27 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 23 14:36:27 2013 +0200
test: do not break test if there is no .cache
When running test on read /dev, we obtain devices from udev,
and there is no .cache file, so do not stop test if the file
is missing.
---
test/shell/vgimportclone.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index 0a476ec..60c833a 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -31,7 +31,7 @@ vgimportclone --basevgname $vg2 "$dev2"
# concerned, can only live on a single device. With the last pvscan, we told it
# that PV from $dev1 now lives on $dev2, but in fact this is not true anymore,
# since we wrote a different PV over $dev2.
-rm $TESTDIR/etc/.cache
+rm -f $TESTDIR/etc/.cache
aux notify_lvmetad "$dev2"
aux notify_lvmetad "$dev1"