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

19220 Commits

Author SHA1 Message Date
Zdenek Kabelac
485a1961e8 clang: implicit conversion from 'long' to 'double'
implicit conversion from 'long' to 'double' changes value
from 9223372036854775807 to 9223372036854775808.

So rather compare same integer types.
2024-04-16 01:10:03 +02:00
Zdenek Kabelac
d3d06f8ca0 WHATS_NEW: update 2024-04-15 13:45:11 +02:00
Zdenek Kabelac
569dd5d089 configure: autoreconf 2024-04-15 13:38:44 +02:00
Zdenek Kabelac
3b9bb773fe configure.ac: 3.7.0 is new minimal sanlock versioh
Require this minimal version of sanlock for usage with lvmlockd.
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
716fc27fdd dmeventd: use daemon_close_stray_fds
Use common code for close stray descriptors.
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
79cdfc8ca6 libdaemon: implement daemon_close_stray_fds
Refactor existing code from tools/lvmcmdline.c to
libdaemon/server/daemon-stray.h daemon_close_stray_fds()
used to close stray descriptors above some specified Fd.

This is code parses content of /proc dir to minimize 'blind' closing
of all possible descriptors within rlimits range.

As we have the same code in few other places in it's more 'trivial'
version - these were actually sensitive to high amount of descriptors,
which might be configured on some system.

With this patch we effectively resolve this reported gitlab issue:
https://gitlab.com/lvmteam/lvm2/-/issues/5

TODO: Current placement might not be ideal - however considering
existing code base constrains it's not so simple.
ATM it uses lib/misc/lvm-file.h  for custom_fds declaration
and rest of functinality is included in daemon header file.
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
ecb8399005 lvm: use configure proc dir in lvm.conf
Update some code parts to use configurer /proc from lvm.conf
(so i.e. our testing can use some fake values)
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
84b084c9b6 configure.ac: define DEFAULT_PROC_DIR in one place
Let's move proc into include/configure.h so this define can
be easily used across the source base.

Configure defines it - but ATM we do not provide any configure
option to change it - there should be no need to ever change it.
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
2ea8afba93 dmeventd: typo fix
Fix typo and minor reorder of struct member for better alignment.
2024-04-15 12:58:27 +02:00
David Teigland
f59ec61fa7 lvmcache: fix memleaks on list removal
Free members released from the list.
2024-04-15 12:58:27 +02:00
Zdenek Kabelac
0168de83de spec: disable LTO
Currently there is not much gain in using LTO when building
testing rpms
2024-04-12 01:27:26 +02:00
Zdenek Kabelac
fcfbef26e4 spec: replace exists macro with plain shell test
seems this macro works only with recent rpm.
2024-04-12 01:27:26 +02:00
Zdenek Kabelac
8ce8e33a44 tests: better handling for dmeventd restart
Handle the case, where we  'kill -9' running dmeventd,
and restarting 'dmeventd -R' manages to still contact this
'zombie' damone and manages to get list of monitored devices
out of this and eventually 'run' new and in this case
unexpected instance of dmeventd.
2024-04-12 00:21:46 +02:00
Zdenek Kabelac
aae7c98aaa tests: fallback to normal hostname on older machines
hostname -I  is newer option, add some fallback
2024-04-12 00:21:45 +02:00
Zdenek Kabelac
81dc0e72da tests: explicitely use event_activation=1
Some test do expect event_activation to be set.
So add explicit configuring of this setting in tests,
but also add new default which kind of does it globally
as it's expected default  (yet our testing rpms might
be create with disabled event_activation)
By adding this to each test individually - it's now easy
to locate such tests...
2024-04-12 00:21:45 +02:00
Zdenek Kabelac
d6b15e755e dmeventd: reduce some static variable usage
Move static to main() local vars.

Initilize libdm logging also before starting _restart_dmeventd()
so function there can be also logged.

Move call of _info_dmevent() out of option processing - so some
options like -V are processed with higher priority.
2024-04-12 00:20:43 +02:00
Zdenek Kabelac
5e3224c57d dmeventd: no log when after unlink file is gone
Check for errno ENOENT.

TODO: there should be global wrapper for this...
2024-04-12 00:14:03 +02:00
Zdenek Kabelac
54840d867e devmapper-event: add unlock into init_fifo error path
Unlock server path if there is open failure for client_path
and whole init_fifos() function is returning failure.
2024-04-12 00:14:02 +02:00
Zdenek Kabelac
3a433b14f2 dmeventd: rework _restart_dmeventd
Use _restart_dmeventd() with return values 0,1,2.
Also let's use already created fifos struct.

Make sure the _systemd_activation variable is properly initialized
from _systemd_handover before calling _restart_dmeventd() as
this variable is used there to decide where   1 or 2 should
be returned - aka either letting systemd to initilize
or restart dmeventd itself.
2024-04-12 00:14:01 +02:00
David Teigland
449af6c335 lvmlockd: use sanlock.h for defines 2024-04-11 10:50:06 -05:00
Zdenek Kabelac
fd0517c82b spec: try with default dependency tracking
Check whether we have now all dependencies right.
2024-04-10 17:38:26 +02:00
Zdenek Kabelac
543011fa86 spec: when building rpm on test machine disable event_activation
This is initial test how to disable event_activation on
machines, where lvm2-testsuite packages are installed
with its lvm.conf file.

TODO: find more elegant mechanism
2024-04-10 17:38:26 +02:00
Zdenek Kabelac
ac3cee638b spec: update default values
Reverse condition and downgrade setting for older versions.
Also define proper version strings
2024-04-10 17:38:26 +02:00
Zdenek Kabelac
8ba9574ed4 tests: aux extend lvmdbusd timeout for startup
Unclear yet what's going on here - so try waiting up 10second
to see if our service will get there.
Print task list if not...
2024-04-10 17:38:26 +02:00
Zdenek Kabelac
faf4fe0714 tests: use lvname with space
Occasionally this test fails as soemtimes UUID actually
may constain LV[d] string causing it to grep mismatch
UUID and LV name and eventually fail test for wrong reason.

As a simple workaround print the LV name first and
check the name is followed by a space character.
2024-04-10 17:36:50 +02:00
Zdenek Kabelac
a14cb2495b WHATS_NEW: update 2024-04-10 00:04:54 +02:00
Zdenek Kabelac
8d1a946a9b tests: update unit-tests
Fix some memleaks.
Drop call of bcache_clear_fd() when bache was not initialized.
2024-04-10 00:04:54 +02:00
Zdenek Kabelac
8a2839c867 tests: update for faster dmeventd
We can drop sleep 6, since dmeventd will quit immediatelly
when no running dmeventd can be restarted.

Also restart itself check more conditions.
2024-04-10 00:03:33 +02:00
Zdenek Kabelac
6382d141fa tests: add missing vgck
This test missed being adjusted with this updated workflow
so it's been testing something different...
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
32c6dbb425 tests: aux fallback to sleep
When dbus-send tool is not present on system, fallback to sleep.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
6a95c66f5b tests: drop test warning
These kernel are not going to be ever fixed, so drop warning
being displayed for these tests.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
fa62397ff8 cov: mask false positive
This code is somewhat complex and involves recursion and pointer
shuffling which confuses coverity here.

Let's add masking comment for this warning as there is no double
free in this code.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
2b9c3f8dc9 cov: pass buffer size 2024-04-10 00:03:09 +02:00
Zdenek Kabelac
82f50dc800 gcc: remove warning about inlining failure
Persuade gcc we want this function to be inline and avoid:
  warning: inlining failed in call to ‘lvmlockd_open.constprop.0’:
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
2b802ab413 cov: use check of snprintf result
Do validation in one go with snprintf() result,
so there is no extra strlen() and uncheck possibly truncating snprintf()
visible to coverity.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
c5b4574729 cov: use stream ptr in its original form
Let's stop Coverity thinking here we are using freed FILE*
for anything else then comparing numbers.
For this use the original source of old_stream pointer.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
2a8c195360 cov: use dm_strncpy variant 2024-04-10 00:03:09 +02:00
Zdenek Kabelac
cb16f5053f cov: make obvious how free of memory happens
When there is allocation, it needs also deallocator.
Remove no longer needed coverity warning masking.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
e7a54c1a50 cov: use safer version with size limitation
Although there is likely not much risk of having chance of overwritting
given buffers use safer variant.
Use dm_strncpy() when just copying %s.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
3ce83f923d cov: extra pointer validation
Add few more internal errors to enusure there is no use of NULL pointers
along the code path.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
8545621d39 cov: replace strcpy with memcpy
When we know the size we can avoid using strcpy.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
22a0cfdc05 cov: use memccpy
When we want to copy string which may not be null terminated,
replace strncpy with more correct memccpy.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
f27273e1f0 dmeventd: restart checks for running daemon
Check whether the pid file is associated with running daemon.
If not there is not much point to wait many seconds in loop.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
f27388b5d8 toolib: skip when there is no vg and error_vg
We must skip even if the skip would be suggesting otherwise
if there is no vg and no error_vg as there is nothing to process.
2024-04-09 17:47:55 +02:00
Zdenek Kabelac
cd9b2b32aa configure: add --with-default-event-activaion=ON
Add new configurable option for building lvm2 with enable/disable
default autoactivation setting.

Might be useful for building i.e. rpms for systems where
this event_activation is not desired.
2024-04-09 17:47:03 +02:00
Zdenek Kabelac
9dad6f202c reporter: correcting failure return value
This function do use ECMD_ return values,
so use ECMD_FAILED as initial value - used for internal error paths
2024-04-09 17:43:23 +02:00
Zdenek Kabelac
f404d8ccb7 gitignore: add more ignored suffixes 2024-04-08 22:24:18 +02:00
Zdenek Kabelac
5125629f2a makefiles: add libdm as deps for unit-test
When using just 'make check' ensure we make also dmsetup
so it's not needed to run explicit 'make' to get all the tools.
2024-04-08 22:24:18 +02:00
Zdenek Kabelac
39d375ecd1 tests: include date and hostname IPs in test log
When our testing machines are going wild with NetworkManager,
this might be slightly helping.
2024-04-08 22:24:18 +02:00
Zdenek Kabelac
b120b2932d tests: add timestamp to kernel line
Parse timestamps included in kernel kmsg line and add current system
time to the messsage as well - this makes it easier to look over,
when chasing some messages in journal after some time...
2024-04-08 22:24:18 +02:00