| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Since lvm2_init() effectively detects memory leaks
allocate mempool after this initialization
(so it's not reported as leak).
|
| |
|
| |
|
|
|
|
| |
Avoid using 'static' variable within threaded environmnent for debuging.
|
| |
|
|
|
|
|
| |
Drop unused pthread canceling as well as DEBUG printing in signal
handler.
|
|
|
|
|
|
|
|
|
|
| |
There are reports of unexplained ioctl failures when using dmeventd.
An explanation might be that the wrong value of errno is being used.
Change libdevmapper to store an errno set by from dm ioctl() directly
and provide it to the caller through a new dm_task_get_errno() function.
[Replaced f9510548667754d9209b232348ccd2d806c0f1d8]
|
|
|
|
|
| |
When LVM_LOG_FILE_EPOCH is set, route lvm command debug message
to lvm.conf log file instead of syslog.
|
| |
|
|
|
|
| |
Only with -DDEBUG.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
The status of threads in _thread_registry is always DM_THREAD_RUNNING
(zero).
DM_EVENT_REGISTRATION_PENDING is never stored in thread->events.
|
|
|
|
|
|
| |
Do not call read when select return -1 && EINTR.
Also check for return valuer from read() and
abort write function when unexpected error happens.
|
| |
|
|
|
|
|
| |
Drop header inclusion - this file is already included.
Shorten code.
|
|
|
|
| |
Always pass fully initialized timeval struct to select.
|
|
|
|
|
|
| |
Since we already check every characted in the message,
skip extra callback to strlen, and do the implicit
message length checking.
|
|
|
|
| |
Size is not used when msg->data is NULL.
|
|
|
|
|
| |
Let the compiler resolve cmd lookup and leave it to optimize it as it
needs.
|
|
|
|
|
|
|
| |
Switch to allocate buffer from heap, since it might be potentially
bigger when extremaly large set of volumes would be monitored.
In case of allocation failure send ENOMEM message.
Also implicitelly ignore msg->size when msg->data is NULL.
|
|
|
|
| |
Don't change next_time, when thread is already registered.
|
|
|
|
|
|
| |
Use directly dm_asprintf() to allocate buffer with message,
and properly detect failing on replacement of snprintf()
which also returns -1 on error.
|
| |
|
|
|
|
| |
Since we always know the string length, use simplier memcpy.
|
|
|
|
| |
Just simplify the function.
|
|
|
|
|
|
| |
Keep lvm2cmd interface hidden inside dmeventd_lvm
and use regular 1/0 return codes, this we may
avoid using lvm2cmd.h in other lvm2 plugins.
|
|
|
|
| |
Just cleanup things
|
|
|
|
| |
Zalloc mem is already zeroed.
|
| |
|
|
|
|
|
| |
Avoid dependency on implicit inclusion of stdarg.h with
libdevmapper.h.
|
|
|
|
| |
Daemon lib is linked into lvm2cmd library.
|
|
|
|
| |
Before calling select, always set all struct members of timeout.
|
|
|
|
|
| |
Move check for _thread_registry list size behind mutex.
Use alloca() instead of buffer[count] (they are the same anyway)
|
|
|
|
|
| |
Kernel supports upto 1M (20bit) minors.
TODO: convert to hash to reduce memory requirements
|
|
|
|
| |
More use of libdevmapper macro
|
|
|
|
| |
It's ok to free(NULL).
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Instead of doing multiple different calls, select
stream within a condition.
Replace fprintf with fputc for '\n'
|
|
|
|
| |
Improve readbility of code.
|
|
|
|
|
|
|
|
|
| |
When the last entry in the timeout queue is unregistered,
wakeup sleeping condition, so the thread is deleted earlier.
So the thread resource is release earlier.
Also when monitored with tools like valgrind this eliminites reported
leak.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Individual events are handled through separate threads,
so once we have more then a single thread in this eventwait
sleeping, we got race on the dm_log setting, since
if one event is timeout out on alarm, while another is still waiting,
then dm log has been restored to NULL and the next sigalarm
has been reported as error.
Fix it by introducing counter which is protected via mutex,
and only when the last event is released, logging is restored.
TODO: libdm seems to have some static vars which may audit
for this type of use.
|
| |
|
| |
|
|
|
|
|
| |
Since we use unlink + _exit now on dmeventd DIE message, we can
check the pidfile existence to see whether the dmeventd has finished.
|
|
|
|
| |
Just a cleaner way to die.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The DM_EVENT_GET_PARAMETERS requests the parameters under which
the running dmeventd is run and the it sends them to caller.
The parameters sent:
- the pid of the running dmeventd
- foreground state
- exec_method (currently either "direct" or "systemd")
The exact message sent back:
pid=<pid> daemon=<no/yes> exec_method=<direct/systemd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Trying to restart dmeventd as a reload action is causing problems
under systemd environment. The systemd loses track of new dmeventd
this way. See also https://bugzilla.redhat.com/show_bug.cgi?id=1060134
for more info.
We need to call dmeventd -R directly instead of "systemctl reload dm-event.service"
that was used before (the reload is aimed at configuration reload anyway,
not stateful restart of the daemon - we did this before just because
there's no ExecRestart in systemd and there's only ExecStart and
ExecStop with which we'd lose the state).
Also, use ExecStart="dmeventd -f" to run dmeventd in foreground
(and let's rely on systemd to daemonize it) and change the
service type from "forking" to "simple".
|