master - lv: fix typedef
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d0cb0611e5e68...
Commit: 3d0cb0611e5e68fc4d865102f8339552a907ff4b
Parent: 4741e449e66d19a0285ee1772e0d40da2fd8d5c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 3 16:02:43 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 16:02:43 2013 +0200
lv: fix typedef
Since older gcc is not accepting duplication of same typedef,
stay with predeclared enum type.
---
lib/metadata/lv.c | 2 +-
lib/metadata/lv.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 283b8c4..69b13fa 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -705,7 +705,7 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
}
int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
- activation_change_t activate)
+ enum activation_change activate)
{
if (activate == CHANGE_AN) {
log_verbose("Deactivating logical volume \"%s\"", lv->name);
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index ed0d745..8e771a1 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -21,7 +21,6 @@ struct dm_list;
struct lv_segment;
struct replicator_device;
enum activation_change;
-typedef enum activation_change activation_change_t;
struct logical_volume {
union lvid lvid;
@@ -88,7 +87,7 @@ int lv_set_creation(struct logical_volume *lv,
const char *hostname, uint64_t timestamp);
const char *lv_layer(const struct logical_volume *lv);
int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
- activation_change_t activate);
+ enum activation_change activate);
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
const struct logical_volume *lv_lock_holder(const struct logical_volume *lv);
#endif /* _LVM_LV_H */
10 years, 11 months
master - test: wait for pid removal
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4741e449e66d19...
Commit: 4741e449e66d19a0285ee1772e0d40da2fd8d5c0
Parent: f7d55118765dade557fea9e39cbe98d94aebbca3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 3 15:21:11 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:44:15 2013 +0200
test: wait for pid removal
---
test/shell/clvmd-restart.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/shell/clvmd-restart.sh b/test/shell/clvmd-restart.sh
index e88e187..b288ad8 100644
--- a/test/shell/clvmd-restart.sh
+++ b/test/shell/clvmd-restart.sh
@@ -55,6 +55,7 @@ vgchange -an $vg
# Test what happens after 'reboot'
kill "$LOCAL_CLVMD"
+while test -e "/var/run/clvmd.pid"; do echo -n .; sleep .1; done # wait for the pid removal
aux prepare_clvmd
vgchange -ay $vg
10 years, 11 months
master - cleanup: shift line down
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f7d55118765dad...
Commit: f7d55118765dade557fea9e39cbe98d94aebbca3
Parent: deb3c93a192c5ea03434ea11d33dff571462edc3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 2 18:05:42 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:44:15 2013 +0200
cleanup: shift line down
For better look of lvs -o help
Though we may need to decide whether to use 'lv_active' or some other
name.
---
lib/report/columns.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index e73d20d..201b3c4 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -82,7 +82,6 @@ FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, m
FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
FIELD(LVS, lv, NUM, "Mismatches", lvid, 10, mismatch_count, mismatches, "For RAID, number of mismatches found or repaired.", 0)
FIELD(LVS, lv, STR, "SyncAction", lvid, 10, sync_action, syncaction, "For RAID, the current synchronization action being performed.", 0)
-FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
FIELD(LVS, lv, NUM, "WBehind", lvid, 7, write_behind, writebehind, "For RAID1, the number of outstanding writes allowed to writemostly devices.", 0)
FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
@@ -90,6 +89,7 @@ FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV hold
FIELD(LVS, lv, STR, "Data", lvid, 4, datalv, data_lv, "For thin pools, the LV holding the associated data.", 0)
FIELD(LVS, lv, STR, "Meta", lvid, 4, metadatalv, metadata_lv, "For thin pools, the LV holding the associated metadata.", 0)
FIELD(LVS, lv, STR, "Pool", lvid, 4, poollv, pool_lv, "For thin volumes, the thin pool LV for this volume.", 0)
+FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0)
FIELD(LVS, lv, STR, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0)
FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0)
10 years, 11 months
master - cleanup: simplify
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=deb3c93a192c5e...
Commit: deb3c93a192c5ea03434ea11d33dff571462edc3
Parent: 986a50e4a1c017cc655bbcce45ffa4444386678b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 29 12:33:38 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:44:14 2013 +0200
cleanup: simplify
Use simplier sprintf.
---
tools/reporter.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 3db8b83..2744fcd 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -301,9 +301,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
log_error("options string allocation failed");
return ECMD_FAILED;
}
- strcpy(str, options);
- strcat(str, ",");
- strcat(str, opts + 1);
+ (void) sprintf(str, "%s,%s", options, opts + 1);
options = str;
} else
options = opts;
10 years, 11 months
master - cleanup: improve previous patch
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=986a50e4a1c017...
Commit: 986a50e4a1c017cc655bbcce45ffa4444386678b
Parent: 2d3700ba42e156aa8b6e2819736cab6866ea56ce
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 29 13:50:26 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:44:14 2013 +0200
cleanup: improve previous patch
Make the test earlier, before any dereference of 'argv' pointer.
---
tools/lvmcmdline.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 60aa4d9..c03e9ef 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1487,6 +1487,9 @@ int lvm2_main(int argc, char **argv)
int ret, alias = 0;
struct cmd_context *cmd;
+ if (!argv)
+ return -1;
+
base = last_path_component(argv[0]);
if (strcmp(base, "lvm") && strcmp(base, "lvm.static") &&
strcmp(base, "initrd-lvm"))
@@ -1499,7 +1502,7 @@ int lvm2_main(int argc, char **argv)
return -1;
if (is_static() && strcmp(base, "lvm.static") &&
- path_exists(LVM_SHARED_PATH) && argv &&
+ path_exists(LVM_SHARED_PATH) &&
!getenv("LVM_DID_EXEC")) {
if (setenv("LVM_DID_EXEC", base, 1))
log_sys_error("setenv", "LVM_DID_EXEC");
10 years, 11 months
master - report: improve reporting of active state
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2d3700ba42e156...
Commit: 2d3700ba42e156aa8b6e2819736cab6866ea56ce
Parent: d2d71330c308230065dbc865e4552a9a62aad269
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu May 2 18:06:50 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:43:52 2013 +0200
report: improve reporting of active state
For reporting stacked or joined devices properly in cluster,
we need to report their activation state according the lock,
which activated this device tree.
This is getting a bit complex - current code tries simple approach -
For snapshot - return status for origin.
For thin pool - return status of the first known active thin volume.
For the rest of them - try to use dependency list of LVs and skip
known execptions. This should be able to recursively deduce top level
device for given LV.
(in release fix)
---
lib/metadata/lv.c | 40 +++++++++++++++++++++++++++++++++++++++-
lib/metadata/lv.h | 1 +
2 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 41de7a5..283b8c4 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -745,6 +745,12 @@ char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
const char *s;
+ if (vg_is_clustered(lv->vg)) {
+ //const struct logical_volume *lvo = lv;
+ lv = lv_lock_holder(lv);
+ //log_debug("Holder for %s => %s.", lvo->name, lv->name);
+ }
+
if (!lv_is_active(lv))
s = ""; /* not active */
else if (!vg_is_clustered(lv->vg))
@@ -755,7 +761,39 @@ char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
"local exclusive" : "remote exclusive";
else /* locally active */
s = lv_is_active_but_not_locally(lv) ?
- "remotely" : "locally";
+ "remotely" : "locally";
return dm_pool_strdup(mem, s);
}
+
+/* For given LV find recursively the LV which holds lock for it */
+const struct logical_volume *lv_lock_holder(const struct logical_volume *lv)
+{
+ const struct seg_list *sl;
+
+ if (lv_is_cow(lv))
+ return lv_lock_holder(origin_from_cow(lv));
+
+ if (lv_is_thin_pool(lv))
+ /* Find any active LV from the pool */
+ dm_list_iterate_items(sl, &lv->segs_using_this_lv)
+ if (lv_is_active(sl->seg->lv)) {
+ log_debug("Thin volume \"%s\" is active.", sl->seg->lv->name);
+ return sl->seg->lv;
+ }
+
+ /* For other types, by default look for the first user */
+ dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
+ /* FIXME: complete this exception list */
+ if (lv_is_thin_volume(lv) &&
+ lv_is_thin_volume(sl->seg->lv) &&
+ first_seg(lv)->pool_lv == sl->seg->pool_lv)
+ continue; /* Skip thin snaphost */
+ if (lv_is_external_origin(lv) &&
+ lv_is_thin_volume(sl->seg->lv))
+ continue; /* Skip external origin */
+ return lv_lock_holder(sl->seg->lv);
+ }
+
+ return lv;
+}
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index bac8bc2..ed0d745 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -90,4 +90,5 @@ const char *lv_layer(const struct logical_volume *lv);
int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
activation_change_t activate);
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
+const struct logical_volume *lv_lock_holder(const struct logical_volume *lv);
#endif /* _LVM_LV_H */
10 years, 11 months
master - lv: add lv_active_change
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d2d71330c30823...
Commit: d2d71330c308230065dbc865e4552a9a62aad269
Parent: dacc340cc89e9be5cb88986a444466edb3a06e52
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 29 14:04:38 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:43:19 2013 +0200
lv: add lv_active_change
Make a separate /lib function for the change of activation state
of the LV.
(in release update)
---
lib/metadata/lv.c | 37 +++++++++++++++++++++++++++++++++++++
lib/metadata/lv.h | 6 +++++-
tools/toollib.c | 37 ++++---------------------------------
3 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 3dbdb38..41de7a5 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -704,6 +704,43 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
return dm_pool_strdup(mem, lv->hostname ? : "");
}
+int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
+ activation_change_t activate)
+{
+ if (activate == CHANGE_AN) {
+ log_verbose("Deactivating logical volume \"%s\"", lv->name);
+ if (!deactivate_lv(cmd, lv))
+ return_0;
+ } else if ((activate == CHANGE_AE) ||
+ lv_is_origin(lv) ||
+ lv_is_thin_type(lv)) {
+ if (activate == CHANGE_ALN) {
+ /* origin or thin, all others have _AE */
+ /* other types of activation are implicitly exclusive */
+ /* Note: the order of tests is mandatory */
+ log_error("Cannot deactivate \"%s\" locally.", lv->name);
+ return 0;
+ }
+ log_verbose("Activating logical volume \"%s\" exclusively.", lv->name);
+ if (!activate_lv_excl(cmd, lv))
+ return_0;
+ } else if (activate == CHANGE_ALN) {
+ log_verbose("Deactivating logical volume \"%s\" locally.", lv->name);
+ if (!deactivate_lv_local(cmd, lv))
+ return_0;
+ } else if ((activate == CHANGE_ALY) || (activate == CHANGE_AAY)) {
+ log_verbose("Activating logical volume \"%s\" locally.", lv->name);
+ if (!activate_lv_local(cmd, lv))
+ return_0;
+ } else { /* CHANGE_AY */
+ log_verbose("Activating logical volume \"%s\".", lv->name);
+ if (!activate_lv(cmd, lv))
+ return_0;
+ }
+
+ return 1;
+}
+
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
const char *s;
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 9450f8d..bac8bc2 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -20,6 +20,8 @@ struct volume_group;
struct dm_list;
struct lv_segment;
struct replicator_device;
+enum activation_change;
+typedef enum activation_change activation_change_t;
struct logical_volume {
union lvid lvid;
@@ -85,5 +87,7 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv);
int lv_set_creation(struct logical_volume *lv,
const char *hostname, uint64_t timestamp);
const char *lv_layer(const struct logical_volume *lv);
+int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
+ activation_change_t activate);
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
#endif /* _LVM_LV_H */
diff --git a/tools/toollib.c b/tools/toollib.c
index 950ca33..e9be968 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1300,41 +1300,12 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
activation_change_t activate)
{
- if (activate == CHANGE_AN) {
- log_verbose("Deactivating logical volume \"%s\"", lv->name);
- if (!deactivate_lv(cmd, lv))
- return_0;
- return 1;
- } else if ((activate == CHANGE_AE) ||
- lv_is_origin(lv) ||
- lv_is_thin_type(lv)) {
- if (activate == CHANGE_ALN) {
- /* origin or thin, all others have _AE */
- /* other types of activation are implicitly exclusive */
- /* Note: the order of tests is mandatory */
- log_error("Cannot deactivate \"%s\" locally.", lv->name);
- return 0;
- }
- log_verbose("Activating logical volume \"%s\" exclusively.", lv->name);
- if (!activate_lv_excl(cmd, lv))
- return_0;
- } else if (activate == CHANGE_ALN) {
- log_verbose("Deactivating logical volume \"%s\" locally.", lv->name);
- if (!deactivate_lv_local(cmd, lv))
- return_0;
- return 1;
- } else if ((activate == CHANGE_ALY) || (activate == CHANGE_AAY)) {
- log_verbose("Activating logical volume \"%s\" locally.", lv->name);
- if (!activate_lv_local(cmd, lv))
- return_0;
- } else { /* CHANGE_AY */
- log_verbose("Activating logical volume \"%s\".", lv->name);
- if (!activate_lv(cmd, lv))
- return_0;
- }
+ if (!lv_active_change(cmd, lv, activate))
+ return_0;
- /* CHANGE_AN/ALN is not getting here */
if (background_polling() &&
+ (activate != CHANGE_AN) &&
+ (activate != CHANGE_ALN) &&
(lv->status & (PVMOVE|CONVERTING|MERGING)))
lv_spawn_background_polling(cmd, lv);
10 years, 11 months
master - pvscan: missing test for id_read_format
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dacc340cc89e9b...
Commit: dacc340cc89e9be5cb88986a444466edb3a06e52
Parent: f319a61e9c374bd3277deba90216f67fdcb505e9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 29 12:34:50 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:42:44 2013 +0200
pvscan: missing test for id_read_format
(in release fix)
---
tools/pvscan.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index ab58c5f..7c55faa 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -103,7 +103,9 @@ static int _auto_activation_handler(struct cmd_context *cmd,
if (partial)
return 1;
- id_read_format(&vgid_raw, vgid);
+ if (!id_read_format(&vgid_raw, vgid))
+ return_0;
+
/* NB. This is safe because we know lvmetad is running and we won't hit
* disk. */
if (!(vg = vg_read_internal(cmd, NULL, (const char *) &vgid_raw, 0, &consistent)))
10 years, 11 months
master - config: fix bitfield for section
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f319a61e9c374b...
Commit: f319a61e9c374bd3277deba90216f67fdcb505e9
Parent: 2ac217d408470dcecb69b83d9cbf7a254747fa5b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 29 12:38:56 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 3 15:42:44 2013 +0200
config: fix bitfield for section
Since the cfg_def_type_t is used as bitfield in some tests,
use bitshifting to create valid bit sequence.
(in release fix)
---
lib/config/config.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/config/config.h b/lib/config/config.h
index 7e40420..155d69a 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -34,12 +34,12 @@ struct cmd_context;
/* configuration definition item type (for item's accepted types) */
typedef enum {
- CFG_TYPE_SECTION = 0, /* section */
- CFG_TYPE_ARRAY = 1, /* setting */
- CFG_TYPE_BOOL = 2, /* setting */
- CFG_TYPE_INT = 4, /* setting */
- CFG_TYPE_FLOAT = 8, /* setting */
- CFG_TYPE_STRING = 16 /* setting */
+ CFG_TYPE_SECTION = 1 << 0, /* section */
+ CFG_TYPE_ARRAY = 1 << 1, /* setting */
+ CFG_TYPE_BOOL = 1 << 2, /* setting */
+ CFG_TYPE_INT = 1 << 3, /* setting */
+ CFG_TYPE_FLOAT = 1 << 4, /* setting */
+ CFG_TYPE_STRING = 1 << 5, /* setting */
} cfg_def_type_t;
/* configuration definition item value (for item's default value) */
10 years, 11 months
master - udev: fire pvscan --cache properly on CHANGE event for MD devices
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2ac217d408470d...
Commit: 2ac217d408470dcecb69b83d9cbf7a254747fa5b
Parent: baf9ef2047675279c72f27abeb2c328f5de2c78d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri May 3 13:20:07 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri May 3 13:55:53 2013 +0200
udev: fire pvscan --cache properly on CHANGE event for MD devices
Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 restricted the
situations at which the LVM autoactivation fires - only on ADD
event for devices other than DM. However, this caused a problem
for MD devices...
MD devices are activated in a very similar way as DM devices:
the MD dev is created on first appeareance of MD array member
(ADD event) and stays *inactive* until the array is complete.
Just then the MD dev turns to active state and this is reported
to userspace by CHANGE event.
Unfortunately, we can't differentiate between the CHANGE event
coming from udev trigger/WATCH rule and CHANGE event coming from
the transition to active state - MD would need to add similar logic
we already use to detect this in DM world. For now, we just have
to enable pvscan --cache on *all* CHANGE events for MD so the
autoactivation of the LVM volumes on top of MD works.
A downside of this is that a spurious CHANGE event for MD dev
can cause the LVM volumes on top of it to be automatically activated.
However, one should not open/change the device underneath until
the device above in the stack is removed! So this situation should
only happen if one opens the MD dev for read-write by mistake
(and hence firing the CHANGE event because of the WATCH udev rule),
or if calling udev trigger manually for the MD dev.
(No WHATS_NEW here as this fixes the commit mentioned
above and which has not been released yet.)
---
udev/69-dm-lvm-metad.rules.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index 66c58b3..a0e48a1 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -21,6 +21,7 @@ SUBSYSTEM!="block", GOTO="lvm_end"
ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member", GOTO="lvm_end"
ACTION=="remove", GOTO="lvm_scan"
+ACTION=="change", KERNEL=="md[0-9]*", GOTO="lvm_scan"
# If the PV is not a dm device, scan only after device addition (ADD event)
KERNEL!="dm-[0-9]*", ACTION!="add", GOTO="lvm_end"
10 years, 11 months