1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-11-30 04:23:48 +03:00
Files
lvm2/man/dmeventd.8_main
Zdenek Kabelac d9063048cb dmeventd: add thread grace period for monitoring
Add thread reuse mechanism to reduce overhead when devices are frequently
registered/unregistered by introducing a configurable grace period where
monitoring threads wait for potential reuse before termination.

Key changes:
- Add -g option to configure grace period (0-300 seconds, default: 10s)
- Introduce DM_THREAD_GRACE_PERIOD state for threads awaiting reuse
- Implement thread reuse for matching device/dso combinations
- Add pthread condition variables and mutexes for grace period synchronization
- Add thread usage counter and enhanced debug logging
- Add _reset_pending_signal() to handle SIGALRM cleanup on thread reuse
- Refactor _monitor_thread() to support grace period workflow
- Update timeout thread to skip non-running threads
- Simplify thin plugin logging

This optimization significantly reduces thread creation/destruction overhead
in scenarios with rapid device registration/unregistration cycles, such as
creating snapshots of thin volumes, while maintaining proper cleanup and
thread safety.
2025-07-31 00:46:38 +02:00

233 lines
6.4 KiB
Plaintext

.TH DMEVENTD 8 "DM TOOLS #VERSION#" "Red Hat, Inc." \" -*- nroff -*-
.
.de NSY
. ie t .SY \\$1
. el \{\
. ie \\n(.$>1 \{\
. PD 0
. TP \\w'\\$1\ 'u
. \}
. el .TP
. B \\$1
. nh
. na
. \}
..
.
.SH NAME
.
dmeventd \(em Device-mapper event daemon
.
.SH SYNOPSIS
.
.NSY dmeventd 1
.RB [ -d
.RB [ -d
.RB [ -d ]]]
.RB [ -e\ \c
.IR exit_on_path ]
.RB [ -f ]
.RB [ -g\ \c
.IR seconds ]
.RB [ -h ]
.RB [ -i ]
.RB [ -l ]
.RB [ -R ]
.RB [ -V ]
.RB [ -? ]
.
.PD
.ad
.hy
.
.SH DESCRIPTION
.
dmeventd is the event monitoring daemon for device-mapper devices.
Library plugins can register and carry out actions triggered when
particular events occur.
.
.SH OPTIONS
.
.TP
.B -d
Repeat from 1 to 3 times
.RB ( -d ,
.BR -dd ,
.BR -ddd )
to increase the detail of
debug messages sent to syslog.
Each extra d adds more debugging information.
.
.TP
\fB-e\fP \fIexit_on_path\fP
Specifies the file path whose presence is checked by the daemon when it
receives a signal (SIGINT, SIGTERM) and allows it to exit even
if there are still monitored devices.
This can help with system shutdown where devices
have not been unmonitored properly.
To disable this behavior set this to the empty string "".
Default value is "\fI#DEFAULT_DMEVENTD_EXIT_ON_PATH#\fP".
.
.TP
.B -f
Don't fork, run in the foreground.
.
.TP
\fB-g\fP \fIseconds\fP
Set the grace period for monitoring thread cleanup (0-300 seconds, default: 10).
During this period, monitoring threads that have finished processing events
will wait for potential reuse rather than immediately terminating.
If the same device and plugin combination is registered again within
the grace period, the existing thread is reused, significantly reducing
overhead. Set to 0 to disable thread reuse.
.
.TP
.B -h
Show help information.
.
.TP
.B -i
Query the running daemon instance for the status information. The format is
internal and unstable and it is targeted for developers.
Format may change between versions.
.
.TP
.B -l
Log through stdout and stderr instead of syslog.
This option works only with option -f, otherwise it is ignored.
.
.TP
.B -?
Show help information on stderr.
.
.TP
.B -R
Replace a running dmeventd instance. The running dmeventd must be version
2.02.77 or newer. The new dmeventd instance will obtain a list of devices and
events to monitor from the currently running daemon.
.
.TP
.B -V
Show version of dmeventd.
.
.SH LVM PLUGINS
.
.TP
.B Mirror
Attempts to handle device failure automatically.
See
.BR lvm.conf (5).
.
.TP
.B Raid
Attempts to handle device failure automatically.
See
.BR lvm.conf (5).
.
.TP
.B Snapshot
Monitors how full a snapshot is becoming and emits a warning to
syslog when it exceeds 80% full.
The warning is repeated when 85%, 90% and 95% of the snapshot is filled.
See
.BR lvm.conf (5).
Snapshot which runs out of space gets invalid and when it is mounted,
it gets umounted if possible.
.
.TP
.B Thin
Monitors how full thin pool data and metadata are becoming and emits
a warning to syslog when it exceeds 80% full.
The warning is repeated when more than 85%, 90% and 95%
of the thin pool is filled. See
.BR lvm.conf (5).
When a thin pool fills over 50% (data or metadata) thin plugin calls
configured \fBdmeventd/\:thin_command\fP with every 5% increase.
With default setting it calls internal
\fBlvm lvextend --use-policies\fP to resize thin pool
when it's been filled above configured threshold
\fBactivation/\:thin_pool\%_auto\%extend\%_threshold\fP.
If the command fails, dmeventd thin plugin will keep
retrying execution with increasing time delay between
retries up to 42 minutes.
User may also configure external command to support more advanced
maintenance operations of a thin pool.
Such external command can e.g. remove some unneeded snapshots,
use \fBfstrim\fP(8) to recover free space in a thin pool,
but also can use \fBlvextend --use-policies\fP if other actions
have not released enough space.
Command is executed with environment variable
\fBLVM_RUN_BY\%_DM\%EVENTD=1\fP
so any lvm2 command executed in this environment
will not try to interact with dmeventd.
To see the fullness of a thin pool command
may check these two environment variables
\fBDMEVENTD\%_THIN\%_POOL\%_DATA\fP and
\fBDMEVENTD\%_THIN\%_POOL\%_METADATA\fP.
Command can also read status with tools like \fBlvs\fP(8).
.
.TP
.B Vdo
Monitors how full a VDO pool data is becoming and emits
a warning to syslog when it exceeds 80% full.
The warning is repeated when more than 85%, 90% and 95%
of the VDO pool is filled. See
.BR lvm.conf (5).
When a VDO pool fills over 50% vdo plugin calls
configured \fBdmeventd/\:vdo_command\fP with every 5% increase.
With default setting it calls internal
\fBlvm lvextend --use-policies\fP to resize VDO pool
when it's been filled above the configured threshold
\fBactivation/\:vdo_pool\%_auto\%extend\%_threshold\fP.
If the command fails, dmeventd vdo plugin will keep
retrying execution with increasing time delay between
retries up to 42 minutes.
User may also configure external command to support more advanced
maintenance operations of a VDO pool.
Such external command can e.g. remove some unneeded space
with \fBfstrim\fP(8),
but also can use \fBlvextend --use-policies\fP
if other actions have not released enough space.
Command is executed with environment variable
\fBLVM_RUN_BY\%_DMEVENTD=1\fP so any lvm2 command executed
in this environment will not try to interact with dmeventd.
To see the fullness of a VDO pool command may check this
environment variable \fBDMEVENTD_VDO_POOL\fP.
Command can also read status with tools like \fBlvs\fP(8).
.
.SH ENVIRONMENT VARIABLES
.
.TP
.B DMEVENTD_THIN_POOL_DATA
Variable is set by thin plugin and is available to executed program.
Value represents actual usage of thin pool data volume.
Variable is not set when error event is processed.
.
.TP
.B DMEVENTD_THIN_POOL_METADATA
Variable is set by thin plugin and is available to executed program.
Value represents actual usage of thin pool metadata volume.
Variable is not set when error event is processed.
.
.TP
.B DMEVENTD_VDO_POOL
Variable is set by vdo plugin and is available to executed program.
Value presents actual usage of VDO pool data volume.
Variable is not set when error event is processed.
.
.TP
.B LVM_RUN_BY_DMEVENTD
Variable is set by thin and vdo plugin to prohibit recursive interaction
with dmeventd by any executed lvm2 command from
a thin_command, vdo_command environment.
.
.SH SEE ALSO
.
.nh
.na
.BR lvm (8),
.BR lvm.conf (5),
.BR lvextend (8),
.P
.BR fstrim (8)