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

108 Commits

Author SHA1 Message Date
David Teigland
bf0eaafa6b libdaemon: add errno to error message 2016-08-19 10:59:46 -05:00
Alasdair G Kergon
3d717b52c1 pre-release 2016-07-15 21:55:38 +01:00
Zdenek Kabelac
e96d1ad3ef cleanup: local static functions with _ 2016-07-15 15:49:01 +02:00
Zdenek Kabelac
4de7a843eb coverity: close socket before closing app
Opened socket descriptor goes out-of-sight still opened.
Close it - but since this happens before app exit, it
just fixed valgrind report.
2016-07-15 15:49:01 +02:00
Zdenek Kabelac
4661c6b6fb coverity: cleaning some PW.NOT_COMPATIBLE_WITH_PREVIOUS_DECL
Some very low-prio warns....
2016-07-13 21:52:14 +02:00
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
b36cf94318 cleanup: add backtrace 2016-03-10 18:38:54 +01:00
Zdenek Kabelac
2988fa3c21 coverity: helping coverity with NULL pointer
Helping with understanding we will not try to deref NULL pointer,
as if the sizes are initialized to NULL it also means 'mem' would
be NULL, but thats too hard to model so make it obvious.
2016-02-26 10:21:36 +01:00
Zdenek Kabelac
c0b836e316 gcc: logical-op warning go away
Don't be too much inventive and shutdown gcc6 warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
2016-02-23 14:41:24 +01: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
Zdenek Kabelac
36ee367343 libdaemon: prohibit use of %d for 64bit numbres
Do not let pass %d and print internal error when found one.
Require all users to use  FMTd64 - it's seriously confusing.
2015-11-09 14:03:25 +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
David Teigland
c805fa7c40 lockd: add debug logging for metadata error
When lvmetad_pvscan_vg() reads VG metadata from each PV,
it compares it to the last one to verify it matches.
If the VG metadata does not match on the PVs, an error
is printed and it fails to read the VG.  In this error
case, use log_debug to show the differences between
the two unmatching copies of the metadata.
2015-09-29 13:51:24 -05:00
Zdenek Kabelac
abb24370e9 cleanup: move var declaration 2015-08-18 16:05:04 +02:00
Peter Rajnoha
1481125042 libdaemon: config_make_nodes_v needs fixing
Put the change from commit #10d27998b3d2f6100e9e29e83d1d99948c55875f
back so we have working tree again for now. This code needs a bit of
a cleanup to return proper return value to check...
2015-07-09 16:34:08 +02:00
Alasdair G Kergon
dfe3eb12d0 include: Standardise around new tool.h. 2015-07-06 17:30:18 +01:00
Alasdair G Kergon
810ab095e6 macros: Wrap PRI with FMT.
Create a set of wrappers with embedded % such as
  #define FMTu64 "%" PRIu64
2015-07-06 15:09:17 +01:00
David Teigland
fe70b03de2 Add lvmlockd 2015-07-02 15:42:26 -05:00
Ferenc Wágner
a62cd64db6 makefiles: avoid bash == operator syntax, use = instead
Commit e587b0677b broke the build on
systems where /bin/sh is Dash, for example.

Origin patch by Ferenc Wágner <wferi@niif.hu>  changed later to
avoid using shell call, so makefile add 'server' target when
one of  metad or polld daemon is requested.
2015-06-26 22:11:45 +02: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
David Teigland
fd1376ebef libdaemon: move compare_config to lib
so it can be used elsewhere.
2015-06-17 13:07:52 -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
e587b0677b lvmpolld: Add standalone polldaemon.
See doc/lvmpolld_overview.txt
2015-05-09 00:59:18 +01: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
Petr Rockai
2ebb4f4ca3 libdaemon: Export chain_node from config-utils.c. 2015-04-14 20:16:53 +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
Zdenek Kabelac
cb144c0097 cleanup: drop unused val 2015-02-17 13:39:26 +01:00
Petr Rockai
c2aa918c53 libdaemon: Use select to yield CPU on a blocked read or write. 2015-02-05 13:47:20 +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
Alasdair G Kergon
6521c4b215 libdaemon: Fix some client leaks.
Free (and clear) h.protocol string on daemon_open() error paths
so it's OK for caller to skip calling daemon_close() if returned
h.socket_fd is -1.

Close h.socket_fd in daemon_close() to avoid possible leak.

https://bugzilla.redhat.com/1164234
2014-11-28 21:31:51 +00:00
Zdenek Kabelac
1ce21c19d5 va_list: properly pass va_list through functions
Code should not just pass va_list arg through the function
as args could be passed in many strange ways.
Use va_copy().

For details look in i.e.:

http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html
2014-09-16 11:42:40 +02: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
Peter Rajnoha
c84face8ce libdaemon: fix misleading "WARNING: Ignoring unsupported value for expected." when communicating with daemon
When we're trying to search for certain tree node
in daemon's reply, we default to a blank string ""
if the node is not found. This happens during lvmetad
initialization.

However, when the default blank string is used, we
can't use dm_config_find_str at the same time - the
dm_config_find_str_allow_empty should be used instead.
Otherwise a a warning message:

  "WARNING: Ignoring unsupported value for ..."

is issued.
2014-03-24 16:47:08 +01: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
Petr Rockai
808a5d945e libdaemon: Fix an invalid memory read. 2013-10-08 23:21:09 +02:00
Zdenek Kabelac
c5957ee2ff cleanup: easier to read loop code
buffer_write now accepts const pointer
Simplify loops and drop goto when not needed.
2013-06-18 22:13:41 +02:00
Zdenek Kabelac
155841c349 lvmetad: fix compare function
Check for enough space in preallocated buffer.
Fixes problem, when lvm code started to suddenly allocate
too big memory chunks.

TODO: lvmetad protocol should announce needed size ahead,
so if metadata have 1MB we are not reallocating memory...
2013-06-18 22:12:51 +02:00