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

1818 Commits

Author SHA1 Message Date
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
Tony Asleson
66e79aab36 lvmdbusd: Add a retries during initial load
When the daemon is starting we do an initial fetch of lvm state.  If we
happened to get some type of failure with lvm during this time we would
exit.  During error injection testing this happened enough that
the unit tests were unable to finish.  Add retries to ensure we can get
started during error injection testing.
2023-03-10 12:51:53 -06:00
Tony Asleson
1949afa24b lvmdbusd: Handle missing key in get_key
When we sort the LVs, we can stumble on a missing key, protect against
this as well.

Seen in error injection testing:
Traceback (most recent call last):
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 198, in update_thread
    num_changes = load(*_load_args(queued_requests))
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 83, in load
    rc = MThreadRunner(_main_thread_load, refresh, emit_signal).done()
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/utils.py", line 726, in done
    raise self.exception
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/utils.py", line 732, in _run
    self.rc = self.f(*self.args)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 40, in _main_thread_load
    (lv_changes, remove) = load_lvs(
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 148, in load_lvs
    return common(
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/loader.py", line 37, in common
    objects = retrieve(search_keys, cache_refresh=False)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 72, in lvs_state_retrieve
    lvs = sorted(cfg.db.fetch_lvs(selection), key=get_key)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 35, in get_key
    pool = i['pool_lv']
KeyError: 'pool_lv'
2023-03-10 12:51:53 -06:00
Tony Asleson
3d854b39bd lvmdbusd: Replace assert with exception
Instead of using an assert we will raise an LvmBug exception
2023-03-10 12:51:53 -06:00
David Teigland
da44f2b6fe lvmlockd: clean up get_local_nodeid
Hard to see if fclose calls were correct, and coverity couldn't figure
it out either, so make it clear.
2023-03-08 11:11:32 -06:00
Tony Asleson
c8f2125b85 lvmdbusd: Add needed env. variables
When running lvmdb.py by itself for testing we need these.
2023-03-06 10:26:44 -06:00
Tony Asleson
df6120e9f7 lvmdbusd: Move cfg.lvmdebug data init
Move this to the cfg file itself, so that initialization runs when it
gets processed.
2023-03-06 10:25:22 -06:00
Tony Asleson
8e27dfd405 lvmdbustest: Test duplicate VG rename 2023-03-03 11:17:30 -06:00
Tony Asleson
4cbe789f9c lvmdbusd: Remove unused import 2023-02-27 09:57:18 -06:00
Tony Asleson
b0e75bd356 lvmdbusd: Add lock to prevent concurrent lvm shell access
There is a window of time where the following can occur.

1. An API request is in process to the lvm shell, we have written some
   command to the lvm shell and we are blocked on that thread waiting
2. A signal arrives to the daemon which causes us to exit.  The signal
   handling code path goes directly to the lvm shell and writes
   "exit\n".  This causes the lvm shell to simply exit.
3. The thread that was waiting for a response gets an EIO as the child
   process has exited.  This bubbles up a failure.

This is addressed by placing a lock in the lvm shell to prevent
concurrent access to the shell.  We also gather additional debug data
when we get an error in the lvm shell read path.  This should help if
the lvm shell exits/crashes on its own.
2023-02-27 09:07:43 -06:00
David Seifert
2b7fa40aac configure.ac: add STATIC_LDFLAGS
Add support for specif STATIC_LDFLAGS when linking static binaries.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
ad66600e48 configure.ac: update dlm check
Check for pkg-config --libs libdlm_lt  and test if the returned value
contains word 'pthread' - if so, it's likely a buggy result from
incorrect config file and use directly  -ldlm_lt for this case.
2023-02-23 16:46:35 +01:00
Tony Asleson
e18d60b336 lvmdbusd: Disable collecting lvm debug data by default 2023-02-20 12:01:53 -06:00
Tony Asleson
5561281f0a lvmdbusd: Fix grammar 2023-02-20 12:01:53 -06:00
Zdenek Kabelac
d58b475f63 makefiles: move include earlier 2023-02-17 00:00:12 +01:00
Zdenek Kabelac
c23d09bbce configure.ac: use standardized LIBS and CFLAGS
Convert lvmlockd to use configure _LIBS and _CFLAGS for
discovered libraries.

TODO: ATM we ignore discovered libdlm and use libdlm_lt instead.
Also libseagate_ilm is hard to find unicorn for testing.
2023-02-17 00:00:12 +01:00
Zdenek Kabelac
d106ac04ab configure.ac: use LIBSYSTEMD
Convert naming SYSTEMD_CFLAGS/LIB -> LIBSYSTEMD_CFLAGS/LIBS
to better fit library check for libsystemd.

Build lvmlockd with SD_NOTIFY when we have defined LIBSYSTEMD_LIBS.
2023-02-17 00:00:12 +01:00
Zdenek Kabelac
50f73de4b2 makefiles: use configured systemd library paths
Use discovered/selected systemd library from configure.
2023-02-13 13:41:59 +01:00
Zdenek Kabelac
e3534d0f68 lvm: fix typos
Patch aec5e573af was fixing some
of typos only in generated file, but they need to be fixed in
the source files.
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
0ec087e8b8 debug: compatibility with x32 ABI
Keep the conversion 64bit as on x32 arch time_t is 64bit value
and we may loose precision  (y2038).

TODO: like use universal string for time printing as in log/log.c
_set_time_prefix()
2023-02-01 11:47:47 +01:00
Zdenek Kabelac
8f091d3798 cov: use long type for time_t calcs
Some for y38k - calculations can handle 64b time_t.
2022-12-20 15:04:36 +01:00
David Teigland
55b29c1c3d lvmlockd: fix missing closedir
in get_local_nodeid from recent lock purge feature:
  lvmlockd: purge the lock resources left in previous lockspace
2022-12-01 09:55:11 -06:00
Tony Asleson
e63b0c7262 lvmdbusd: Add command_log_selection to command line
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145114
2022-11-29 12:56:55 -06:00
Tony Asleson
8f60c49451 lvmdbusd: Move get_error_msg to utils
Moving this so we can re-use outside of lvm_shell_proxy.
2022-11-29 12:56:55 -06:00
Sam James
fdd8feb60e lvmpolld: fix strerror_r check for musl
We can't assume that strerror_r returns char* just because _GNU_SOURCE is
defined. We already call the appropriate autoconf test, so let's use its
result (STRERROR_R_CHAR_P).

Note that in configure, _GNU_SOURCE is always set, but we add a defined
guard just in case for futureproofing.

Bug: https://bugs.gentoo.org/869404
2022-11-25 15:55:23 +01:00