master - activation: don't miss the log on empty {auto_activation|read_only|}_volume_list
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=35a4d70aad02f2...
Commit: 35a4d70aad02f297d81909ff7c65a032c5e0dbf2
Parent: e2be2652ad147f07f326da0744b32f5160d68340
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Dec 4 14:10:03 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Dec 4 14:12:36 2012 +0100
activation: don't miss the log on empty {auto_activation|read_only|}_volume_list
Addendum to previous commit...
---
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 ee552b4..899f409 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -341,7 +341,7 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_vol
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type == DM_CFG_EMPTY_ARRAY)
- return 0;
+ goto out;
if (cv->type != DM_CFG_STRING) {
log_error("Ignoring invalid string in config file %s",
config_path);
@@ -397,6 +397,7 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_vol
return 1;
}
+out:
log_verbose("No item supplied in %s configuration setting "
"matches %s/%s", config_path, lv->vg->name, lv->name);
11 years, 4 months
master - Allow empty activation/{auto_activation|read_only|}_volume_list config option.
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2be2652ad147f...
Commit: e2be2652ad147f07f326da0744b32f5160d68340
Parent: a530c70b21e2ba93589e862b979aa3cb068d579a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Dec 4 10:33:54 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Dec 4 10:33:54 2012 +0100
Allow empty activation/{auto_activation|read_only|}_volume_list config option.
In case we don't want to activate, autoactivate or have the
VG/LV read-only. Primarily targeted for the auto_activation_volume_list,
but it makes no harm for other settings (the part of the code
that reads these three settings is shared, but there's no
reason to separate it only for this change).
---
WHATS_NEW | 1 +
lib/activate/activate.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index cff005d..519d4dd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Allow empty activation/{auto_activation|read_only|}_volume_list config option.
Add lvm.conf option global/thin_disabled_features.
Add lvconvert support to swap thin pool metadata volume.
Implement internal function detach_pool_metadata_lv().
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 185ba5f..ee552b4 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -340,6 +340,8 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_vol
config_path, lv->vg->name, lv->name);
for (cv = cn->v; cv; cv = cv->next) {
+ if (cv->type == DM_CFG_EMPTY_ARRAY)
+ return 0;
if (cv->type != DM_CFG_STRING) {
log_error("Ignoring invalid string in config file %s",
config_path);
11 years, 4 months
master - thin: update thin feature detection
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a530c70b21e2ba...
Commit: a530c70b21e2ba93589e862b979aa3cb068d579a
Parent: 5ec20e267fdc627e3bf50679b748c937fe3d79fb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Dec 3 13:03:41 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Dec 3 13:03:41 2012 +0100
thin: update thin feature detection
Safe 1 static var and keep whole detection within one function.
---
lib/thin/thin.c | 85 ++++++++++++++++++++++++++----------------------------
1 files changed, 41 insertions(+), 44 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 18b819b..d7c45ca 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -37,23 +37,8 @@
log_error(t " segment %s of logical volume %s.", ## p, \
dm_config_parent_name(sn), seg->lv->name), 0;
-/* List of features with their kernel target version */
-static const struct feature {
- uint32_t maj;
- uint32_t min;
- unsigned thin_feature;
- const char *feature;
-} _features[] = {
- { 1, 1, THIN_FEATURE_DISCARDS, "discards" },
- { 1, 1, THIN_FEATURE_EXTERNAL_ORIGIN, "external_origin" },
- { 1, 4, THIN_FEATURE_BLOCK_SIZE, "block_size" },
- { 1, 5, THIN_FEATURE_DISCARDS_NON_POWER_2, "discards_non_power_2" },
-};
-
-static const char _lvmconf[] = "global/thin_disabled_features";
-/* TODO: using static field heer, maybe should be part of segment_type */
+/* TODO: using static field here, maybe should be a part of segment_type */
static unsigned _feature_mask;
-static int _log_feature_mask;
static int _thin_target_present(struct cmd_context *cmd,
const struct lv_segment *seg,
@@ -557,11 +542,28 @@ static int _thin_target_present(struct cmd_context *cmd,
const struct lv_segment *seg,
unsigned *attributes)
{
+ /* List of features with their kernel target version */
+ static const struct feature {
+ uint32_t maj;
+ uint32_t min;
+ unsigned thin_feature;
+ const char *feature;
+ } const _features[] = {
+ { 1, 1, THIN_FEATURE_DISCARDS, "discards" },
+ { 1, 1, THIN_FEATURE_EXTERNAL_ORIGIN, "external_origin" },
+ { 1, 4, THIN_FEATURE_BLOCK_SIZE, "block_size" },
+ { 1, 5, THIN_FEATURE_DISCARDS_NON_POWER_2, "discards_non_power_2" },
+ };
+
+ static const char _lvmconf[] = "global/thin_disabled_features";
static int _checked = 0;
static int _present = 0;
static unsigned _attrs = 0;
uint32_t maj, min, patchlevel;
unsigned i;
+ const struct dm_config_node *cn;
+ const struct dm_config_value *cv;
+ const char *str;
if (!_checked) {
_present = target_present(cmd, THIN_MODULE, 1);
@@ -582,13 +584,32 @@ static int _thin_target_present(struct cmd_context *cmd,
}
if (attributes) {
- if (_log_feature_mask) {
+ if (!_feature_mask) {
+ /* Support runtime lvm.conf changes, N.B. avoid 32 feature */
+ if ((cn = find_config_tree_node(cmd, _lvmconf))) {
+ for (cv = cn->v; cv; cv = cv->next) {
+ if (cv->type != DM_CFG_STRING) {
+ log_error("Ignoring invalid string in config file %s.",
+ _lvmconf);
+ continue;
+ }
+ str = cv->v.str;
+ if (!*str) {
+ log_error("Ignoring empty string in config file %s.",
+ _lvmconf);
+ continue;
+ }
+ for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
+ if (strcasecmp(str, _features[i].feature) == 0)
+ _feature_mask |= _features[i].thin_feature;
+ }
+ }
+ _feature_mask = ~_feature_mask;
for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
if ((_attrs & _features[i].thin_feature) &&
!(_feature_mask & _features[i].thin_feature))
log_very_verbose("Target "THIN_MODULE " %s support disabled by %s",
_features[i].feature, _lvmconf);
- _log_feature_mask = 0; /* log just once */
}
*attributes = _attrs & _feature_mask;
}
@@ -664,11 +685,7 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
};
struct segment_type *segtype;
- const struct dm_config_node *cn;
- const struct dm_config_value *cv;
- const char *str;
unsigned i;
- unsigned mask = 0;
for (i = 0; i < sizeof(reg_segtypes)/sizeof(reg_segtypes[0]); ++i) {
segtype = dm_zalloc(sizeof(*segtype));
@@ -697,29 +714,9 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
log_very_verbose("Initialised segtype: %s", segtype->name);
}
- /* Support runtime lvm.conf changes */
- if ((cn = find_config_tree_node(cmd, _lvmconf))) {
- for (cv = cn->v; cv; cv = cv->next) {
- if (cv->type != DM_CFG_STRING) {
- log_error("Ignoring invalid string in config file %s.",
- _lvmconf);
- continue;
- }
- str = cv->v.str;
- if (!*str) {
- log_error("Ignoring empty string in config file %s.",
- _lvmconf);
- continue;
- }
- for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
- if (strcasecmp(str, _features[i].feature) == 0)
- mask |= _features[i].thin_feature;
- }
- _log_feature_mask = (mask != 0);
- }
- /* Store as 'and' mask in static field */
- _feature_mask = ~mask;
+ /* Reset mask for recalc */
+ _feature_mask = 0;
return 1;
}
11 years, 4 months
master - thin: reworked thin feature detection
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5ec20e267fdc62...
Commit: 5ec20e267fdc627e3bf50679b748c937fe3d79fb
Parent: 99018b37ee9e916662ebd482ac8fe0f36bbd7ac8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Dec 3 11:52:04 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Dec 3 11:57:40 2012 +0100
thin: reworked thin feature detection
Rework thin feature detection to support runtime
section to allow to disable them selectively.
New lvm.conf option is born: global/thin_disabled_features
---
WHATS_NEW | 1 +
doc/example.conf.in | 10 ++++++
lib/thin/thin.c | 91 ++++++++++++++++++++++++++++++++++++--------------
3 files changed, 76 insertions(+), 26 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ceb2295..cff005d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add lvm.conf option global/thin_disabled_features.
Add lvconvert support to swap thin pool metadata volume.
Implement internal function detach_pool_metadata_lv().
Fix lvm2app to return all property sizes in bytes.
diff --git a/doc/example.conf.in b/doc/example.conf.in
index 1a3ee1b..872d6ef 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -524,6 +524,16 @@ global {
# String with options passed with thin_check command. By default,
# option '-q' is for quiet output.
thin_check_options = [ "-q" ]
+
+ # If set, given features are not used by thin driver.
+ # This can be helpful not just for testing, but i.e. allows to avoid
+ # using problematic implementation of some thin feature.
+ # Features:
+ # block_size
+ # discards
+ # discards_non_power_2
+ #
+ # thin_disabled_features = [ "discards", "block_size" ]
}
activation {
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index f6ac437..18b819b 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -37,6 +37,24 @@
log_error(t " segment %s of logical volume %s.", ## p, \
dm_config_parent_name(sn), seg->lv->name), 0;
+/* List of features with their kernel target version */
+static const struct feature {
+ uint32_t maj;
+ uint32_t min;
+ unsigned thin_feature;
+ const char *feature;
+} _features[] = {
+ { 1, 1, THIN_FEATURE_DISCARDS, "discards" },
+ { 1, 1, THIN_FEATURE_EXTERNAL_ORIGIN, "external_origin" },
+ { 1, 4, THIN_FEATURE_BLOCK_SIZE, "block_size" },
+ { 1, 5, THIN_FEATURE_DISCARDS_NON_POWER_2, "discards_non_power_2" },
+};
+
+static const char _lvmconf[] = "global/thin_disabled_features";
+/* TODO: using static field heer, maybe should be part of segment_type */
+static unsigned _feature_mask;
+static int _log_feature_mask;
+
static int _thin_target_present(struct cmd_context *cmd,
const struct lv_segment *seg,
unsigned *attributes);
@@ -541,8 +559,9 @@ static int _thin_target_present(struct cmd_context *cmd,
{
static int _checked = 0;
static int _present = 0;
- static int _attrs = 0;
+ static unsigned _attrs = 0;
uint32_t maj, min, patchlevel;
+ unsigned i;
if (!_checked) {
_present = target_present(cmd, THIN_MODULE, 1);
@@ -552,35 +571,27 @@ static int _thin_target_present(struct cmd_context *cmd,
return 0;
}
- if (maj >=1 && min >= 1)
- _attrs |= THIN_FEATURE_DISCARDS;
- else
- /* FIXME Log this as WARNING later only if the user asked for the feature to be used but it's not present */
- log_debug("Target " THIN_MODULE " does not support discards.");
-
- if (maj >=1 && min >= 1)
- _attrs |= THIN_FEATURE_EXTERNAL_ORIGIN;
- else
- /* FIXME Log this as WARNING later only if the user asked for the feature to be used but it's not present */
- log_debug("Target " THIN_MODULE " does not support external origins.");
-
- if (maj >=1 && min >= 4)
- _attrs |= THIN_FEATURE_BLOCK_SIZE;
- else
- /* FIXME Log this as WARNING later only if the user asked for the feature to be used but it's not present */
- log_debug("Target " THIN_MODULE " does not support non power of 2 block sizes.");
-
- if (maj >=1 && min >= 5)
- _attrs |= THIN_FEATURE_DISCARDS_NON_POWER_2;
- else
- /* FIXME Log this as WARNING later only if the user asked for the feature to be used but it's not present */
- log_debug("Target " THIN_MODULE " does not support discards for non power of 2 block sizes.");
+ for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
+ if (maj >= _features[i].maj && min >= _features[i].min)
+ _attrs |= _features[i].thin_feature;
+ else
+ log_very_verbose("Target " THIN_MODULE " does not support %s.",
+ _features[i].feature);
_checked = 1;
}
- if (attributes)
- *attributes = _attrs;
+ if (attributes) {
+ if (_log_feature_mask) {
+ for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
+ if ((_attrs & _features[i].thin_feature) &&
+ !(_feature_mask & _features[i].thin_feature))
+ log_very_verbose("Target "THIN_MODULE " %s support disabled by %s",
+ _features[i].feature, _lvmconf);
+ _log_feature_mask = 0; /* log just once */
+ }
+ *attributes = _attrs & _feature_mask;
+ }
return _present;
}
@@ -653,7 +664,11 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
};
struct segment_type *segtype;
+ const struct dm_config_node *cn;
+ const struct dm_config_value *cv;
+ const char *str;
unsigned i;
+ unsigned mask = 0;
for (i = 0; i < sizeof(reg_segtypes)/sizeof(reg_segtypes[0]); ++i) {
segtype = dm_zalloc(sizeof(*segtype));
@@ -682,5 +697,29 @@ int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *segl
log_very_verbose("Initialised segtype: %s", segtype->name);
}
+ /* Support runtime lvm.conf changes */
+ if ((cn = find_config_tree_node(cmd, _lvmconf))) {
+ for (cv = cn->v; cv; cv = cv->next) {
+ if (cv->type != DM_CFG_STRING) {
+ log_error("Ignoring invalid string in config file %s.",
+ _lvmconf);
+ continue;
+ }
+ str = cv->v.str;
+ if (!*str) {
+ log_error("Ignoring empty string in config file %s.",
+ _lvmconf);
+ continue;
+ }
+ for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
+ if (strcasecmp(str, _features[i].feature) == 0)
+ mask |= _features[i].thin_feature;
+ }
+ _log_feature_mask = (mask != 0);
+ }
+
+ /* Store as 'and' mask in static field */
+ _feature_mask = ~mask;
+
return 1;
}
11 years, 4 months
master - thin: lvconvert supports swapping metadata device
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=99018b37ee9e91...
Commit: 99018b37ee9e916662ebd482ac8fe0f36bbd7ac8
Parent: 97f8454eccefe29464336ba1823448f4d1fa009b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:40:07 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 18:01:27 2012 +0100
thin: lvconvert supports swapping metadata device
Support swapping of metadata device if the thin pool already
exists. This way it's easy to i.e. resize metadata or their
repair operation.
User may create some empty LV, replace existing metadata
or dump and restore them into bigger LV.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 11 ++++++++++-
tools/lvconvert.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index be2ebea..ceb2295 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add lvconvert support to swap thin pool metadata volume.
Implement internal function detach_pool_metadata_lv().
Fix lvm2app to return all property sizes in bytes.
Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index 48345a9..4fe9bdd 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -231,6 +231,13 @@ Specifies thin pool metadata logical volume.
The size should be in between 2MiB and 16GiB.
Thin pool is specified with the option
\fB\-\-thinpool\fP.
+When the specified thin pool already exists,
+the thin pool's metadata volume will be swapped with the given LV.
+Properties of the thin pool like chunk size, discards or zero
+are preserved by default in this case.
+It can be useful for thin pool metadata repair or its offline resize,
+since the content of metadata becomes accessible for
+thin provisioning tools \fBthin_dump\fP(8) and \fBthin_restore\fP(8).
.TP
.BR \-\-poolmetadatasize " " \fIThinPoolMetadataSize [ \fIbBsSkKmMgG ]
Sets the size of thin pool's metadata logical volume,
@@ -375,4 +382,6 @@ available in the volume group.
.BR lvextend (8),
.BR lvreduce (8),
.BR lvdisplay (8),
-.BR lvscan (8)
+.BR lvscan (8),
+.BR thin_dump(8),
+.BR thin_restore(8)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2ef8d86..d0429d8 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1794,10 +1794,12 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
{
int r = 0;
char *name;
+ const char *old_name;
int len;
struct lv_segment *seg;
struct logical_volume *data_lv;
struct logical_volume *metadata_lv;
+ struct logical_volume *pool_metadata_lv;
if (!lv_is_visible(pool_lv)) {
log_error("Can't convert internal LV %s/%s.",
@@ -1805,7 +1807,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
return 0;
}
- if (lv_is_thin_type(pool_lv)) {
+ if (lv_is_thin_type(pool_lv) && !lp->pool_metadata_lv_name) {
log_error("Can't use thin logical volume %s/%s for thin pool data.",
pool_lv->vg->name, pool_lv->name);
return 0;
@@ -1864,6 +1866,50 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
metadata_lv->vg->name, metadata_lv->name);
return 0;
}
+
+ /* Swap normal LV with pool's metadata LV ? */
+ if (lv_is_thin_pool(pool_lv)) {
+ if (!deactivate_lv(cmd, metadata_lv)) {
+ log_error("Aborting. Failed to deactivate thin metadata lv.");
+ return 0;
+ }
+ if (!arg_count(cmd, yes_ARG) &&
+ yes_no_prompt("Do you want to swap metadata of %s/%s pool with "
+ "volume %s/%s? [y/n]: ",
+ pool_lv->vg->name, pool_lv->name,
+ pool_lv->vg->name, metadata_lv->name) == 'n') {
+ log_error("Conversion aborted.");
+ return 0;
+ }
+ seg = first_seg(pool_lv);
+ /* Swap names between old and new metadata LV */
+ if (!detach_pool_metadata_lv(seg, &pool_metadata_lv))
+ return_0;
+ old_name = metadata_lv->name;
+ if (!lv_rename_update(cmd, metadata_lv, "pvmove_tmeta", 0))
+ return_0;
+ if (!lv_rename_update(cmd, pool_metadata_lv, old_name, 0))
+ return_0;
+
+ if (!arg_count(cmd, chunksize_ARG))
+ lp->chunk_size = seg->chunk_size;
+ else if ((lp->chunk_size != seg->chunk_size) &&
+ !arg_count(cmd, force_ARG) &&
+ yes_no_prompt("Do you really want to change chunk size %s to %s for %s/%s "
+ "pool volume? [y/n]: ", display_size(cmd, seg->chunk_size),
+ display_size(cmd, lp->chunk_size),
+ pool_lv->vg->name, pool_lv->name) == 'n') {
+ log_error("Conversion aborted.");
+ return 0;
+ }
+ if (!arg_count(cmd, discards_ARG))
+ lp->discards = seg->discards;
+ if (!arg_count(cmd, zero_ARG))
+ lp->zero = seg->zero_new_blocks;
+
+ goto mda_write;
+ }
+
if (!lv_is_active(metadata_lv) &&
!activate_lv_local(cmd, metadata_lv)) {
log_error("Aborting. Failed to activate thin metadata lv.");
@@ -1941,6 +1987,8 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
seg->low_water_mark = 0;
seg->transaction_id = 0;
+
+mda_write:
seg->chunk_size = lp->chunk_size;
seg->discards = lp->discards;
seg->zero_new_blocks = lp->zero ? 1 : 0;
11 years, 4 months
master - libdm: deactivate failed node in preload
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97f8454eccefe2...
Commit: 97f8454eccefe29464336ba1823448f4d1fa009b
Parent: ade2f47829f66d061d69844b9911e266751435b7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:32:42 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 17:59:40 2012 +0100
libdm: deactivate failed node in preload
If the resume of preloaded node fails, do not leave such
node in the table - since it may not be easy to detach such
node later when the node is i.e. internal.
i.e. failing activation of the thin pool with mismatching
chunk size may leave -tpool device in the table, which
could have been then removed only by dmsetup command.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3ea0502..75bd1b3 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Automatically deactivate failed preloaded dm tree node.
Add DM_DISABLE_UDEV environment variable to manage dev nodes by libdm only.
Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 096eba2..e4a574d 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2496,6 +2496,11 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
log_error("Unable to resume %s (%" PRIu32
":%" PRIu32 ")", child->name, child->info.major,
child->info.minor);
+ if (!_deactivate_node(child->name, child->info.major, child->info.minor,
+ &child->dtree->cookie, child->udev_flags, 0))
+ log_error("Unable to deactivate %s (%" PRIu32
+ ":%" PRIu32 ")", child->name, child->info.major,
+ child->info.minor);
r = 0;
continue;
}
11 years, 4 months
master - thin: deactivate subvolumes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ade2f47829f66d...
Commit: ade2f47829f66d061d69844b9911e266751435b7
Parent: dde5a6c52b315d7b8e2dd6b91e17eb3955534682
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:31:27 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 17:56:44 2012 +0100
thin: deactivate subvolumes
Do not leave active thin data and metadata volumes
if activation of thin pool fails.
---
tools/lvconvert.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a75a7fc..2ef8d86 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1960,6 +1960,11 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
if (!activate_lv_excl(cmd, pool_lv)) {
log_error("Failed to activate pool logical volume %s/%s.",
pool_lv->vg->name, pool_lv->name);
+ /* Deactivate subvolumes */
+ if (!deactivate_lv(cmd, seg_lv(seg, 0)))
+ log_error("Failed to deactivate pool data logical volume.");
+ if (!deactivate_lv(cmd, seg->metadata_lv))
+ log_error("Failed to deactivate pool metadata logical volume.");
goto out;
}
11 years, 4 months
master - thin: lvchange may change discards freely
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dde5a6c52b315d...
Commit: dde5a6c52b315d7b8e2dd6b91e17eb3955534682
Parent: f0da2842cfec05753154e5516f01e0dfd7331640
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:30:45 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 17:56:44 2012 +0100
thin: lvchange may change discards freely
---
tools/lvchange.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 8eabbbb..c3c993a 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -111,13 +111,7 @@ static int lvchange_pool_update(struct cmd_context *cmd,
if (arg_count(cmd, discards_ARG)) {
discards = (thin_discards_t) arg_uint_value(cmd, discards_ARG, THIN_DISCARDS_IGNORE);
if (discards != first_seg(lv)->discards) {
- if ((discards != THIN_DISCARDS_IGNORE) &&
- (first_seg(lv)->chunk_size &
- (first_seg(lv)->chunk_size - 1)))
- log_error("Cannot change discards state for "
- "logical volume \"%s\" "
- "with non power of 2 chunk size.", lv->name);
- else if (((discards == THIN_DISCARDS_IGNORE) ||
+ if (((discards == THIN_DISCARDS_IGNORE) ||
(first_seg(lv)->discards == THIN_DISCARDS_IGNORE)) &&
lv_is_active(lv))
log_error("Cannot change discards state for active "
11 years, 4 months
master - thin: shuffle code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f0da2842cfec05...
Commit: f0da2842cfec05753154e5516f01e0dfd7331640
Parent: 0be8a9126f9e6e66bce186192fedbb5d841007f2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:27:39 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 17:56:44 2012 +0100
thin: shuffle code
Reorder code lines for next patch.
---
tools/lvconvert.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 76588d2..a75a7fc 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1917,12 +1917,6 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
return 0;
}
- /* Rename deactivated metadata LV to have _tmeta suffix */
- /* Implicit checks if metadata_lv is visible */
- if (strcmp(metadata_lv->name, name) &&
- !lv_rename_update(cmd, metadata_lv, name, 0))
- return_0;
-
/*
* Since we wish to have underlaying dev, to match _tdata
* rename data LV first, also checks for visible LV
@@ -1940,18 +1934,24 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
seg->segtype = lp->segtype;
seg->lv->status |= THIN_POOL;
- seg->chunk_size = lp->chunk_size;
- seg->zero_new_blocks = lp->zero ? 1 : 0;
- seg->discards = lp->discards;
+ /* Drop reference as attach_pool_data_lv() takes it again */
+ remove_seg_from_segs_using_this_lv(data_lv, seg);
+ if (!attach_pool_data_lv(seg, data_lv))
+ return_0;
+
seg->low_water_mark = 0;
seg->transaction_id = 0;
+ seg->chunk_size = lp->chunk_size;
+ seg->discards = lp->discards;
+ seg->zero_new_blocks = lp->zero ? 1 : 0;
- if (!attach_pool_metadata_lv(seg, metadata_lv))
+ /* Rename deactivated metadata LV to have _tmeta suffix */
+ /* Implicit checks if metadata_lv is visible */
+ if (strcmp(metadata_lv->name, name) &&
+ !lv_rename_update(cmd, metadata_lv, name, 0))
return_0;
- /* Drop reference as attach_pool_data_lv() takes it again */
- remove_seg_from_segs_using_this_lv(data_lv, seg);
- if (!attach_pool_data_lv(seg, data_lv))
+ if (!attach_pool_metadata_lv(seg, metadata_lv))
return_0;
if (!vg_write(pool_lv->vg) || !vg_commit(pool_lv->vg))
11 years, 4 months
master - thin: lvconvert update messages
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0be8a9126f9e6e...
Commit: 0be8a9126f9e6e66bce186192fedbb5d841007f2
Parent: 6987a353de9476c57831fdcf9cccb5d80e4f505b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Dec 2 16:23:44 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 2 17:56:44 2012 +0100
thin: lvconvert update messages
---
tools/lvconvert.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e428ce0..76588d2 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1813,7 +1813,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
/* We are changing target type, so deactivate first */
if (!deactivate_lv(cmd, pool_lv)) {
- log_error("Can't deactivate logical volume %s/%s.",
+ log_error("Aborting. Failed to deactivate logical volume %s/%s.",
pool_lv->vg->name, pool_lv->name);
return 0;
}
@@ -1824,8 +1824,10 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
return 0;
}
- if (dm_snprintf(name, len, "%s_tmeta", pool_lv->name) < 0)
- return_0;
+ if (dm_snprintf(name, len, "%s_tmeta", pool_lv->name) < 0) {
+ log_error("Failed to create layer name.");
+ return 0;
+ }
if (lp->pool_metadata_lv_name) {
if (arg_count(cmd, stripesize_ARG) || arg_count(cmd, stripes_long_ARG)) {
@@ -1864,8 +1866,8 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
}
if (!lv_is_active(metadata_lv) &&
!activate_lv_local(cmd, metadata_lv)) {
- log_error("Aborting. Failed to activate thin metadata lv.");
- return 0;
+ log_error("Aborting. Failed to activate thin metadata lv.");
+ return 0;
}
if (!set_lv(cmd, metadata_lv, UINT64_C(0), 0)) {
log_error("Aborting. Failed to wipe thin metadata lv.");
11 years, 4 months