master - lv_rename: actual fix for snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a86d9a3b305be4...
Commit: a86d9a3b305be466d221f2a5e210bc1cad8fe842
Parent: c710f02e0181cc2db5455f0c98033247a70ecc30
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 9 20:15:51 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 20:15:51 2014 +0200
lv_rename: actual fix for snapshot
By my rebasing mistake it's been eliminated from previous patch set.
---
lib/metadata/lv_manip.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index cc7b6da..8c1bd83 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3966,6 +3966,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
log_error("Failed to allocate space for new name.");
return 0;
}
+
/* rename sub LVs */
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
return_0;
@@ -3973,6 +3974,9 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
/* rename main LV */
lv->name = lv_names.new;
+ if (lv_is_cow(lv))
+ lv = origin_from_cow(lv);
+
if (update_mda && !lv_update_and_reload(lv))
return_0;
9 years, 7 months
master - lv_update_and_reload: replace code sequence
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c710f02e0181cc...
Commit: c710f02e0181cc2db5455f0c98033247a70ecc30
Parent: e4e50863a22d4decd1b4c3a89e94b94173d2a704
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 9 14:40:32 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 19:20:09 2014 +0200
lv_update_and_reload: replace code sequence
Use lv_update_and_reload() and lv_update_and_reload_origin()
to handle write/suspend/commit/resume sequence.
In few places this properly handle vg_revert() after suspend failure,
and also ensures there is metadata backup after successful vg_commit().
---
lib/metadata/cache_manip.c | 27 ++------
lib/metadata/lv_manip.c | 35 ++-------
lib/metadata/raid_manip.c | 173 ++++----------------------------------------
tools/lvchange.c | 120 ++----------------------------
4 files changed, 34 insertions(+), 321 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 04e165f..73df448 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -175,7 +175,6 @@ static int _cleanup_orphan_lv(struct logical_volume *lv)
*/
int lv_cache_remove(struct logical_volume *cache_lv)
{
- struct cmd_context *cmd = cache_lv->vg->cmd;
const char *policy_name;
uint64_t dirty_blocks;
struct lv_segment *cache_seg = first_seg(cache_lv);
@@ -225,14 +224,8 @@ int lv_cache_remove(struct logical_volume *cache_lv)
cache_seg->policy_argv = NULL;
/* update the kernel to put the cleaner policy in place */
- if (!vg_write(cache_lv->vg))
- return_0;
- if (!suspend_lv(cmd, cache_lv))
- return_0;
- if (!vg_commit(cache_lv->vg))
- return_0;
- if (!resume_lv(cmd, cache_lv))
- return_0;
+ if (lv_update_and_reload(cache_lv))
+ return_0;
}
//FIXME: use polling to do this...
@@ -256,7 +249,7 @@ int lv_cache_remove(struct logical_volume *cache_lv)
if (!remove_layer_from_lv(cache_lv, corigin_lv))
return_0;
- if (!vg_write(cache_lv->vg))
+ if (!lv_update_and_reload(cache_lv))
return_0;
/*
@@ -264,20 +257,12 @@ int lv_cache_remove(struct logical_volume *cache_lv)
* - the top-level cache LV
* - the origin
* - the cache_pool _cdata and _cmeta
- */
- if (!suspend_lv(cmd, cache_lv))
- return_0;
-
- if (!vg_commit(cache_lv->vg))
- return_0;
-
- /* resume_lv on this (former) cache LV will resume all */
- /*
+ *
+ * resume_lv on this (former) cache LV will resume all
+ *
* FIXME: currently we can't easily avoid execution of
* blkid on resumed error device
*/
- if (!resume_lv(cmd, cache_lv))
- return_0;
/*
* cleanup orphan devices
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index cec9f84..cc7b6da 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5039,26 +5039,8 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
}
/* store vg on disk(s) */
- if (!vg_write(vg))
- goto_out;
-
- if (!suspend_lv(cmd, lock_lv)) {
- log_error("Failed to suspend %s", lock_lv->name);
- vg_revert(vg);
- goto bad;
- }
-
- if (!vg_commit(vg)) {
- stack;
- if (!resume_lv(cmd, lock_lv))
- stack;
- goto bad;
- }
-
- if (!resume_lv(cmd, lock_lv)) {
- log_error("Problem reactivating %s", lock_lv->name);
- goto bad;
- }
+ if (!lv_update_and_reload(lock_lv))
+ goto_bad;
if (lv_is_cow_covering_origin(lv))
if (!monitor_dev_for_events(cmd, lv, 0, 0))
@@ -5069,15 +5051,14 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
if (!update_pool_lv(lock_lv, 0))
goto_bad;
+ backup(vg);
+
if (inactive && !deactivate_lv(cmd, lock_lv)) {
log_error("Problem deactivating %s.", lock_lv->name);
- backup(vg);
return 0;
}
}
- backup(vg);
-
log_print_unless_silent("Logical volume %s successfully resized", lp->lv_name);
if (lp->resizefs && (lp->resize == LV_EXTEND) &&
@@ -5085,10 +5066,7 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
return 1;
-
bad:
- backup(vg);
-out:
if (inactive && !deactivate_lv(cmd, lock_lv))
log_error("Problem deactivating %s.", lock_lv->name);
@@ -6951,9 +6929,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
* I say that would be cleaner, but I'm not sure
* about the effects on thinpool yet...
*/
- if (!vg_write(vg) || !suspend_lv(cmd, lv) ||
- !vg_commit(vg) || !resume_lv(cmd, lv))
+ if (!lv_update_and_reload(lv)) {
+ stack;
goto deactivate_and_revert_new_lv;
+ }
if (!(lvl = find_lv_in_vg(vg, lp->origin)))
goto deactivate_and_revert_new_lv;
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index ab30af9..d39dbc8 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -502,7 +502,6 @@ static int _raid_add_images(struct logical_volume *lv,
uint32_t old_count = lv_raid_image_count(lv);
uint32_t count = new_count - old_count;
uint64_t status_mask = -1;
- struct cmd_context *cmd = lv->vg->cmd;
struct lv_segment *seg = first_seg(lv);
struct dm_list meta_lvs, data_lvs;
struct lv_list *lvl;
@@ -679,29 +678,8 @@ to be left for these sub-lvs.
dm_list_iterate_items(lvl, &data_lvs)
lv_set_hidden(lvl->lv);
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv_origin(cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!resume_lv_origin(cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
+ if (!lv_update_and_reload_origin(lv))
+ return_0;
/*
* Now that the 'REBUILD' has made its way to the kernel, we must
@@ -1223,34 +1201,12 @@ int lv_raid_split_and_track(struct logical_volume *lv,
return 0;
}
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv(lv->vg->cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
+ if (!lv_update_and_reload(lv))
+ return_0;
log_print_unless_silent("%s split from %s for read-only purposes.",
seg_lv(seg, s)->name, lv->name);
- /* Resume original LV */
- if (!resume_lv(lv->vg->cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
/* Activate the split (and tracking) LV */
if (!_activate_sublv_preserving_excl(lv, seg_lv(seg, s)))
return 0;
@@ -1316,29 +1272,8 @@ int lv_raid_merge(struct logical_volume *image_lv)
image_lv->status |= (lv->status & LVM_WRITE);
image_lv->status |= RAID_IMAGE;
- if (!vg_write(vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, vg->name);
- return 0;
- }
-
- if (!suspend_lv(vg->cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, vg->name);
- return 0;
- }
-
- if (!resume_lv(vg->cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- vg->name, lv->name);
- return 0;
- }
+ if (!lv_update_and_reload(lv))
+ return_0;
log_print_unless_silent("%s/%s successfully merged back into %s/%s",
vg->name, image_lv->name, vg->name, lv->name);
@@ -1439,29 +1374,8 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv,
lv->status |= RAID;
seg->status |= RAID;
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv(lv->vg->cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!resume_lv(lv->vg->cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
+ if (!lv_update_and_reload(lv))
+ return_0;
return 1;
}
@@ -1806,29 +1720,8 @@ try_again:
}
}
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv_origin(lv->vg->cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!resume_lv_origin(lv->vg->cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
+ if (!lv_update_and_reload_origin(lv))
+ return_0;
dm_list_iterate_items(lvl, &old_lvs) {
if (!deactivate_lv(lv->vg->cmd, lvl->lv))
@@ -1848,29 +1741,8 @@ try_again:
}
}
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv_origin(lv->vg->cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!resume_lv_origin(lv->vg->cmd, lv)) {
- log_error("Failed to resume %s/%s after committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
+ if (!lv_update_and_reload_origin(lv))
+ return_0;
return 1;
}
@@ -1879,7 +1751,6 @@ int lv_raid_remove_missing(struct logical_volume *lv)
{
uint32_t s;
struct lv_segment *seg = first_seg(lv);
- struct cmd_context *cmd = lv->vg->cmd;
if (!(lv->status & PARTIAL_LV)) {
log_error(INTERNAL_ERROR "%s/%s is not a partial LV",
@@ -1915,25 +1786,7 @@ int lv_raid_remove_missing(struct logical_volume *lv)
}
}
- if (!vg_write(lv->vg)) {
- log_error("Failed to write changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to suspend %s/%s before committing changes",
- lv->vg->name, lv->name);
- return 0;
- }
-
- if (!vg_commit(lv->vg)) {
- log_error("Failed to commit changes to %s in %s",
- lv->name, lv->vg->name);
- return 0;
- }
-
- if (!resume_lv(cmd, lv))
+ if (!lv_update_and_reload(lv))
return_0;
return 1;
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 31c397b..bbb030f 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -20,7 +20,6 @@ static int lvchange_permission(struct cmd_context *cmd,
{
uint32_t lv_access;
struct lvinfo info;
- int r = 0;
lv_access = arg_uint_value(cmd, permission_ARG, 0);
@@ -73,38 +72,15 @@ static int lvchange_permission(struct cmd_context *cmd,
lv->name);
}
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
- if (!vg_write(lv->vg))
+ if (!lv_update_and_reload(lv))
return_0;
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to lock %s", lv->name);
- vg_revert(lv->vg);
- goto out;
- }
-
- if (!vg_commit(lv->vg)) {
- if (!resume_lv(cmd, lv))
- stack;
- goto_out;
- }
-
- log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- goto out;
- }
-
- r = 1;
-out:
- backup(lv->vg);
- return r;
+ return 1;
}
static int lvchange_pool_update(struct cmd_context *cmd,
struct logical_volume *lv)
{
- int r = 0;
int update = 0;
unsigned val;
thin_discards_t discards;
@@ -143,32 +119,10 @@ static int lvchange_pool_update(struct cmd_context *cmd,
if (!update)
return 0;
- log_very_verbose("Updating logical volume \"%s\" on disk(s).", lv->name);
- if (!vg_write(lv->vg))
+ if (!lv_update_and_reload_origin(lv))
return_0;
- if (!suspend_lv_origin(cmd, lv)) {
- log_error("Failed to update active %s/%s (deactivation is needed).",
- lv->vg->name, lv->name);
- vg_revert(lv->vg);
- goto out;
- }
-
- if (!vg_commit(lv->vg)) {
- if (!resume_lv_origin(cmd, lv))
- stack;
- goto_out;
- }
-
- if (!resume_lv_origin(cmd, lv)) {
- log_error("Problem reactivating %s.", lv->name);
- goto out;
- }
-
- r = 1;
-out:
- backup(lv->vg);
- return r;
+ return 1;
}
static int lvchange_monitoring(struct cmd_context *cmd,
@@ -555,7 +509,6 @@ static int lvchange_readahead(struct cmd_context *cmd,
{
unsigned read_ahead = 0;
unsigned pagesize = (unsigned) lvm_getpagesize() >> SECTOR_SHIFT;
- int r = 0;
read_ahead = arg_uint_value(cmd, readahead_ARG, 0);
@@ -590,32 +543,10 @@ static int lvchange_readahead(struct cmd_context *cmd,
log_verbose("Setting read ahead to %u for \"%s\"", read_ahead,
lv->name);
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
- if (!vg_write(lv->vg))
+ if (!lv_update_and_reload(lv))
return_0;
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to lock %s", lv->name);
- vg_revert(lv->vg);
- goto out;
- }
-
- if (!vg_commit(lv->vg)) {
- if (!resume_lv(cmd, lv))
- stack;
- goto_out;
- }
-
- log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- goto out;
- }
-
- r = 1;
-out:
- backup(lv->vg);
- return r;
+ return 1;
}
static int lvchange_persistent(struct cmd_context *cmd,
@@ -814,25 +745,8 @@ static int lvchange_writemostly(struct logical_volume *lv)
}
}
- if (!vg_write(lv->vg))
- return_0;
-
- if (!suspend_lv(cmd, lv)) {
- vg_revert(lv->vg);
- return_0;
- }
-
- if (!vg_commit(lv->vg)) {
- if (!resume_lv(cmd, lv))
- stack;
+ if (!lv_update_and_reload(lv))
return_0;
- }
-
- log_very_verbose("Updating writemostly for \"%s\" in kernel", lv->name);
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- return 0;
- }
return 1;
}
@@ -862,26 +776,8 @@ static int lvchange_recovery_rate(struct logical_volume *lv)
return 0;
}
- if (!vg_write(lv->vg))
- return_0;
-
- if (!suspend_lv(cmd, lv)) {
- vg_revert(lv->vg);
+ if (!lv_update_and_reload(lv))
return_0;
- }
-
- if (!vg_commit(lv->vg)) {
- if (!resume_lv(cmd, lv))
- stack;
- return_0;
- }
-
- log_very_verbose("Updating recovery rate for \"%s\" in kernel",
- lv->name);
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- return 0;
- }
return 1;
}
9 years, 7 months
master - lvconvert: use lv_update_and_reload
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4e50863a22d4d...
Commit: e4e50863a22d4decd1b4c3a89e94b94173d2a704
Parent: aee8611af5992db2dd19a4235849f1953b560364
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:48:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 19:15:26 2014 +0200
lvconvert: use lv_update_and_reload
Use lib function.
---
tools/lvconvert.c | 55 ++++++----------------------------------------------
1 files changed, 7 insertions(+), 48 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 185cd59..a04a7fc 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -672,45 +672,6 @@ static struct logical_volume *_get_lvconvert_lv(struct cmd_context *cmd __attrib
return lv;
}
-static int _reload_lv(struct cmd_context *cmd,
- struct volume_group *vg,
- struct logical_volume *lv)
-{
- int r = 0;
-
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
-
- if (!vg_write(vg))
- return_0;
-
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to lock %s", lv->name);
- vg_revert(vg);
- if (!resume_lv(cmd, lv))
- stack;
- goto out;
- }
-
- if (!vg_commit(vg)) {
- vg_revert(vg);
- if (!resume_lv(cmd, lv))
- stack;
- goto_out;
- }
-
- log_very_verbose("Updating \"%s\" in kernel", lv->name);
-
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- goto out;
- }
-
- r = 1;
- backup(vg);
-out:
- return r;
-}
-
static int _finish_lvconvert_mirror(struct cmd_context *cmd,
struct volume_group *vg,
struct logical_volume *lv,
@@ -726,9 +687,7 @@ static int _finish_lvconvert_mirror(struct cmd_context *cmd,
lv->status &= ~CONVERTING;
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
-
- if (!_reload_lv(cmd, vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
log_print_unless_silent("Logical volume %s converted.", lv->name);
@@ -1207,7 +1166,7 @@ static int _lv_update_log_type(struct cmd_context *cmd,
* mirrored logs in cluster mirrors.
*/
if (old_log_count &&
- !_reload_lv(cmd, log_lv->vg, log_lv))
+ !lv_update_and_reload(log_lv))
return_0;
return 1;
@@ -1572,7 +1531,7 @@ out:
out_skip_log_convert:
- if (!_reload_lv(cmd, lv->vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
return 1;
@@ -1609,7 +1568,7 @@ int mirror_remove_missing(struct cmd_context *cmd,
!_lv_update_log_type(cmd, NULL, lv, failed_pvs, log_count))
return_0;
- if (!_reload_lv(cmd, lv->vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
return 1;
@@ -2117,7 +2076,7 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
}
/* store vg on disk(s) */
- if (!_reload_lv(cmd, lv->vg, org))
+ if (!lv_update_and_reload(org))
return_0;
log_print_unless_silent("Logical volume %s converted to snapshot.", lv->name);
@@ -2608,7 +2567,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
goto revert_new_lv;
}
- if (!_reload_lv(cmd, vg, torigin_lv)) {
+ if (!lv_update_and_reload(torigin_lv)) {
stack;
goto deactivate_and_revert_new_lv;
}
@@ -3057,7 +3016,7 @@ static int _lvconvert_cache(struct cmd_context *cmd,
if (!(cache_lv = lv_cache_create(pool_lv, origin)))
return_0;
- if (!_reload_lv(cmd, cache_lv->vg, cache_lv))
+ if (!lv_update_and_reload(cache_lv))
return_0;
log_print_unless_silent("Logical volume %s is now cached.",
9 years, 7 months
master - lv_manip: remove vg_revert
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aee8611af5992d...
Commit: aee8611af5992db2dd19a4235849f1953b560364
Parent: 413fc9d3e699206ec493a70c6baf98bc87b83a9f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:39:58 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 19:15:26 2014 +0200
lv_manip: remove vg_revert
vg_commit is supposed to have implicit revert handling.
(however as of now it needs fixes).
---
lib/metadata/lv_manip.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 7374484..cec9f84 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6096,7 +6096,6 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
if (!vg_commit(lv_where->vg)) {
log_error("Failed to commit intermediate VG %s metadata for mirror conversion.", lv_where->vg->name);
- vg_revert(lv_where->vg);
return NULL;
}
9 years, 7 months
master - lv_rename: fix snapshot rename
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=413fc9d3e69920...
Commit: 413fc9d3e699206ec493a70c6baf98bc87b83a9f
Parent: 319f67b1abd8b391958c8cd6d396c590bb5225be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 9 18:47:27 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 19:15:24 2014 +0200
lv_rename: fix snapshot rename
Fix rename operation for snapshot (cow) LV.
Only the snapshot's origin has the lock and by mistake suspend
and resume has been called for the snapshot LV.
This further made volumes unusable in cluster.
So instead of suspend and resuming list of LVs,
we need to just suspend and resume origin.
As the sequence write/suspend/commit/resume
is widely used in lvm2 code base - move it to
new lv_update_and_reload function.
---
WHATS_NEW | 2 +
lib/metadata/lv_manip.c | 96 +++++++++++++++++++++----------------
lib/metadata/metadata-exported.h | 4 ++
3 files changed, 60 insertions(+), 42 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index bf929f6..2175d29 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.112 -
=====================================
+ Introduce common code to modify metadate and reload updated LV.
+ Fix rename of active snapshot volume in cluster.
Make sure shared libraries are built with RELRO option.
Version 2.02.111 - 1st September 2014
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 60aa6f8..7374484 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3940,10 +3940,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name, int update_mda)
{
struct volume_group *vg = lv->vg;
- struct lv_names lv_names;
- DM_LIST_INIT(lvs_changed);
- struct lv_list lvl, lvl2, *lvlp;
- int r = 0;
+ struct lv_names lv_names = { .old = lv->name };
/* rename is not allowed on sub LVs */
if (!lv_is_visible(lv)) {
@@ -3965,51 +3962,21 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
if (update_mda && !archive(vg))
return_0;
+ if (!(lv_names.new = dm_pool_strdup(cmd->mem, new_name))) {
+ log_error("Failed to allocate space for new name.");
+ return 0;
+ }
/* rename sub LVs */
- lv_names.old = lv->name;
- lv_names.new = new_name;
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
return_0;
/* rename main LV */
- if (!(lv->name = dm_pool_strdup(cmd->mem, new_name))) {
- log_error("Failed to allocate space for new name");
- return 0;
- }
+ lv->name = lv_names.new;
- if (!update_mda)
- return 1;
-
- lvl.lv = lv;
- dm_list_add(&lvs_changed, &lvl.list);
-
- /* rename active virtual origin too */
- if (lv_is_cow(lv) && lv_is_virtual_origin(lvl2.lv = origin_from_cow(lv)))
- dm_list_add_h(&lvs_changed, &lvl2.list);
-
- log_verbose("Writing out updated volume group");
- if (!vg_write(vg))
- return 0;
-
- if (!suspend_lvs(cmd, &lvs_changed, vg))
- goto_out;
-
- if (!(r = vg_commit(vg)))
- stack;
+ if (update_mda && !lv_update_and_reload(lv))
+ return_0;
- /*
- * FIXME: resume LVs in reverse order to prevent memory
- * lock imbalance when resuming virtual snapshot origin
- * (resume of snapshot resumes origin too)
- */
- dm_list_iterate_back_items(lvlp, &lvs_changed)
- if (!resume_lv(cmd, lvlp->lv)) {
- r = 0;
- stack;
- }
-out:
- backup(vg);
- return r;
+ return 1;
}
/*
@@ -5739,6 +5706,51 @@ no_remove:
return 0;
}
+static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
+{
+ struct volume_group *vg = lv->vg;
+ int do_backup = 0, r = 0;
+
+ log_very_verbose("Updating logical volume %s on disk(s).",
+ display_lvname(lv));
+
+ if (!vg_write(vg))
+ return_0;
+
+ if (!(origin_only ? suspend_lv_origin(vg->cmd, lv) : suspend_lv(vg->cmd, lv))) {
+ log_error("Failed to lock logical volume %s.",
+ display_lvname(lv));
+ vg_revert(vg);
+ } else if (!(r = vg_commit(vg)))
+ stack; /* !vg_commit() has implict vg_revert() */
+ else
+ do_backup = 1;
+
+ log_very_verbose("Updating logical volume %s in kernel.",
+ display_lvname(lv));
+
+ if (!(origin_only ? resume_lv_origin(vg->cmd, lv) : resume_lv(vg->cmd, lv))) {
+ log_error("Problem reactivating logical volume %s.",
+ display_lvname(lv));
+ r = 0;
+ }
+
+ if (do_backup)
+ backup(vg);
+
+ return r;
+}
+
+int lv_update_and_reload(struct logical_volume *lv)
+{
+ return _lv_update_and_reload(lv, 0);
+}
+
+int lv_update_and_reload_origin(struct logical_volume *lv)
+{
+ return _lv_update_and_reload(lv, 1);
+}
+
/*
* insert_layer_for_segments_on_pv() inserts a layer segment for a segment area.
* However, layer modification could split the underlying layer segment.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0db4334..b0ca632 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -700,6 +700,10 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name, int update_mda);
+/* Updates and reloads metadata for given lv */
+int lv_update_and_reload(struct logical_volume *lv);
+int lv_update_and_reload_origin(struct logical_volume *lv);
+
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
uint32_t extent_size);
9 years, 7 months
master - cleanup: add stacktrace for error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=319f67b1abd8b3...
Commit: 319f67b1abd8b391958c8cd6d396c590bb5225be
Parent: c774d9a3f35c312d5b24c4ba13da707ccd975194
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:36:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 8 22:36:42 2014 +0200
cleanup: add stacktrace for error path
---
lib/metadata/lv_manip.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fcf9975..60aa6f8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3963,13 +3963,13 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
}
if (update_mda && !archive(vg))
- return 0;
+ return_0;
/* rename sub LVs */
lv_names.old = lv->name;
lv_names.new = new_name;
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
- return 0;
+ return_0;
/* rename main LV */
if (!(lv->name = dm_pool_strdup(cmd->mem, new_name))) {
9 years, 7 months
master - so: make sure shared libs are built with RELRO option
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c774d9a3f35c31...
Commit: c774d9a3f35c312d5b24c4ba13da707ccd975194
Parent: b25e0086b6738ad1e25480571af58807c12df57c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Sep 4 10:52:41 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Sep 4 10:52:41 2014 +0200
so: make sure shared libs are built with RELRO option
In addition to using RELRO for daemons, use this option for shared
libraries. See also commit a65ab773b4ddb06e87d678d3b2f4d0ca3e5b9fd0.
---
WHATS_NEW | 1 +
make.tmpl.in | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 70df450..bf929f6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Make sure shared libraries are built with RELRO option.
Version 2.02.111 - 1st September 2014
=====================================
diff --git a/make.tmpl.in b/make.tmpl.in
index 5e597df..455e9c2 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -160,6 +160,7 @@ ifeq ("@HAVE_PIE@", "yes")
ifeq ("@HAVE_FULL_RELRO@", "yes")
EXTRA_EXEC_CFLAGS += -fPIE -DPIE
EXTRA_EXEC_LDFLAGS += -Wl,-z,relro,-z,now -pie
+ CLDFLAGS += -Wl,-z,relro
endif
endif
endif
9 years, 7 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b25e0086b6738a...
Commit: b25e0086b6738ad1e25480571af58807c12df57c
Parent: fcb433abec7c3ed7919fcc6688988e2225e83f40
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Sep 1 01:53:44 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Sep 1 01:53:44 2014 +0100
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index b0c9ffc..061e5da 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.111(2)-git (2014-09-01)
+2.02.112(2)-git (2014-09-01)
diff --git a/VERSION_DM b/VERSION_DM
index 1e954da..d021c49 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.90-git (2014-09-01)
+1.02.91-git (2014-09-01)
diff --git a/WHATS_NEW b/WHATS_NEW
index e0e8773..70df450 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.112 -
+=====================================
+
Version 2.02.111 - 1st September 2014
=====================================
Pass properly sized char buffers for sscanf when initializing clvmd.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f0e77b3..4effe09 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.91 -
+====================================
+
Version 1.02.90 - 1st September 2014
====================================
Restore proper buffer size for parsing mountinfo line (1.02.89)
9 years, 7 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fcb433abec7c3e...
Commit: fcb433abec7c3ed7919fcc6688988e2225e83f40
Parent: fa1a0d170ad7193e9d0c6fe828a5c5df24806a54
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Sep 1 01:51:47 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Sep 1 01:51:47 2014 +0100
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 4 ++--
WHATS_NEW_DM | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/VERSION b/VERSION
index 234d9db..b0c9ffc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.111(2)-git (2014-08-26)
+2.02.111(2)-git (2014-09-01)
diff --git a/VERSION_DM b/VERSION_DM
index fe3203c..1e954da 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.90-git (2014-08-26)
+1.02.90-git (2014-09-01)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6758389..e0e8773 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,5 @@
-Version 2.02.111 -
-===================================
+Version 2.02.111 - 1st September 2014
+=====================================
Pass properly sized char buffers for sscanf when initializing clvmd.
Reinstate nosync logic when extending mirror. (2.02.110)
Fix total area extent calculation when allocating cache pool. (2.02.110)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3012ef1..f0e77b3 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.90 -
-==================================
+Version 1.02.90 - 1st September 2014
+====================================
Restore proper buffer size for parsing mountinfo line (1.02.89)
Version 1.02.89 - 26th August 2014
9 years, 7 months
master - so: make sure shared libs are built with RELRO option
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5c34e3263a6032...
Commit: 5c34e3263a6032f7a12975662964c8b8d3084257
Parent: fa1a0d170ad7193e9d0c6fe828a5c5df24806a54
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 1 12:50:14 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 1 12:54:29 2014 +0200
so: make sure shared libs are built with RELRO option
In addition to using RELRO for daemons, use this option for shared
libraries. See also commit a65ab773b4ddb06e87d678d3b2f4d0ca3e5b9fd0.
---
WHATS_NEW | 1 +
make.tmpl.in | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6758389..9a786b4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.111 -
===================================
+ Make sure shared libraries are built with RELRO option.
Pass properly sized char buffers for sscanf when initializing clvmd.
Reinstate nosync logic when extending mirror. (2.02.110)
Fix total area extent calculation when allocating cache pool. (2.02.110)
diff --git a/make.tmpl.in b/make.tmpl.in
index 5e597df..455e9c2 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -160,6 +160,7 @@ ifeq ("@HAVE_PIE@", "yes")
ifeq ("@HAVE_FULL_RELRO@", "yes")
EXTRA_EXEC_CFLAGS += -fPIE -DPIE
EXTRA_EXEC_LDFLAGS += -Wl,-z,relro,-z,now -pie
+ CLDFLAGS += -Wl,-z,relro
endif
endif
endif
9 years, 7 months