master - WHATS_NEW: for 0da72743ca46ae9f8185cd12d5c78b3c2b801872
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fcbb34bdccb21f...
Commit: fcbb34bdccb21f0ed4c8fe990fdc68126f1cbf4f
Parent: 80bcdb93ffcd69e03923ceeac5afc018831d0cfc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Aug 14 10:18:02 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Aug 14 10:18:02 2013 +0200
WHATS_NEW: for 0da72743ca46ae9f8185cd12d5c78b3c2b801872
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 67c4b18..c7fda19 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Fix vgck to notice on-disk corruption even if lvmetad is used.
Move mpath device filter before partitioned filter (which opens devices).
Split partitioned filter out of lvm_type filter.
Merge filter*.h into a single filter.h.
10 years, 8 months
master - filters: check for mpath before opening devs
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=80bcdb93ffcd69...
Commit: 80bcdb93ffcd69e03923ceeac5afc018831d0cfc
Parent: 0da72743ca46ae9f8185cd12d5c78b3c2b801872
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 13 23:26:58 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 13 23:26:58 2013 +0100
filters: check for mpath before opening devs
Split out the partitioned device filter that needs to open the device
and move the multipath filter in front of it.
When a device is multipathed, sending I/O to the underlying paths may
cause problems, the most obvious being I/O errors visible to lvm if a
path is down.
Revert the incorrect <backtrace> messages added when a device doesn't
pass a filter.
Log each filter initialisation to show sequence.
Avoid duplicate 'Using $device' debug messages.
---
WHATS_NEW | 3 +
include/.symlinks.in | 6 ---
lib/Makefile.in | 3 +-
lib/commands/toolcontext.c | 30 ++++++------
lib/device/dev-cache.c | 13 +++--
lib/filters/filter-composite.c | 8 ++--
lib/filters/filter-composite.h | 23 ----------
lib/filters/filter-md.c | 4 +-
lib/filters/filter-md.h | 24 ----------
lib/filters/filter-mpath.c | 4 +-
lib/filters/filter-mpath.h | 24 ----------
lib/filters/filter-partitioned.c | 83 +++++++++++++++++++++++++++++++++++
lib/filters/filter-persistent.c | 4 +-
lib/filters/filter-persistent.h | 28 ------------
lib/filters/filter-regex.c | 5 ++-
lib/filters/filter-regex.h | 31 -------------
lib/filters/filter-sysfs.c | 5 ++-
lib/filters/filter-sysfs.h | 22 ---------
lib/filters/filter-type.c | 59 +++++++++++++++++++++++++
lib/filters/filter.c | 88 --------------------------------------
lib/filters/filter.h | 27 ++++++++++-
tools/tools.h | 4 --
22 files changed, 215 insertions(+), 283 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 49360b2..67c4b18 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,8 @@
Version 2.02.101 -
===================================
+ Move mpath device filter before partitioned filter (which opens devices).
+ Split partitioned filter out of lvm_type filter.
+ Merge filter*.h into a single filter.h.
Require confirmation for vgchange -c when no VGs listed explicitly.
Also skip /var and /var/log by default in blkdeactivate when unmounting.
Add support for bind mounts in blkdeactivate.
diff --git a/include/.symlinks.in b/include/.symlinks.in
index 0fdcdb0..6de35b8 100644
--- a/include/.symlinks.in
+++ b/include/.symlinks.in
@@ -17,12 +17,6 @@
@top_srcdir(a)/lib/device/dev-type.h
@top_srcdir(a)/lib/device/device.h
@top_srcdir(a)/lib/display/display.h
-@top_srcdir(a)/lib/filters/filter-composite.h
-@top_srcdir(a)/lib/filters/filter-md.h
-@top_srcdir(a)/lib/filters/filter-mpath.h
-@top_srcdir(a)/lib/filters/filter-persistent.h
-@top_srcdir(a)/lib/filters/filter-regex.h
-@top_srcdir(a)/lib/filters/filter-sysfs.h
@top_srcdir(a)/lib/filters/filter.h
@top_srcdir(a)/lib/format1/format1.h
@top_srcdir(a)/lib/format_pool/format_pool.h
diff --git a/lib/Makefile.in b/lib/Makefile.in
index a58605c..8fdc194 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -66,7 +66,8 @@ SOURCES =\
filters/filter-sysfs.c \
filters/filter-md.c \
filters/filter-mpath.c \
- filters/filter.c \
+ filters/filter-partitioned.c \
+ filters/filter-type.c \
format_text/archive.c \
format_text/archiver.c \
format_text/export.c \
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 48fc489..65371b1 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -20,12 +20,6 @@
#include "lvm-string.h"
#include "activate.h"
#include "filter.h"
-#include "filter-composite.h"
-#include "filter-md.h"
-#include "filter-mpath.h"
-#include "filter-persistent.h"
-#include "filter-regex.h"
-#include "filter-sysfs.h"
#include "label.h"
#include "lvm-file.h"
#include "format-text.h"
@@ -35,7 +29,6 @@
#include "segtype.h"
#include "lvmcache.h"
#include "lvmetad.h"
-#include "dev-cache.h"
#include "archiver.h"
#ifdef HAVE_LIBDL
@@ -824,7 +817,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
return 1;
}
-#define MAX_FILTERS 5
+#define MAX_FILTERS 6
static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
{
@@ -853,7 +846,6 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
if (!(cn = find_config_tree_node(cmd, devices_filter_CFG, NULL)))
log_very_verbose("devices/filter not found in config file: "
"no regex filter installed");
-
else if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
log_error("Failed to create regex device filter");
goto bad;
@@ -867,6 +859,19 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
}
nr_filt++;
+ /* mpath component filter. Optional, non-critical. */
+ if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
+ if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
+ nr_filt++;
+ }
+
+ /* partitioned device filter. Required. */
+ if (!(filters[nr_filt] = partitioned_filter_create(cmd->dev_types))) {
+ log_error("Failed to create partitioned device filter");
+ goto bad;
+ }
+ nr_filt++;
+
/* md component filter. Optional, non-critical. */
if (find_config_tree_bool(cmd, devices_md_component_detection_CFG, NULL)) {
init_md_filtering(1);
@@ -874,12 +879,6 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
nr_filt++;
}
- /* mpath component filter. Optional, non-critical. */
- if (find_config_tree_bool(cmd, devices_multipath_component_detection_CFG, NULL)) {
- if ((filters[nr_filt] = mpath_filter_create(cmd->dev_types)))
- nr_filt++;
- }
-
/* Only build a composite filter if we really need it. */
if (nr_filt == 1)
return filters[0];
@@ -888,6 +887,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
goto_bad;
return composite;
+
bad:
while (--nr_filt >= 0)
filters[nr_filt]->destroy(filters[nr_filt]);
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 24046ca..46e5d65 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -14,10 +14,8 @@
*/
#include "lib.h"
-#include "dev-cache.h"
#include "lvm-types.h"
#include "btree.h"
-#include "filter.h"
#include "config.h"
#include "toolcontext.h"
@@ -923,8 +921,11 @@ struct device *dev_cache_get(const char *name, struct dev_filter *f)
}
}
- return (d && (!f || (d->flags & DEV_REGULAR) ||
- f->passes_filter(f, d))) ? d : NULL;
+ if (!d || (f && !(d->flags & DEV_REGULAR) && !(f->passes_filter(f, d))))
+ return NULL;
+
+ log_debug_devs("Using %s", dev_name(d));
+ return d;
}
static struct device *_dev_cache_seek_devt(dev_t dev)
@@ -1007,8 +1008,10 @@ struct device *dev_iter_get(struct dev_iter *iter)
while (iter->current) {
struct device *d = _iter_next(iter);
if (!iter->filter || (d->flags & DEV_REGULAR) ||
- iter->filter->passes_filter(iter->filter, d))
+ iter->filter->passes_filter(iter->filter, d)) {
+ log_debug_devs("Using %s", dev_name(d));
return d;
+ }
}
return NULL;
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index 47d147e..a6ba71a 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -14,7 +14,7 @@
*/
#include "lib.h"
-#include "filter-composite.h"
+#include "filter.h"
static int _and_p(struct dev_filter *f, struct device *dev)
{
@@ -22,9 +22,7 @@ static int _and_p(struct dev_filter *f, struct device *dev)
for (filters = (struct dev_filter **) f->private; *filters; ++filters)
if (!(*filters)->passes_filter(*filters, dev))
- return_0;
-
- log_debug_devs("Using %s", dev_name(dev));
+ return 0; /* No 'stack': a filter, not an error. */
return 1;
}
@@ -92,5 +90,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
cft->use_count = 0;
cft->private = filters_copy;
+ log_debug_devs("Composite filter initialised.");
+
return cft;
}
diff --git a/lib/filters/filter-composite.h b/lib/filters/filter-composite.h
deleted file mode 100644
index 75c0b1f..0000000
--- a/lib/filters/filter-composite.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_COMPOSITE_H
-#define _LVM_FILTER_COMPOSITE_H
-
-#include "dev-cache.h"
-
-struct dev_filter *composite_filter_create(int n, struct dev_filter **filters);
-
-#endif
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index b18cd07..0089f93 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -14,7 +14,7 @@
*/
#include "lib.h"
-#include "filter-md.h"
+#include "filter.h"
#ifdef linux
@@ -64,6 +64,8 @@ struct dev_filter *md_filter_create(struct dev_types *dt)
f->use_count = 0;
f->private = dt;
+ log_debug_devs("MD filter initialised.");
+
return f;
}
diff --git a/lib/filters/filter-md.h b/lib/filters/filter-md.h
deleted file mode 100644
index 79e4f0e..0000000
--- a/lib/filters/filter-md.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2004 Luca Berra
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_MD_H
-#define _LVM_FILTER_MD_H
-
-#include "dev-cache.h"
-#include "dev-type.h"
-
-struct dev_filter *md_filter_create(struct dev_types *dt);
-
-#endif
-
diff --git a/lib/filters/filter-mpath.c b/lib/filters/filter-mpath.c
index 2502f30..1db2264 100644
--- a/lib/filters/filter-mpath.c
+++ b/lib/filters/filter-mpath.c
@@ -13,7 +13,7 @@
*/
#include "lib.h"
-#include "filter-mpath.h"
+#include "filter.h"
#include "activate.h"
#ifdef linux
@@ -228,6 +228,8 @@ struct dev_filter *mpath_filter_create(struct dev_types *dt)
f->use_count = 0;
f->private = dt;
+ log_debug_devs("mpath filter initialised.");
+
return f;
}
diff --git a/lib/filters/filter-mpath.h b/lib/filters/filter-mpath.h
deleted file mode 100644
index 5665f3b..0000000
--- a/lib/filters/filter-mpath.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2011 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_MPATH_H
-#define _LVM_FILTER_MPATH_H
-
-#include "dev-cache.h"
-#include "dev-type.h"
-
-struct dev_filter *mpath_filter_create(struct dev_types *dt);
-
-#endif
-
diff --git a/lib/filters/filter-partitioned.c b/lib/filters/filter-partitioned.c
new file mode 100644
index 0000000..e3caa0e
--- /dev/null
+++ b/lib/filters/filter-partitioned.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "lib.h"
+#include "filter.h"
+
+static int _passes_partitioned_filter(struct dev_filter *f, struct device *dev)
+{
+ struct dev_types *dt = (struct dev_types *) f->private;
+ const char *name = dev_name(dev);
+ int ret = 0;
+ uint64_t size;
+
+ /* Check it's accessible */
+ if (!dev_open_readonly_quiet(dev)) {
+ log_debug_devs("%s: Skipping: open failed", name);
+ return 0;
+ }
+
+ /* Check it's not too small */
+ if (!dev_get_size(dev, &size)) {
+ log_debug_devs("%s: Skipping: dev_get_size failed", name);
+ goto out;
+ }
+
+ if (size < pv_min_size()) {
+ log_debug_devs("%s: Skipping: Too small to hold a PV", name);
+ goto out;
+ }
+
+ if (dev_is_partitioned(dt, dev)) {
+ log_debug_devs("%s: Skipping: Partition table signature found",
+ name);
+ goto out;
+ }
+
+ ret = 1;
+
+ out:
+ if (!dev_close(dev))
+ stack;
+
+ return ret;
+}
+
+static void _partitioned_filter_destroy(struct dev_filter *f)
+{
+ if (f->use_count)
+ log_error(INTERNAL_ERROR "Destroying partitioned filter while in use %u times.", f->use_count);
+
+ dm_free(f);
+}
+
+struct dev_filter *partitioned_filter_create(struct dev_types *dt)
+{
+ struct dev_filter *f;
+
+ if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
+ log_error("Partitioned filter allocation failed");
+ return NULL;
+ }
+
+ f->passes_filter = _passes_partitioned_filter;
+ f->destroy = _partitioned_filter_destroy;
+ f->use_count = 0;
+ f->private = dt;
+
+ log_debug_devs("Partitioned filter initialised.");
+
+ return f;
+}
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index 2949b93..14a3480 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -14,7 +14,7 @@
*/
#include "lib.h"
-#include "filter-persistent.h"
+#include "filter.h"
#include "config.h"
#include "lvm-file.h"
#include "activate.h"
@@ -366,6 +366,8 @@ struct dev_filter *persistent_filter_create(struct dev_types *dt,
f->wipe = _persistent_filter_wipe;
f->dump = _persistent_filter_dump;
+ log_debug_devs("Persistent filter initialised.");
+
return f;
bad:
diff --git a/lib/filters/filter-persistent.h b/lib/filters/filter-persistent.h
deleted file mode 100644
index bdbf887..0000000
--- a/lib/filters/filter-persistent.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_PERSISTENT_H
-#define _LVM_FILTER_PERSISTENT_H
-
-#include "dev-cache.h"
-#include "dev-type.h"
-
-struct dev_filter *persistent_filter_create(struct dev_types *dt,
- struct dev_filter *f,
- const char *file);
-
-int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out);
-
-#endif
diff --git a/lib/filters/filter-regex.c b/lib/filters/filter-regex.c
index 4fe9a7a..b30290e 100644
--- a/lib/filters/filter-regex.c
+++ b/lib/filters/filter-regex.c
@@ -14,7 +14,7 @@
*/
#include "lib.h"
-#include "filter-regex.h"
+#include "filter.h"
struct rfilter {
struct dm_pool *mem;
@@ -212,6 +212,9 @@ struct dev_filter *regex_filter_create(const struct dm_config_value *patterns)
f->destroy = _regex_destroy;
f->use_count = 0;
f->private = rf;
+
+ log_debug_devs("Regex filter initialised.");
+
return f;
bad:
diff --git a/lib/filters/filter-regex.h b/lib/filters/filter-regex.h
deleted file mode 100644
index de05206..0000000
--- a/lib/filters/filter-regex.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_REGEX_H
-#define _LVM_FILTER_REGEX_H
-
-#include "dev-cache.h"
-
-/*
- * patterns must be an array of strings of the form:
- * [ra]<sep><regex><sep>, eg,
- * r/cdrom/ - reject cdroms
- * a|loop/[0-4]| - accept loops 0 to 4
- * r|.*| - reject everything else
- */
-
-struct dev_filter *regex_filter_create(const struct dm_config_value *patterns);
-
-#endif
diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
index cd039c0..e03beca 100644
--- a/lib/filters/filter-sysfs.c
+++ b/lib/filters/filter-sysfs.c
@@ -13,7 +13,7 @@
*/
#include "lib.h"
-#include "filter-sysfs.h"
+#include "filter.h"
#ifdef linux
@@ -324,6 +324,9 @@ struct dev_filter *sysfs_filter_create(void)
f->destroy = _destroy;
f->use_count = 0;
f->private = ds;
+
+ log_debug_devs("Sysfs filter initialised.");
+
return f;
bad:
diff --git a/lib/filters/filter-sysfs.h b/lib/filters/filter-sysfs.h
deleted file mode 100644
index 4b26ea6..0000000
--- a/lib/filters/filter-sysfs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LVM_FILTER_SYSFS_H
-#define _LVM_FILTER_SYSFS_H
-
-#include "dev-cache.h"
-
-struct dev_filter *sysfs_filter_create(void);
-
-#endif
diff --git a/lib/filters/filter-type.c b/lib/filters/filter-type.c
new file mode 100644
index 0000000..b55269b
--- /dev/null
+++ b/lib/filters/filter-type.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "lib.h"
+#include "filter.h"
+
+static int _passes_lvm_type_device_filter(struct dev_filter *f, struct device *dev)
+{
+ struct dev_types *dt = (struct dev_types *) f->private;
+ const char *name = dev_name(dev);
+
+ /* Is this a recognised device type? */
+ if (!dt->dev_type_array[MAJOR(dev->dev)].max_partitions) {
+ log_debug_devs("%s: Skipping: Unrecognised LVM device type %"
+ PRIu64, name, (uint64_t) MAJOR(dev->dev));
+ return 0;
+ }
+
+ return 1;
+}
+
+static void _lvm_type_filter_destroy(struct dev_filter *f)
+{
+ if (f->use_count)
+ log_error(INTERNAL_ERROR "Destroying lvm_type filter while in use %u times.", f->use_count);
+
+ dm_free(f);
+}
+
+struct dev_filter *lvm_type_filter_create(struct dev_types *dt)
+{
+ struct dev_filter *f;
+
+ if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
+ log_error("LVM type filter allocation failed");
+ return NULL;
+ }
+
+ f->passes_filter = _passes_lvm_type_device_filter;
+ f->destroy = _lvm_type_filter_destroy;
+ f->use_count = 0;
+ f->private = dt;
+
+ log_debug_devs("LVM type filter initialised.");
+
+ return f;
+}
diff --git a/lib/filters/filter.c b/lib/filters/filter.c
deleted file mode 100644
index 56935f9..0000000
--- a/lib/filters/filter.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
- *
- * This file is part of LVM2.
- *
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License v.2.1.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "lib.h"
-#include "filter.h"
-
-static int _passes_lvm_type_device_filter(struct dev_filter *f, struct device *dev)
-{
- struct dev_types *dt = (struct dev_types *) f->private;
- const char *name = dev_name(dev);
- int ret = 0;
- uint64_t size;
-
- /* Is this a recognised device type? */
- if (!dt->dev_type_array[MAJOR(dev->dev)].max_partitions) {
- log_debug_devs("%s: Skipping: Unrecognised LVM device type %"
- PRIu64, name, (uint64_t) MAJOR(dev->dev));
- return 0;
- }
-
- /* Check it's accessible */
- if (!dev_open_readonly_quiet(dev)) {
- log_debug_devs("%s: Skipping: open failed", name);
- return 0;
- }
-
- /* Check it's not too small */
- if (!dev_get_size(dev, &size)) {
- log_debug_devs("%s: Skipping: dev_get_size failed", name);
- goto out;
- }
-
- if (size < pv_min_size()) {
- log_debug_devs("%s: Skipping: Too small to hold a PV", name);
- goto out;
- }
-
- if (dev_is_partitioned(dt, dev)) {
- log_debug_devs("%s: Skipping: Partition table signature found",
- name);
- goto out;
- }
-
- ret = 1;
-
- out:
- if (!dev_close(dev))
- stack;
-
- return ret;
-}
-
-static void _lvm_type_filter_destroy(struct dev_filter *f)
-{
- if (f->use_count)
- log_error(INTERNAL_ERROR "Destroying lvm_type filter while in use %u times.", f->use_count);
-
- dm_free(f);
-}
-
-struct dev_filter *lvm_type_filter_create(struct dev_types *dt)
-{
- struct dev_filter *f;
-
- if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
- log_error("LVM type filter allocation failed");
- return NULL;
- }
-
- f->passes_filter = _passes_lvm_type_device_filter;
- f->destroy = _lvm_type_filter_destroy;
- f->use_count = 0;
- f->private = dt;
-
- return f;
-}
diff --git a/lib/filters/filter.h b/lib/filters/filter.h
index e0a0c6a..219d3f7 100644
--- a/lib/filters/filter.h
+++ b/lib/filters/filter.h
@@ -1,6 +1,7 @@
/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004 Luca Berra
+ * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -19,6 +20,26 @@
#include "dev-cache.h"
#include "dev-type.h"
+struct dev_filter *composite_filter_create(int n, struct dev_filter **filters);
struct dev_filter *lvm_type_filter_create(struct dev_types *dt);
+struct dev_filter *md_filter_create(struct dev_types *dt);
+struct dev_filter *mpath_filter_create(struct dev_types *dt);
+struct dev_filter *partitioned_filter_create(struct dev_types *dt);
+struct dev_filter *persistent_filter_create(struct dev_types *dt,
+ struct dev_filter *f,
+ const char *file);
+struct dev_filter *sysfs_filter_create(void);
-#endif
+/*
+ * patterns must be an array of strings of the form:
+ * [ra]<sep><regex><sep>, eg,
+ * r/cdrom/ - reject cdroms
+ * a|loop/[0-4]| - accept loops 0 to 4
+ * r|.*| - reject everything else
+ */
+
+struct dev_filter *regex_filter_create(const struct dm_config_value *patterns);
+
+int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out);
+
+#endif /* _LVM_FILTER_H */
diff --git a/tools/tools.h b/tools/tools.h
index 6e820bf..a2bfe0d 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -36,10 +36,6 @@
#include "device.h"
#include "display.h"
#include "errors.h"
-#include "filter.h"
-#include "filter-composite.h"
-#include "filter-persistent.h"
-#include "filter-regex.h"
#include "metadata-exported.h"
#include "locking.h"
#include "lvm-exec.h"
10 years, 8 months
master - vgck: Fix #894136, notice on-disk corruption in spite of lvmetad.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0da72743ca46ae...
Commit: 0da72743ca46ae9f8185cd12d5c78b3c2b801872
Parent: 1a1d3a10ffde42665b824a5c72bd526cb962ec1d
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Aug 13 23:25:49 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Aug 13 23:25:49 2013 +0200
vgck: Fix #894136, notice on-disk corruption in spite of lvmetad.
---
test/shell/vgck.sh | 31 +++++++++++++++++++++++++++++++
tools/vgck.c | 1 +
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgck.sh b/test/shell/vgck.sh
new file mode 100644
index 0000000..772233c
--- /dev/null
+++ b/test/shell/vgck.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_vg 3
+lvcreate -n blabla -L 1 $vg
+
+dd if=/dev/urandom bs=512 seek=2 count=32 of=$dev2
+
+# TODO: aux lvmconf "global/locking_type = 4"
+
+if test -e LOCAL_LVMETAD; then
+ vgscan 2>&1 | tee vgscan.out
+ not grep "Inconsistent metadata found for VG $vg" vgscan.out
+else
+ not vgscan 2>&1 | tee vgscan.out
+ grep "Inconsistent metadata found for VG $vg" vgscan.out
+fi
+
+dd if=/dev/urandom bs=512 seek=2 count=32 of=$dev2
+vgck $vg 2>&1 | tee vgck.out
+grep Incorrect vgck.out
diff --git a/tools/vgck.c b/tools/vgck.c
index eb0ecaf..4ad045a 100644
--- a/tools/vgck.c
+++ b/tools/vgck.c
@@ -37,6 +37,7 @@ static int vgck_single(struct cmd_context *cmd __attribute__((unused)),
int vgck(struct cmd_context *cmd, int argc, char **argv)
{
+ lvmetad_set_active(0);
return process_each_vg(cmd, argc, argv, 0, NULL,
&vgck_single);
}
10 years, 8 months
master - vgchange: require confirmation with -c and no VGs
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1a1d3a10ffde42...
Commit: 1a1d3a10ffde42665b824a5c72bd526cb962ec1d
Parent: fd7cac15bcc4fe2a6036b4408a8c53d003a6859f
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 13 18:20:11 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 13 18:20:11 2013 +0100
vgchange: require confirmation with -c and no VGs
Too many people have been running 'vgchange -cy' by mistake
so add a confirmation prompt. Use --yes to bypass this.
---
WHATS_NEW | 1 +
tools/vgchange.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b1f379b..49360b2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Require confirmation for vgchange -c when no VGs listed explicitly.
Also skip /var and /var/log by default in blkdeactivate when unmounting.
Add support for bind mounts in blkdeactivate.
Add blkdeactivate -v/--verbose for debug output from external tools used.
diff --git a/tools/vgchange.c b/tools/vgchange.c
index d41ef49..4087fab 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -623,6 +623,12 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return ECMD_PROCESSED;
}
+ if (arg_count(cmd, clustered_ARG) && !argc && !arg_count(cmd, yes_ARG) &&
+ (yes_no_prompt("Change clustered property of all volumes groups? [y/n]: ") == 'n')) {
+ log_error("No volume groups changed.");
+ return ECMD_FAILED;
+ }
+
if (!update || !update_partial_unsafe)
cmd->handles_missing_pvs = 1;
10 years, 8 months
master - WHATS_NEW: be more precise
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fd7cac15bcc4fe...
Commit: fd7cac15bcc4fe2a6036b4408a8c53d003a6859f
Parent: e166c00ac619a17970b2a71429e02038b1ebf2dc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 13 18:25:54 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 13 18:25:54 2013 +0200
WHATS_NEW: be more precise
---
WHATS_NEW | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6cce602..b1f379b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,6 @@
Version 2.02.101 -
===================================
- Also skip /var and /var/log by default in blkdeactivate.
+ Also skip /var and /var/log by default in blkdeactivate when unmounting.
Add support for bind mounts in blkdeactivate.
Add blkdeactivate -v/--verbose for debug output from external tools used.
Add blkdeactivate -e/--errors for error messages from external tools used.
10 years, 8 months
master - WHATS_NEW: one more for a85439
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e166c00ac619a1...
Commit: e166c00ac619a17970b2a71429e02038b1ebf2dc
Parent: 268b370e245ee0d6abaeeedff513c9678eeb7f54
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 13 18:16:05 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 13 18:16:05 2013 +0200
WHATS_NEW: one more for a85439
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 40e99e6..6cce602 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Also skip /var and /var/log by default in blkdeactivate.
Add support for bind mounts in blkdeactivate.
Add blkdeactivate -v/--verbose for debug output from external tools used.
Add blkdeactivate -e/--errors for error messages from external tools used.
10 years, 8 months
master - blkdeactivate: add support for bind mounts
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=268b370e245ee0...
Commit: 268b370e245ee0d6abaeeedff513c9678eeb7f54
Parent: a854398764968fe2847ba6cbfec7650a7ca04b37
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 13 17:26:36 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 13 17:51:40 2013 +0200
blkdeactivate: add support for bind mounts
Recent version of util-linux/umount (v2.23+) provides
umount --all-targets that can unmount all the mount targets of
the same device (the bind mounts). Use this if available when
calling the umount blkdeactivate.
Otherwise, for older versions of util-linux, use findmnt
(that is also a part of the util-linux) to iterate over all
mount targets of the same device - this is the manual way.
---
WHATS_NEW | 1 +
scripts/blkdeactivate.sh.in | 30 +++++++++++++++++++++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dd90726..40e99e6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Add support for bind mounts in blkdeactivate.
Add blkdeactivate -v/--verbose for debug output from external tools used.
Add blkdeactivate -e/--errors for error messages from external tools used.
Suppress messages from external tools called in blkdeactivate by default.
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 48f9fe3..b6d0117 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -36,7 +36,13 @@ UMOUNT="/bin/umount"
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
-UMOUNT_OPTS=""
+if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
+ UMOUNT_OPTS="--all-targets "
+else
+ UMOUNT_OPTS=""
+ FINDMNT="/bin/findmnt -r --noheadings -u -o TARGET"
+ FINDMNT_READ="read -r mnt"
+fi
DMSETUP_OPTS=""
LVM_OPTS=""
@@ -132,10 +138,8 @@ is_top_level_device() {
test -z "$files"
}
-device_umount () {
- test -z "$mnt" && return 0;
-
- test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" && return 0
+device_umount_one() {
+ test -z "$mnt" && return 0
if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then
echo -n " [UMOUNT]: unmounting $name ($kname) mounted on $mnt... "
@@ -151,6 +155,22 @@ device_umount () {
fi
}
+device_umount() {
+ test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" && return 0
+
+ # FINDMNT is defined only if umount --all-targets is not available.
+ # In that case, read the list of multiple mount points of one device
+ # using FINDMNT and unmount it one by one manually.
+ if test -z "$FINDMNT"; then
+ device_umount_one
+ else
+ while $FINDMNT_READ; do
+ device_umount_one || return 1
+ done <<< "`$FINDMNT $DEV_DIR/$kname`"
+ fi
+
+}
+
deactivate_holders () {
local skip=1; $LSBLK_VARS
10 years, 8 months
master - blkdeactivate: change the way blkdeactivate reports status
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a854398764968f...
Commit: a854398764968fe2847ba6cbfec7650a7ca04b37
Parent: 32148369d12750dbf85cfd5c21a8bc7f9e6b5ec5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 13 17:17:25 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 13 17:51:23 2013 +0200
blkdeactivate: change the way blkdeactivate reports status
The blkdeactivate now suppresses error messages from external
tools that are called. Instead, only a summary message "done"
or "skipped" is issued by blkdeactivate as any error in calling
the external tool (e.g. unmounting or deactivating a device) causes
the device to be skipped and the blkdeactivate continues with the
next device in the tree.
Add new -e/--errors switch to display any error messages from
external tools.
Also, suppress any output given by the external tools and add
new -v/--verbose switch to display it including the verbose
output of the tools called (this will enable error reporting
as well).
Also add blkdeactivate -vv for even more debug (the script's debug).
---
WHATS_NEW | 3 +
man/blkdeactivate.8.in | 7 +++
scripts/blkdeactivate.sh.in | 102 ++++++++++++++++++++++++++++++++-----------
3 files changed, 86 insertions(+), 26 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 66cf20e..dd90726 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,8 @@
Version 2.02.101 -
===================================
+ Add blkdeactivate -v/--verbose for debug output from external tools used.
+ Add blkdeactivate -e/--errors for error messages from external tools used.
+ Suppress messages from external tools called in blkdeactivate by default.
Version 2.02.100 - 13th August 2013
===================================
diff --git a/man/blkdeactivate.8.in b/man/blkdeactivate.8.in
index 6e566c8..f6713f3 100644
--- a/man/blkdeactivate.8.in
+++ b/man/blkdeactivate.8.in
@@ -15,11 +15,18 @@ LVM volumes are handled directly using the \fIlvm\fP command.
Other device-mapper based devices are handled using the
\fIdmsetup\fP command.
.SH OPTIONS
+.IP "\fB\-e, \-\-errors\fP"
+Show errors reported from tools called by blkdeactivate.
+Without this option, any error messages from these external tools
+are suppressed and the blkdeactivate itself provides only a summary
+message about device being skipped or not.
.IP "\fB\-h, \-\-help\fP"
Display the help text.
.IP "\fB\-u, \-\-umount\fP"
Unmount a mounted device before trying to deactivate it.
Without this option used, a device that is mounted is not deactivated.
+.IP "\fB\-v, \-\-verbose\fP"
+Run in verbose mode.
.IP "\fB\-d, \-\-dmoption\fP \fIdm_options\fP"
Comma separated list of device-mapper specific options.
.IP "\fB\-l, \-\-lvmoption\fP \fIlvm_options\fP"
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index be00c24..48f9fe3 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -36,11 +36,20 @@ UMOUNT="/bin/umount"
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
+UMOUNT_OPTS=""
+DMSETUP_OPTS=""
+LVM_OPTS=""
+
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
LSBLK_READ="read -r devtype kname name mnt"
SORT_MNT="/bin/sort -r -u -k 4"
+# Do not show tool errors by default (only done/skipping summary
+# message provided by this script) and no verbose mode by default.
+ERRORS=0
+VERBOSE=0
+
# Do not unmount mounted devices by default.
DO_UMOUNT=0
@@ -72,6 +81,7 @@ declare -A SKIP_VG_LIST=()
declare -A SKIP_UMOUNT_LIST=(["/"]=1 ["/boot"]=1 \
["/lib"]=1 ["/lib64"]=1 \
["/bin"]=1 ["/sbin"]=1 \
+ ["/var"]=1 ["/var/log"]=1 \
["/usr"]=1 \
["/usr/lib"]=1 ["/usr/lib64"]=1 \
["/usr/sbin"]=1 ["/usr/bin"]=1)
@@ -87,10 +97,12 @@ usage() {
echo " If devices are specified, deactivate only supplied devices and their holders."
echo
echo " Options:"
+ echo " -e | --errors Show errors reported from tools"
echo " -h | --help Show this help message"
echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
echo " -u | --umount Unmount the device if mounted"
+ echo " -v | --verbose Verbose mode (also implies -e)"
echo
echo " Device specific options:"
echo " DM_OPTIONS:"
@@ -126,8 +138,13 @@ device_umount () {
test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" && return 0
if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then
- echo " UMOUNT: unmounting $name ($kname) mounted on $mnt"
- $UMOUNT "$(printf $mnt)" || add_device_to_skip_list
+ echo -n " [UMOUNT]: unmounting $name ($kname) mounted on $mnt... "
+ if eval $UMOUNT $UMOUNT_OPTS "$(printf $mnt)" $OUT $ERR; then
+ echo "done"
+ else
+ echo "skipping"
+ add_device_to_skip_list
+ fi
else
echo " [SKIP]: unmount of $name ($kname) mounted on $mnt"
add_device_to_skip_list
@@ -158,44 +175,56 @@ deactivate_dm () {
deactivate_holders "$DEV_DIR/mapper/$name" || return 1
- echo " DM: deactivating $devtype device $name ($kname)"
- $DMSETUP $DMSETUP_OPTS remove "$name" || add_device_to_skip_list
+ echo -n " [DM]: deactivating $devtype device $name ($kname)... "
+ if eval $DMSETUP $DMSETUP_OPTS remove "$name" $OUT $ERR; then
+ echo "done"
+ else
+ echo "skipping"
+ add_device_to_skip_list
+ fi
}
deactivate_lvm () {
local DM_VG_NAME; local DM_LV_NAME; local DM_LV_LAYER
- eval $($DMSETUP splitname --nameprefixes --noheadings --rows "$name" LVM)
+ eval $(eval $DMSETUP splitname --nameprefixes --noheadings --rows "$name" LVM $ERR)
test -b "$DEV_DIR/$DM_VG_NAME/$DM_LV_NAME" || return 0
test -z ${SKIP_VG_LIST["$DM_VG_NAME"]} || return 1
- # Deactivating only the LV specified
- test $LVM_DO_WHOLE_VG -eq 0 && {
+ if test $LVM_DO_WHOLE_VG -eq 0; then
+ # Deactivating only the LV specified
deactivate_holders "$DEV_DIR/$DM_VG_NAME/$DM_LV_NAME" || {
add_device_to_skip_list
return 1
}
- echo " LVM: deactivating Logical Volume $DM_VG_NAME/$DM_LV_NAME"
- $LVM lvchange --config "log{prefix=\"\"} $LVM_CONFIG" -aln $DM_VG_NAME/$DM_LV_NAME || {
+ echo -n " [LVM]: deactivating Logical Volume $DM_VG_NAME/$DM_LV_NAME... "
+ if eval $LVM lvchange $LVM_OPTS --config \'log{prefix=\"\"} $LVM_CONFIG\' -aln $DM_VG_NAME/$DM_LV_NAME $OUT $ERR; then
+ echo "done"
+ else
+ echo "skipping"
add_device_to_skip_list
- return 1
- }
- return 0
- }
-
- # Deactivating the whole VG the LV is part of
- lv_list=$($LVM vgs --config "$LVM_CONFIG" --noheadings --rows -o lv_name $DM_VG_NAME)
- for lv in $lv_list; do
- test -b "$DEV_DIR/$DM_VG_NAME/$lv" || continue
- deactivate_holders "$DEV_DIR/$DM_VG_NAME/$lv" || {
- add_vg_to_skip_list
- return 1
- }
- done
+ fi
- echo " LVM: deactivating Volume Group $DM_VG_NAME"
- $LVM vgchange --config "log{prefix=\" \"} $LVM_CONFIG" -aln $DM_VG_NAME || add_vg_to_skip_list
+ else
+ # Deactivating the whole VG the LV is part of
+ lv_list=$(eval $LVM vgs --config "$LVM_CONFIG" --noheadings --rows -o lv_name $DM_VG_NAME $ERR)
+ for lv in $lv_list; do
+ test -b "$DEV_DIR/$DM_VG_NAME/$lv" || continue
+ deactivate_holders "$DEV_DIR/$DM_VG_NAME/$lv" || {
+ add_vg_to_skip_list
+ return 1
+ }
+ done
+
+ echo -n " [LVM]: deactivating Volume Group $DM_VG_NAME... "
+ if eval $LVM vgchange $LVM_OPTS --config \'log{prefix=\" \"} $LVM_CONFIG\' -aln $DM_VG_NAME $OUT $ERR; then
+ echo "done"
+ else
+ echo "skipping"
+ add_vg_to_skip_list
+ fi
+ fi
}
deactivate () {
@@ -316,16 +345,37 @@ get_lvmopts() {
IFS=$ORIG_IFS
}
+set_env() {
+ if test "$ERRORS" -eq "1"; then
+ unset ERR
+ else
+ ERR="2>$DEV_DIR/null"
+ fi
+
+ if test "$VERBOSE" -eq "1"; then
+ unset OUT
+ UMOUNT_OPTS+="-v"
+ DMSETUP_OPTS+="-vvvv"
+ LVM_OPTS+="-vvvv"
+ else
+ OUT="1>$DEV_DIR/null"
+ fi
+}
+
while test $# -ne 0; do
case "$1" in
"") ;;
+ "-e"|"--errors") ERRORS=1 ;;
"-h"|"--help") usage ;;
"-d"|"--dmoption ") get_dmopts "$2" ; shift ;;
"-l"|"--lvmoption ") get_lvmopts "$2" ; shift ;;
"-u"|"--umount") DO_UMOUNT=1 ;;
+ "-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
+ "-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
*) break ;;
esac
shift
done
+set_env
deactivate_all "$@"
10 years, 8 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32148369d12750...
Commit: 32148369d12750dbf85cfd5c21a8bc7f9e6b5ec5
Parent: 297907899c389fef074eeb56fd0d7b60d66dbb35
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 13 11:54:48 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 13 11:54:48 2013 +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 c7d4f06..4aa9105 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.100(2)-git (2013-08-13)
+2.02.101(2)-git (2013-08-13)
diff --git a/VERSION_DM b/VERSION_DM
index a11b7cd..2fe4e25 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.79-git (2013-08-13)
+1.02.80-git (2013-08-13)
diff --git a/WHATS_NEW b/WHATS_NEW
index 20331c3..66cf20e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.101 -
+===================================
+
Version 2.02.100 - 13th August 2013
===================================
Fix inability to remove a VG's cluster flag if it contains a mirror.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 0ef1755..67b7d46 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.80 -
+==================================
+
Version 1.02.79 - 13th August 2013
==================================
Create dmeventd timeout threads as "detached" so exit status is freed.
10 years, 8 months
master - release 2.02.100
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=297907899c389f...
Commit: 297907899c389fef074eeb56fd0d7b60d66dbb35
Parent: abc89422af75fa9e20d24285d1366e4631cb8748
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 13 11:29:21 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 13 11:29:21 2013 +0100
release 2.02.100
84 files changed, 1540 insertions(+), 442 deletions(-)
Mostly bug fixes this time.
Also note:
md raid replaces dm mirroring as the default implementation.
Can call out to thin_repair to fix thin metadata.
Improved clvmd error detection/debugging information.
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 9 +++++----
WHATS_NEW_DM | 4 ++--
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/VERSION b/VERSION
index 1716ee6..c7d4f06 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.100(2)-git (2013-07-24)
+2.02.100(2)-git (2013-08-13)
diff --git a/VERSION_DM b/VERSION_DM
index 067a488..a11b7cd 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.79-git (2013-07-24)
+1.02.79-git (2013-08-13)
diff --git a/WHATS_NEW b/WHATS_NEW
index 68d4679..20331c3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,17 +1,18 @@
-Version 2.02.100 -
-================================
+Version 2.02.100 - 13th August 2013
+===================================
Fix inability to remove a VG's cluster flag if it contains a mirror.
Suppress arg: prefix in log_sys_error macro when arg is empty string.
Fix bug making lvchange unable to change recovery rate for RAID.
Prohibit conversion of thin pool to external origin.
Workaround gcc v4.8 -O2 bug causing failures if config/checks=1 (32bit arch).
Verify clvmd message validity before processing and log error if incorrect.
- Fix issue preventing PV creation on mirror LVs
+ When creating PV on existing LV don't forbid reserved LV names on LVs below.
+ Split out device_is_suspended_or_blocking from device_is_usable.
When converting mirrors, default segtype should be the same unless specified.
Make "raid1" the default mirror segment type.
Fix clogd descriptor leak when daemonizing.
Fix clvmd descriptor leak on restart.
- Add pipe_open/close() to replace less secure popen() glibc call.
+ Add pipe_open/close() to use instead of less efficient/secure popen().
Fix metadata area offset/size overflow if it's >= 4g and while using lvmetad.
Inherit and apply any profile attached to a VG if creating new thin pool.
Add initial support thin pool lvconvert --repair.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 43eb4d8..0ef1755 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.79 -
-================================
+Version 1.02.79 - 13th August 2013
+==================================
Create dmeventd timeout threads as "detached" so exit status is freed.
Add DM_ABORT_ON_INTERNAL_ERRORS env var support to abort on internal errors.
10 years, 8 months