Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4dfa785d14643e1…
Commit: e4dfa785d14643e1efd298af1040f461704b0a67
Parent: b08c3464898f1c1e45fcac95258a495286e4dd47
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 30 11:19:28 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 17:35:23 2013 +0200
libdm: compensate suspend counter for live table
This patch may not be fully correct. It tries to solve
the imbalanced suspend counter.
The problem starts when some LV is created and fails in resume path.
(i.e. resuming to large PV (enforced) over small loop devices)
This fails in _resume_node() after dm_task_run(). And while
existing device with empty table is left in inactive table,
further calls are reporting this device is in suspend state.
When later the lvm2 tries to rollback created device and deactivate it,
it will end with internal error, when we try to decrement
never incremented suspend counter.
As an 'easy fix' for now update suspend counter only for live nodes.
TODO: explore better fix.
---
libdm/libdm-deptree.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 2201b30..4482296 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1598,7 +1598,7 @@ static int _dm_tree_deactivate_children(struct dm_tree_node *dnode,
info.minor);
r = 0;
continue;
- } else if (info.suspended)
+ } else if (info.suspended && info.live_table)
dec_suspended();
if (child->callback &&
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59962d8d3e1c402d…
Commit: 59962d8d3e1c402da02f7bf1b09978f570fd09d5
Parent: 39705ed20123d394f1f0d122704855ec783973da
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 12:39:33 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 17:28:03 2013 +0200
snapshot: require 3 chunks for creation
There is no point in creation of 2chunks snapshot,
since the snapshot is invalidated immeditelly with the first write
as there is no free chunk for COW blocks
(2 chunks are used by the snap header and the 1st. metadata chunk).
Enhance error message about the lowest usable size.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1888c62..256adec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ For creation of snapshot require size for at least 3 chunks.
Fix lvresize --use-policies of VALID but 100% full snapshot.
Do not accept size parameters bigger then 16EiB.
Fix release of PV's fid in free_pv_fid().
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index af000af..48a1515 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -47,6 +47,8 @@ typedef enum {
#define A_CLING_BY_TAGS 0x08 /* Must match tags against existing segment */
#define A_CAN_SPLIT 0x10
+#define SNAPSHOT_MIN_CHUNKS 3 /* Minimum number of chunks in snapshot */
+
/*
* Constant parameters during a single allocation attempt.
*/
@@ -4543,8 +4545,13 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
return NULL;
}
- if (lp->snapshot && !seg_is_thin(lp) && ((uint64_t)lp->extents * vg->extent_size < 2 * lp->chunk_size)) {
- log_error("Unable to create a snapshot smaller than 2 chunks.");
+ if (lp->snapshot && !seg_is_thin(lp) &&
+ ((uint64_t)(lp->extents * vg->extent_size) < (SNAPSHOT_MIN_CHUNKS * lp->chunk_size))) {
+ log_error("Unable to create a snapshot smaller than "
+ DM_TO_STRING(SNAPSHOT_MIN_CHUNKS) " chunks (%u extents, %s).",
+ (unsigned) (((uint64_t) SNAPSHOT_MIN_CHUNKS * lp->chunk_size +
+ vg->extent_size - 1) / vg->extent_size),
+ display_size(cmd, (uint64_t) SNAPSHOT_MIN_CHUNKS * lp->chunk_size));
return NULL;
}