From: snitzer@sourceware.org <snitzer@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
Date: 20 Jan 2012 22:03:49 -0000 [thread overview]
Message-ID: <20120120220349.28245.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: snitzer at sourceware.org 2012-01-20 22:03:49
Modified files:
. : WHATS_NEW
lib/metadata : lv_manip.c
tools : lvconvert.c
Log message:
Allow removal of an invalid snapshot that was to be merged on next activation.
Don't allow a user to merge an invalid snapshot.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2231&r2=1.2232
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.343&r2=1.344
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.178&r2=1.179
--- LVM2/WHATS_NEW 2012/01/20 22:03:03 1.2231
+++ LVM2/WHATS_NEW 2012/01/20 22:03:48 1.2232
@@ -1,5 +1,7 @@
Version 2.02.89 -
==================================
+ Allow removal of an invalid snapshot that was to be merged on next activation.
+ Don't allow a user to merge an invalid snapshot.
Use m and M lv_attr to indicate that a snapshot merge failed in lvs.
Differentiate between snapshot status of "Invalid" and "Merge failed".
Lookup snapshot usage percent of origin volume when a snapshot is merging.
--- LVM2/lib/metadata/lv_manip.c 2012/01/19 15:39:41 1.343
+++ LVM2/lib/metadata/lv_manip.c 2012/01/20 22:03:48 1.344
@@ -3263,15 +3263,27 @@
int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
const force_t force, unsigned level)
{
+ percent_t snap_percent;
struct dm_list *snh, *snht;
struct seg_list *sl, *tsl;
+ struct lvinfo info;
if (lv_is_cow(lv)) {
- /* A merging snapshot cannot be removed directly */
+ /*
+ * A merging snapshot cannot be removed directly unless
+ * it has been invalidated.
+ */
if (lv_is_merging_cow(lv) && !level) {
- log_error("Can't remove merging snapshot logical volume \"%s\"",
- lv->name);
- return 0;
+ if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) &&
+ info.exists && info.live_table) {
+ if (lv_snapshot_percent(lv, &snap_percent) &&
+ ((snap_percent != PERCENT_INVALID) &&
+ (snap_percent != PERCENT_MERGE_FAILED))) {
+ log_error("Can't remove merging snapshot logical volume \"%s\"",
+ lv->name);
+ return 0;
+ }
+ }
}
}
--- LVM2/tools/lvconvert.c 2012/01/20 22:02:05 1.178
+++ LVM2/tools/lvconvert.c 2012/01/20 22:03:48 1.179
@@ -1709,6 +1709,8 @@
{
struct lvconvert_params *lp = handle;
struct dm_list *failed_pvs;
+ struct lvinfo info;
+ percent_t snap_percent;
if (lv->status & LOCKED) {
log_error("Cannot convert locked LV %s", lv->name);
@@ -1742,6 +1744,13 @@
lv->name);
return ECMD_FAILED;
}
+ if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0)
+ && info.exists && info.live_table &&
+ (!lv_snapshot_percent(lv, &snap_percent) ||
+ snap_percent == PERCENT_INVALID)) {
+ log_error("Unable to merge invalidated snapshot LV \"%s\"", lv->name);
+ return ECMD_FAILED;
+ }
if (!archive(lv->vg)) {
stack;
return ECMD_FAILED;
next reply other threads:[~2012-01-20 22:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 22:03 snitzer [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-10-06 15:32 LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools jbrassow
2009-05-27 18:19 agk
2009-05-20 9:55 mbroz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120120220349.28245.qmail@sourceware.org \
--to=snitzer@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.