From 53dd32f41dc254555b5ffe56c70c15a2a86a0d46 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Wed, 15 Jun 2011 13:29:48 +0000 Subject: [PATCH] Add proper udev library context initialization and finalization to liblvm. This was missing in liblvm and it caused all udev-related operations to not take effect when using liblvm, e.g. obtaining the list of devices from udev db instead of scanning the whole /dev which also recreated the .cache as a side effect. This was also the case with udisks-lvm-pv-export prober which is run from within udev rules whenever the CHANGE event is fired. --- WHATS_NEW | 1 + liblvm/lvm_base.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 2e1bc64ab..e8b12c6c9 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.86 - ================================= + Add proper udev library context initialization and finalization to liblvm. Fix last snapshot removal to avoid table reload while a device is suspended. Use dm_get_suspended_counter in replacement critical_section logic. Downgrade critical_section errors to debug level until it is moved to libdm. diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c index f44b786cb..998444897 100644 --- a/liblvm/lvm_base.c +++ b/liblvm/lvm_base.c @@ -31,6 +31,9 @@ lvm_t lvm_init(const char *system_dir) /* FIXME: logging bound to handle */ + if (!udev_init_library_context()) + stack; + /* create context */ /* FIXME: split create_toolcontext */ /* FIXME: make all globals configurable */ @@ -69,6 +72,7 @@ lvm_t lvm_init(const char *system_dir) void lvm_quit(lvm_t libh) { destroy_toolcontext((struct cmd_context *)libh); + udev_fin_library_context(); } int lvm_config_reload(lvm_t libh)