summaryrefslogtreecommitdiffstats
path: root/lib/activate
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2011-06-17 14:50:53 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2011-06-17 14:50:53 +0000
commit418663b61c88b7a920ce22c66816204b84f732bb (patch)
tree14e346d205d50705dc3dc8fd8a90eceedaab9752 /lib/activate
parentbebe60b70c82ed23740726d817219d287a1ebb62 (diff)
downloadlvm2-418663b61c88b7a920ce22c66816204b84f732bb.tar.gz
lvm2-418663b61c88b7a920ce22c66816204b84f732bb.tar.xz
lvm2-418663b61c88b7a920ce22c66816204b84f732bb.zip
Disable udev fallback by default and add activation/udev_fallback to lvm.conf.
We've used udev fallback code till now to check whether udev created/removed the entries in /dev correctly and if not, a repair was done (giving a warning messagea about that). This patch adds a possibility to enable this additional check and subsequent fallback only when required (debugging purposes mostly) and trust udev completely. So let's disable the fallback code by default and add a new configuration option "activation/udev_fallback". (The original code for creating the nodes will still be used in case the device directory that is set in lvm.conf differs from the one that udev uses and also when activation/udev_rules is set to 0 - otherwise we would end up with no nodes/symlinks at all)
Diffstat (limited to 'lib/activate')
-rw-r--r--lib/activate/dev_manager.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 98f973ea..209aff7b 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -874,6 +874,13 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *l
uint16_t udev_flags = 0;
/*
+ * Instruct also libdevmapper to disable udev
+ * fallback in accordance to LVM2 settings.
+ */
+ if (!dm->cmd->current_settings.udev_fallback)
+ udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
+
+ /*
* Is this top-level and visible device?
* If not, create just the /dev/mapper content.
*/
@@ -1584,6 +1591,10 @@ static int _create_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
const char *name;
int r = 1;
+ /* Nothing to do if udev fallback is disabled. */
+ if (!dm->cmd->current_settings.udev_fallback)
+ return 1;
+
while ((child = dm_tree_next_child(&handle, root, 0))) {
if (!(lvlayer = dm_tree_node_get_context(child)))
continue;
@@ -1626,6 +1637,10 @@ static int _remove_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
char *vgname, *lvname, *layer;
int r = 1;
+ /* Nothing to do if udev fallback is disabled. */
+ if (!dm->cmd->current_settings.udev_fallback)
+ return 1;
+
while ((child = dm_tree_next_child(&handle, root, 0))) {
if (!dm_split_lvm_name(dm->mem, dm_tree_node_get_name(child), &vgname, &lvname, &layer)) {
r = 0;