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

64 Commits

Author SHA1 Message Date
David Teigland
b12961e7eb lvmetad: process new connections after shutdown signal
Currently, a shutdown signal will cause lvmetad to quit
responding to new connections, but not actually exit until
all connections are gone.  If a program is maintaining a
long running connection (e.g. lvmlockd, or even an lvm
command) when lvmetad gets a shutdown signal, then all
further commands will hang indefinately waiting for a
response that won't be sent.

With this patch, make lvmetad continue handling new
connections even after a shutdown signal.  It will exit
once all connections are gone.
2016-06-20 13:19:02 -05:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
David Teigland
a0d819172f libdaemon: fix typo in last log enable commit 2015-10-21 11:22:22 -05:00
David Teigland
0aee04288e libdaemon: allow all debug levels for stderr
The parsing code for log levels was missing
some levels.  Also ignore an unrecognized
level name rather than failing.
2015-10-21 11:19:18 -05:00
Zdenek Kabelac
abb24370e9 cleanup: move var declaration 2015-08-18 16:05:04 +02:00
Alasdair G Kergon
dfe3eb12d0 include: Standardise around new tool.h. 2015-07-06 17:30:18 +01:00
David Teigland
fe70b03de2 Add lvmlockd 2015-07-02 15:42:26 -05:00
David Teigland
7760665fb8 libdaemon: add comment about using main and init 2015-06-24 12:16:26 -05:00
David Teigland
c5ba60827e libdaemon: allow main processing function to be specified 2015-06-23 16:55:45 -05:00
Ondrej Kozina
8d594c409c libdaemon: fprintf(stderr...) -> ERROR()
log data structures are ready. so why not pass
error messages through ERROR()
2015-05-15 20:31:42 +02:00
Ondrej Kozina
f653b123cf libdaemon: suggest daemon already running
when dm_creat_lockfile fails, it's probably due to
another instance is holding the same pid file...
2015-05-15 20:31:36 +02:00
Alasdair G Kergon
02e10f4ccd libdaemon: Fix socket reuse error paths.
Invert S_ISSOCK validation.
Fail instead of replacing a symlink with a new socket.
After failure, skip calling fcntl with invalid socket_fd.
2015-05-13 13:42:09 +01:00
Ondrej Kozina
cdb7ce6f17 libdaemon: shutdown on idle also in non-systemd environment 2015-05-12 17:16:24 +02:00
Ondrej Kozina
e0a62b8fdc libdaemon: introduce support for exit on idle
works with systemd activated daemons only as of now

each daemon implementation may decide to signalize its
internal idle state (i.e. all background tasks unrelated to
client threads are finished)
2015-04-29 17:10:44 +02:00
Ondrej Kozina
5dbcbbea58 libdaemon: map error level properly
internal daemon error log level was wrongly mapped to debug syslog
level causing most error messages were lost in non-debug mode.
2015-03-10 14:42:40 +01:00
Ondrej Kozina
f73526f58c libdaemon: set CLOEXEC flag on systemd socket
all sockets opened by a daemon or handed over by systemd
have to have CLOEXEC flag set. Otherwise we get nasty
warnings about leaking descriptors in processes spawned by
daemon.
2015-02-02 10:20:35 +01:00
Ondrej Kozina
9dd81df8b2 libdaemon: set CLOEXEC on client socket fd 2015-02-02 10:15:52 +01:00
Zdenek Kabelac
24df01f735 cleanup: avoid double assign
Skip setting a value to a variable which is never
used and overwritten/set afterwards.
2014-08-19 14:33:06 +02:00
Peter Rajnoha
3208396ce5 coverity: fix issues reported by coverity 2014-06-24 14:58:53 +02:00
Zdenek Kabelac
b193a3b09f cleanup: rename variable wait
With older system headers (sys/wait.h) this shadows declaration.
2014-06-19 12:02:48 +02:00
Petr Rockai
488f308527 libdaemon: Keep track of client threads, wait before shutdown. 2014-06-09 01:50:57 +02:00
Zdenek Kabelac
b7741f0a83 libdaemon: header cleanup
Ensure  daemon-io.h is used as a generic header included
with configure defines before other headers.
(In future all lvm2 libraries should settle on a single lib.h header)
Rename couple defines to better match header file names.
2014-04-18 16:38:49 +02:00
Alasdair G Kergon
84394c0219 lvmetad: extend socket/pid file handling
Make it easier to run a live lvmetad in debugging mode and
to avoid conflicts if multiple test instances need to be run
alongside a live one.

No longer require -s when -f is used: use built-in default.
Add -p to lvmetad to specify the pid file.
No longer disable pidfile if -f used to run in foreground.
If specified socket file appears to be genuine but stale, remove it
before use.
On error, only remove lvmetad socket file if created by the same
process.  (Previous code removes socket even while a running instance
is using it!)
2013-11-29 20:56:29 +00:00
Zdenek Kabelac
50e1fad86a cleanup: use matching signed types 2013-11-28 12:47:51 +01:00
Alasdair G Kergon
527db4645f gcc: replace #ifdef linux with __linux__ 2013-11-13 13:56:29 +00:00
Petr Rockai
7d299ecbb3 libdaemon: Fix a subtle race in worker thread creation. 2013-10-10 00:34:35 +02:00
Zdenek Kabelac
e3d3921779 lvmetad: use dm_ malloc wrappers
Use matching dm_ functions for internally used buffers.
2013-06-18 22:11:31 +02:00
Zdenek Kabelac
855175fa26 cleanup: add printf attribute
Add gcc attribute for printf for daemon_logf().
2013-04-21 23:14:05 +02:00
Petr Rockai
dce8d06af7 libdaemon: Print a diagnostic when we fail to lock the pidfile. 2013-04-15 16:07:07 +02:00
Zdenek Kabelac
8bcc1da2f3 locales: use higher prio LC_ALL variable
For reseting locale environment into significantly less memory
consuming version 'C' - use LC_ALL instead of LANG since it has
higher priority in locale settings.

Otherwise we may observe whole locale-archive which might be
over 100MB on i.e. Fedora systems locked in memory with
some daemons.
2013-01-22 11:25:02 +01:00
Zdenek Kabelac
3e8dbfaecf lvmetad: add check for failure dm_config_write_node
Detect if dm_config_write_node failed and fail correctly.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
4008f4f891 lvmetad: fix socket leak in handle_connect
Close socket_fd and report error on malloc failure.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
1b05438fcb cleanup: ignore errors
Since we are doing just dump and function doesn't report
any error, explicitely ignore return values from
dm_config_write_node and dm_asprintf.

Same applies for the logging function.
2012-12-15 14:57:40 +01:00
Alasdair G Kergon
8290de964f lvmetad: rename DEBUG() to DEBUGLOG()
DEBUG is already defined by -DDEBUG
2012-10-15 14:20:11 +01:00
Alasdair G Kergon
78dafcba99 lvmetad: use -l for logging level not -d 2012-10-15 10:44:43 +01:00
Zdenek Kabelac
3ed2c32e0a lvmetad: empty types string is ok
Since now return code is test - return OK for this case.
2012-10-15 11:02:15 +02:00
Alasdair G Kergon
a0e60d27ff lvmetad: document and tidy cmdline args
Try to bring the lvmetad usage text and man page closer to the code.
There seem to be 3 useful ways to use -d with lvmetad at the moment:
  -d all
  -d wire
  -d debug
(They can also be comma-separated like -d wire,debug.)
Prior to the last release, -d, -dd and -ddd were supported.
Fail if an unrecognised debug arg is supplied on the command line.
Change -V to report the same version as the lvm binary: previously it
just reported version 0.
2012-10-15 02:06:27 +01:00
Zdenek Kabelac
9ee071705b cleanup: fix compiler warnings
remove unused vars
move var declarations into the front of functions.
fix some sign warnings
2012-10-12 10:25:07 +02:00
Petr Rockai
b07df8850a libdaemon: Make buffer handling asymptotically more efficient. 2012-10-11 18:09:41 +02:00
Petr Rockai
329d10268c libdaemon-server: Do not create pidfile if NULL. 2012-10-09 20:37:34 +02:00
Petr Rockai
4b4c2833d9 libdaemon-server: Optimize logging for a fast no-output path. 2012-10-08 20:35:29 +02:00
Petr Rockai
cc9c02fe68 libdaemon-server: Fix a memory leak in daemon_log_multi. 2012-10-08 20:35:29 +02:00
Petr Rockai
662a2122f6 libdaemon: Split daemon-shared.[hc] into daemon-io.[hc] and config-util.[hc]. 2012-09-26 17:26:23 +02:00
Petr Rockai
c9f56d639b lvmetad: Use "%" PRId64 in place of "%d" for extra clarity. 2012-09-26 17:26:16 +02:00
Petr Rockai
ea14d5159c libdaemon: Extend and refactor APIs.
- move common dm_config_tree manipulation functions from lvmetad-core to
  daemon-shared
- add config-tree-based request manipulation APIs to daemon-client
- factor out _v (va_list) variants of most variadic functions in libdaemon
2012-09-26 14:49:09 +02:00
Zdenek Kabelac
c6f680ee49 clvmd,lvmetad: check for fcntl result
Report any problem of fcntl.
2012-08-23 14:38:48 +02:00
Zdenek Kabelac
93f36fb77f cleanup: add va_end
Pair va_start with va_end.
2012-08-23 14:37:21 +02:00
Zdenek Kabelac
ba309e0da5 cleanup: add standard GPL file header
Add FIXME about DEBUG define colission.
2012-08-23 14:37:20 +02:00
Zdenek Kabelac
b0b507b197 cleanup: use <> for system header file 2012-08-23 14:37:20 +02:00
Zdenek Kabelac
ed53b4b674 lvmetad: do not deref NULL pointer
Call log only for req.cft != NULL.
2012-08-23 14:34:54 +02:00