1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-08 08:58:50 +03:00

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.
This commit is contained in:
Alasdair G Kergon 2014-11-04 16:58:14 +00:00
parent 6b25faa218
commit 89f635a075
2 changed files with 13 additions and 0 deletions

View File

@ -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.

View File

@ -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;