master - dmeventd: Include shutdown threads in responses.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=89f635a0759dd9499155b4bf6bf8c07090444ade Commit: 89f635a0759dd9499155b4bf6bf8c07090444ade Parent: 6b25faa218fc5cd1601e5418ce1481400386ecce Author: Alasdair G Kergon <[email protected]> AuthorDate: Tue Nov 4 16:58:14 2014 +0000 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Tue Nov 4 16:58:14 2014 +0000
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.
--- WHATS_NEW | 1 + daemons/dmeventd/dmeventd.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
@@ -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.
daemons/dmeventd/dmeventd.c +12 -0
@@ -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;