1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2015-10-21 20:52:29 +02:00
parent efc76ca33d
commit 02eb000f51
2 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.110 -
======================================
Dmeventd closes control device when no device is monitored.
Thin plugin for dmeventd improved percentage usage.
Snapshot plugin for dmeventd improved percentage usage.
Add dm_hold_control_dev to allow holding of control device open.

View File

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