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

1842 Commits

Author SHA1 Message Date
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
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
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
092951f634 dmeventd: check for running dmeventd for status
Before initiation fifo communication, check whether there is
running dmeventd - in case there is no running instance, this
would be just blocked for 5 seconds trying to open fifo.
2024-04-08 22:24:18 +02:00
Zdenek Kabelac
88ad83e3d6 makefiles: use SHOW 2024-04-08 14:52:23 +02:00
Zdenek Kabelac
d490572410 gcc: clear some complains
Use dm_strncpy() were possible to get rid of gcc compile warnings.
2024-04-08 14:52:23 +02:00
Zdenek Kabelac
5dec664ccf lvmlocks: rework dm_strncpy
Fix cutting away 1 character via incorrect usage of dm_strncpy
introduced in last batch of commits and use sizeof(buffer) to
get proper sizes.

In case of use strcpy_name_len() the replacement was invalid,
so we need to restore this case since sanlock uses buffer without
nul ending, so we would strip one more character from the buffer.

Also start to use dm_strncpy() without (void) for unchecked usage.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
f9fefaaabe refactor: update dm_strncpy to _dm_strncpy
For checked versions of dm_strncpy use inline wrapper _dm_strncpy.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
995ff58903 refactor: remove (void) from dm_strncpy usage
Start to use dm_strncpy() as unchecked version within source tree.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
5c0ade35e2 util: swap header file load order
Ensure libdevmapper is included before util.h since
we are going to add function that is using it.
TODO: maybe add include directly here...
2024-04-04 19:33:58 +02:00
Zdenek Kabelac
eba277bca8 cov: cast to uint32 2024-03-29 01:36:48 +01:00
Zdenek Kabelac
fe2294769c cov: use dm_strncpy
Use better variant.
2024-03-28 22:19:45 +01:00
Zdenek Kabelac
2b7d0db7f1 cov: no overwrite of const qualified fields 2024-03-28 22:19:14 +01:00
Tony Asleson
3430395c85 lvmdbusd: Exit faster
Add a global timeout value to be used for the threads to end waiting for
whatever it is they are blocked on.  The values varied from 2-5 seconds,
which is way longer than needed.  Value of 0.5 shows no CPU load when
service is running and is idle.
2024-03-28 18:18:37 +01:00
Zdenek Kabelac
1d150d63c7 cov: ensure nul ends string 2024-03-28 18:18:37 +01:00
Zdenek Kabelac
8716d8c188 cov: check for to_dlm_mode return value
Avoid processing invalid to_dlm_mode in lm_convert_dlm.
2024-03-25 14:45:09 +01:00
Zdenek Kabelac
bca6f58848 cov: ensure string ends with \0
Use dm_strncpy() that ensures \0 termination.
2024-03-25 11:18:29 +01:00
Zdenek Kabelac
df9e5f39a7 debug: correct check for failing close 2023-10-02 14:13:12 +02:00
Zdenek Kabelac
e930ee93f7 debug: correct level
No error for just tracing message.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
a9d7a9d128 dmeventd: implement exit_on file check
When exit on file is present in a system and term/break signal is
catched, them dmeventd is no longger refusing to exit.

For the correct shutdown, there should be ideally unmonitoring call,
however in some case it's very hard to implement this correct procedure.

With this 'exit on' file dmeventd at least avoid 'blocking' shutdown,
before systemd kills use with -9 anyway possibly even in some unwanted
stated of internal dmeventd processing (i.e. in the middle of some lvm
command processing).
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
80d34abf49 dmeventd: info status report
To quickly get info about some internal dmeventd status,
implment   'dmeventd -i' support.

Reported messages are some 'raw' internal informations mainly
useful to developers.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
637d812df5 dmeventd: unregister all devices on restart
Instead of just exiting in the middle of monitoring,
unregisted all monitored devices first and then exit.

To speedup this path, all send internal SIGINT when thread
unregiters itself, to wakup-up main sleeping loop.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
c31dcf3632 dmeventd: use return
Use 'return' instead of calling exit() when possible.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
396024713f dm-event: reset descriptors
Reset descriptors after closing them to -1.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
a203499ba3 dm-event: release buffer on dm_event_get_version
Avoid memory leak in this function.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
90713c84f3 dm-event: enhance timestamp for debugging
Add microseconds for timestamps in dm-event trace messages.
Also collect timestamps only when debugging when they are used.
2023-09-26 01:23:00 +02:00
Zdenek Kabelac
a8fd6de907 lvmdbusd: fix syntax warning
python3.12 reported SyntaxWarning: invalid escape sequence '\/'
2023-09-20 15:55:28 +02:00
Zdenek Kabelac
984c024ef2 typos: misc 2023-09-19 14:54:51 +02:00
Zdenek Kabelac
97770d5aeb debug: check for syscalls
Add some debug checks for possibly failing syscalls.
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
29630b2d7f dmeventd: move var set to locked section
It should not change the actual code flow, however make the
set of the current_event variable inside locked section.
2023-09-03 22:03:33 +02:00
David Teigland
c37416b6aa lvmlockd: client mutex ordering
Avoid deadlock between threads on mutexes (in theory.)
2023-08-31 13:15:07 -05:00
Zdenek Kabelac
728617d25d gcc: cleanup warnings
Correcting signess comparation.
Also use standalone /* fall through */ comment as that's
the only one supported by gcc to quiet warning.
2023-08-16 15:13:25 +02:00
Zdenek Kabelac
7171260b94 makefiles: install lvmdbusd executable
Use a different mechanism to ensure, lvmdbudd is executable at
install destination.
2023-07-13 21:31:18 +02:00
Zdenek Kabelac
5ce236a691 gcc: correct signess comparation
Compare int to int and unsigned to unsigned...
2023-07-13 21:31:18 +02:00
Zdenek Kabelac
491ee5d106 cov: hide some messages
Living with these...
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
4d64838048 cov: drop unneeded constness
If we want to have const structure - use a const pointer to avoid,
however making individual members const make it only assingle
in construct time and we already violate this logic since
we memcpy into the structure -  so drop these unnecessary consts...
2023-06-09 18:01:16 +02:00
Zdenek Kabelac
d418fc14f4 cov: hide some false positives
Hide some false positives.

Note: there must not a be blank line after coverity hiding comment.
2023-05-10 16:19:46 +02:00
Zdenek Kabelac
afc02ae6e7 lvmdbus: preserve PATH envvar 2023-04-23 12:49:37 +02:00
Vojtech Trefny
7807672975 lvmdbusd: Add a flag to activate LVs in shared mode to Lv.Activate 2023-04-20 12:09:11 -05:00
Tony Asleson
300c8209a8 lvmdbusd: Correct seg. fault on s390x ELN
syscall 186 is specific to x86 64bit.  As this is different from arch
to arch and between same arch different arch size we will only grab
thread ID using built-in python support if it is supported.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2166931
2023-03-30 11:04:49 -05:00
Tony Asleson
f7ca470abe lvmdbusd: Correct locking for _common_log
Reduce the lock time and include the flush in the lock.

Reported by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-03-30 11:04:42 -05:00
Adam Williamson
d6f8f59239 Fix import of utils from lvmdbusd.cfg
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2023-03-21 22:42:25 -05:00
Vojtech Trefny
ddfe839dd1 lvmdbusd: Add a new 'Shared' property to the Vg interface
Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
2023-03-15 09:09:38 -05:00