1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

130 Commits

Author SHA1 Message Date
Zdenek Kabelac
a940979ff7 cov: drop checking for EWOULDBLOCK
Reduce cov warning and remove this really ancient define
as lvm2 was never compilable on such platform.
2020-09-12 13:24:03 +02:00
Zdenek Kabelac
9ee3af7efc cov: more checks for failing syscalls 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
1cc1333599 daemons: check for non-zero thread_id
Do not call pthread_join if thread_id would be 0.
2019-11-11 22:44:25 +01:00
Zdenek Kabelac
cc865749ae daemon: better error path handling for shutdown
Report errors for open in better order.
Ensure descriptors are not leaked.
2019-11-11 22:44:25 +01:00
Zdenek Kabelac
30a23a1941 cov: missing checks of syscalls
Check for sigprocmask errors
2019-11-11 22:44:25 +01:00
Zdenek Kabelac
728435e7d6 cov: check for socket_path being set
As we check for existince on entering path
let's ensure it's there also on exit path.
2019-08-09 12:57:07 +02:00
Zdenek Kabelac
8fbaa6d9a5 cleanup: missed string specifier 2019-04-17 11:35:44 +02:00
Zdenek Kabelac
44cfa55843 libdaemon: use pselect to avoid condition checking race
To avoid tiny race on checking arrival of signal and entering select
(that can latter remain stuck as signal was already delivered) switch
to use  pselect().

If it would needed, we can eventually add extra code for older systems
without pselect(), but there are probably no such ancient systems in
use.
2019-04-16 12:18:34 +02:00
Marian Csontos
e0c2d374ae build: Remove reference to undefined @BUILD_LVMETAD@ 2018-12-18 09:54:45 +01:00
Zdenek Kabelac
a63015442e makefiles: drop unneeded LIBS add 2018-12-17 10:36:52 +01:00
Zdenek Kabelac
0b19387dae headers: use configure.h as 1st. header
Ensure configure.h is always 1st. included header.
Maybe we could eventually introduce gcc -include option, but for now
this better uses dependency tracking.

Also move _REENTRANT and _GNU_SOURCE into configure.h so it
doesn't need to be present in various source files.
This ensures consistent compilation of headers like stdio.h since
it may produce different declaration.
2018-12-14 15:09:13 +01:00
Joe Thornber
d5da55ed85 device_mapper: remove dbg_malloc.
I wrote dbg_malloc before we had valgrind.  These days there's just
no need.
2018-06-08 13:40:53 +01:00
Joe Thornber
ccc35e2647 device-mapper: Fork libdm internally.
The device-mapper directory now holds a copy of libdm source.  At
the moment this code is identical to libdm.  Over time code will
migrate out to appropriate places (see doc/refactoring.txt).

The libdm directory still exists, and contains the source for the
libdevmapper shared library, which we will continue to ship (though
not neccessarily update).

All code using libdm should now use the version in device-mapper.
2018-05-16 13:00:50 +01:00
Joe Thornber
7f97c7ea9a build: Don't generate symlinks in include/ dir
As we start refactoring the code to break dependencies (see doc/refactoring.txt),
I want us to use full paths in the includes (eg, #include "base/data-struct/list.h").
This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in
metadata/ from base/
2018-05-14 10:30:20 +01:00
Alasdair G Kergon
f1cc5b12fd tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
Zdenek Kabelac
03efec2712 deamonize: restore detection of errors
Keep forked environment for daemon more strick and check even
for nearly impossible to happen errors.
2017-09-06 11:47:53 +02:00
Zdenek Kabelac
b3b1e788e1 daemonize: more unified code
ATM we have several instances of daemonizing code.
Each has its 'special' logic so not completely easy
to unify them all into a single routine.

Start to unify them and use one strategy for rediricting
all input/outpus to /dev/null - use 'dup2' function for this
and open /dev/null before fork to make sure it's available.
2017-08-25 14:20:57 +02:00
Alasdair G Kergon
fdd00ecdd1 lvmetad: Suppress accept error on clean shutdown
Also fix error message after pthread_create() error in handle_connect().
2017-07-06 14:53:10 +01:00
Christian Brauner
46b735c937 lvmetad: fix segfault on i386
Sending %d as format argument in lvmetad_vg_remove_pending() will cause
segfaults in config_make_nodes_v() when va_arg() casts to int64_t. Also, it is
clearly advertised in the lvm source code that using plain %d is prohibited, so
let's switch to FMTd64.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-03-13 13:37:07 -05:00
Zdenek Kabelac
2a9eda1229 mem: add extra mem pages for pthread stack
Some archs can use even 64K pages and then lvm2 runs into trouble if
the stack is 'too small' to fit extra page capturing stack overwrite.

So when lvm2 limits stack - add extra mem page - be it 4K or 64K.

Relates to ppc64le bug: https://bugzilla.redhat.com/1387279
2017-02-11 18:23:15 +01:00
Peter Rajnoha
f1cad4c710 config: use config_tree_from_string_without_dup_node_check throughout code to construct metadata trees 2016-09-21 18:18:15 +02:00
Peter Rajnoha
045772aa30 config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed 2016-09-21 18:18:15 +02:00
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