summaryrefslogtreecommitdiff
path: root/daemons
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-10-21 20:52:29 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-10-22 22:34:27 +0200
commit02eb000f5145aa60578b4591053bff9a797e64cc (patch)
treec4d2b3fabbc955802e65ad34ced1d36a31729f0e /daemons
parentefc76ca33dec99e3b0499ef28fb9236815ad2258 (diff)
downloadlvm2-02eb000f5145aa60578b4591053bff9a797e64cc.tar.gz
dmeventd: use dm_hold_control_dev
Need here to keep control device opened while there is 'any' dso plugin loaded - otherwise there would a race closing controlfd inside lvm2 plugin while some other monitoring thread would tried to execute another WAITEVENT task.
Diffstat (limited to 'daemons')
-rw-r--r--daemons/dmeventd/dmeventd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 69fe3930c..885aa9de4 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -282,6 +282,13 @@ static void _lib_put(struct dso_data *data)
dlclose(data->dso_handle);
UNLINK_DSO(data);
_free_dso_data(data);
+
+ /* Close control device if there is no plugin in-use */
+ if (dm_list_empty(&_dso_registry)) {
+ DEBUGLOG("Unholding control device.");
+ dm_hold_control_dev(0);
+ dm_lib_release();
+ }
}
}
@@ -344,6 +351,12 @@ static struct dso_data *_load_dso(struct message_data *data)
goto_bad;
}
+ /* Keep control device open until last user closes */
+ if (dm_list_empty(&_dso_registry)) {
+ DEBUGLOG("Holding control device open.");
+ dm_hold_control_dev(1);
+ }
+
/*
* Keep handle to close the library once
* we've got no references to it any more.