1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00
Commit Graph

57 Commits

Author SHA1 Message Date
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
Alasdair G Kergon
981962b339 libdaemon: add logging to daemon_open
Log all conditions encountered in daemon_open().

Only store errno when known to be set.
2013-01-04 23:29:59 +00: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
399fc1bb33 lvmetad: keep returned struct fully initialized
Always clear the response structure.
Simplify daemon_reply initialization.
2012-12-15 17:23:27 +01:00
Zdenek Kabelac
788ac7fa54 libdaemon: check for strdup result
Detect failure of dm_pool_strdup() and print error in fail path.
Save one extra strchr call - since we already know the distance
for the '=' character.

Drop stack trace from return after log_error().
2012-12-15 17:23:26 +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
920352da70 lvmetad: fix leak of append on error path 2012-10-14 23:14:48 +02:00
Zdenek Kabelac
4379365cae lvmetad: fix memory leaks in error paths
Destroy interator in error path.
Releasy any possible allocated buffer from buffer_append_f
and buffer_append_vf  in error path.
2012-10-13 19:19:50 +02:00
Zdenek Kabelac
88c547d1ca lvmetad: move initialization in the inner loop
Set append to NULL in the front of cycle, so the INTERNAL error path
is not leading to double-free of append pointer.
2012-10-13 19:15:15 +02:00
Zdenek Kabelac
feea5003cc cleanup: remove unneeded headers
Header do not provide any needed symbols.
2012-10-13 19:13:25 +02:00
Zdenek Kabelac
5a958655dd lvmetad: fix test for dm_asprintf 2012-10-12 11:36:01 +02:00
Zdenek Kabelac
f2a5d3ae3a lvmetad: validate dm_asprintf in buffer_append_vf
Check result of dm_asprintf
Check buffer_append result
Declare vars in front
2012-10-12 10:59:10 +02:00
Zdenek Kabelac
5c792f620b lvmetad: check result of buffer_realloc 2012-10-12 10:59:10 +02: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
a19a595343 libdaemon-client: Fix a memory leak in daemon_send. 2012-10-08 20:35:29 +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
4ece923a4b libdaemonclient: Use log_sys_error in place of perror. 2012-09-26 17:26:23 +02:00
Petr Rockai
7a2a1a7456 libdaemonclient: Use dm_{malloc,free} in place of {malloc,free}. 2012-09-26 17:26:23 +02:00
Petr Rockai
c731bb1ee1 lvmetad: Fix #845269: SEGV on corrupt lvmetad response. 2012-09-26 17:26:23 +02:00
Petr Rockai
0a87fed794 Makefiles: Build libdaemonclient unconditionally. 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
c7b17836ea Implement devices/global_filter.
The global filter is applied first, and is also applied in pvscan --cache (which
is called from udev rules to keep lvmetad updated). Cf. example.conf.
2012-09-26 14:49:15 +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
Zdenek Kabelac
3685701529 lvmetad: fix memleak on error path
Release allocated buffer on error path.
2012-08-23 14:33:27 +02:00
Zdenek Kabelac
8edc0e450d lvmetad: fix memleaks
Release allocated buffers in daemon_logf, daemon_log_parse
2012-08-23 14:33:23 +02:00
Petr Rockai
b61be64370 libdaemon: Draft logging infrastructure.
- logging is not controlled by "levels" but by "types"; types are
  independent of each other... implementation of the usual "log level"
  user-level semantics can be simply done on top; the immediate
  application is enabling/disabling wire traffic logging independently
  of other debug data, since the former is rather bulky and can easily
  obscure almost everything else
- all logs go to "outlets", of which we currently have 2: syslog and
  stderr; which "types" go to which "outlets" is entirely configurable
2012-08-08 09:44:19 +02:00
Marian Csontos
3843f54974 [lvmetad] Continue reading/writing on EINTR 2012-08-02 16:50:37 +02:00
Marian Csontos
49ae67cba3 lvmetad: Skip redundant checks on no input 2012-08-02 16:50:37 +02:00
Peter Rajnoha
8d5ae472e5 daemon-server: fix error message on daemon shutdown
If a daemon (like lvmetad that is using common daemon-server code)
received a kill signal that was supposed to shut the daemon down,
a spurious message was issued: "Failed to handle a client connection".

This happened if the kill signal came just in the middle of waiting
for a client request in "select" - the request that was supposed to
be handled was blank at that moment of course.
2012-07-19 16:45:08 +02:00
Zdenek Kabelac
6f3cd63551 cleanup: replace memset with struct initilization
Simplifies the code, properly detects too long socket paths,
drops unused parameter.
2012-06-22 13:23:03 +02:00
Peter Rajnoha
bf29fa49d3 Use dm_strncpy instead of plain strncpy while setting the socket path.
Also check the return value as it meaningless to work with truncated strings.
2012-04-27 09:52:33 +00:00
Peter Rajnoha
9a2b6bda59 strcpy -> strncpy in common daemon code. 2012-04-10 12:55:37 +00:00
Peter Rajnoha
761407217a Do exit if LISTEN_PID environment variable not correct during systemd handover. 2012-03-16 21:30:53 +00:00
Peter Rajnoha
93945bb616 Use SD_ACTIVATION env. var. in systemd units to better detect systemd in use.
LISTEN_PID and LISTEN_FDS environment variables are defined only during systemd
"start" action. But we still need to know whether we're activated during
"reload" action as well - we use the reload action to call "dmeventd -R"/"lvmetad -R"
for statefull daemon restart. We can't use normal "restart" as that is simply
composed of "stop" and "start" and we would lose any state the daemon has.
2012-03-14 15:51:51 +00:00