summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2014-11-04 16:58:14 +0000
committerAlasdair G Kergon <agk@redhat.com>2014-11-04 16:58:14 +0000
commit89f635a0759dd9499155b4bf6bf8c07090444ade (patch)
tree0c363716b336b54c98c6f7db28628a7580d0844a
parent6b25faa218fc5cd1601e5418ce1481400386ecce (diff)
downloadlvm2-89f635a0759dd9499155b4bf6bf8c07090444ade.tar.gz
dmeventd: Include shutdown threads in responses.
When responding to DM_EVENT_CMD_GET_REGISTERED_DEVICE no longer ignore threads that have already been unregistered but which are still present. This means the caller can unregister a device and poll dmeventd to ensure the monitoring thread has gone away before removing the device. If a device was registered and unregistered in quick succession and then removed, WAITEVENT could run in parallel with the REMOVE. Threads are moved to the _thread_registry_unused list when they are unregistered.
-rw-r--r--WHATS_NEW1
-rw-r--r--daemons/dmeventd/dmeventd.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 3914392f4..6c76fa97c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Include threads being shutdown in dmeventd device registration responses.
Inital support for external users of thin pools based on transaction_id.
Report some basic percentage info for cache pools.
Introduce size_mb_arg_with_percent() for advanced size arg reading.
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index faae5ba78..1b950cfe7 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1177,6 +1177,18 @@ static int _get_registered_dev(struct message_data *message_data, int next)
if (hit && !next)
goto reg;
+ /*
+ * If we didn't get a match, try the threads waiting to be deleted.
+ * FIXME Do something similar if 'next' is set.
+ */
+ if (!hit && !next)
+ dm_list_iterate_items(thread, &_thread_registry_unused)
+ if (_want_registered_device(message_data->dso_name,
+ message_data->device_uuid, thread)) {
+ hit = thread;
+ goto reg;
+ }
+
if (!hit)
goto out;