lvm2.git
10 days agopost-release 2172807471
Marian Csontos [Fri, 21 Nov 2025 19:06:45 +0000 (20:06 +0100)]
post-release

10 days agopre-release 2.03.37 2172807719 v2_03_37
Marian Csontos [Fri, 21 Nov 2025 19:06:45 +0000 (20:06 +0100)]
pre-release 2.03.37

10 days agoWHATS_NEW: update
Marian Csontos [Fri, 21 Nov 2025 18:57:49 +0000 (19:57 +0100)]
WHATS_NEW: update

10 days agomake: generate
Marian Csontos [Fri, 21 Nov 2025 18:59:45 +0000 (19:59 +0100)]
make: generate

10 days agolvscan: blockdevice option is unused 2172412680
David Teigland [Fri, 21 Nov 2025 15:42:57 +0000 (09:42 -0600)]
lvscan: blockdevice option is unused

10 days agotest: drop usage of LVM_BINARY 2172403811
Zdenek Kabelac [Fri, 21 Nov 2025 15:35:48 +0000 (16:35 +0100)]
test: drop usage of LVM_BINARY

Actually we don't want ot define this variable to better
test real installed lvm2-testsuite package

10 days agospec: build rpm with timestamp of current date
Zdenek Kabelac [Fri, 21 Nov 2025 15:35:15 +0000 (16:35 +0100)]
spec: build rpm with timestamp of current date

10 days agolvmpersist: remove unregister error message 2170817323
David Teigland [Thu, 20 Nov 2025 21:24:50 +0000 (15:24 -0600)]
lvmpersist: remove unregister error message

If PR was already stopped, stopping PR again would
generate an "sg_persist unregiser error" message
when each sg_persist command returned an error.
The actual result of the lvmpersist stop command
is determined by checking that the key is removed,
not by the sg_persist exit code.  If the key is not
removed from any device, then the command fails with
another higher level error message.

11 days agomake: generate 2170288633
Zdenek Kabelac [Thu, 20 Nov 2025 15:50:44 +0000 (16:50 +0100)]
make: generate

11 days agorevert "debug dmevent"
Zdenek Kabelac [Thu, 20 Nov 2025 15:50:13 +0000 (16:50 +0100)]
revert "debug dmevent"

Unwanted.

11 days agodebug dmevent 2170196737
Zdenek Kabelac [Wed, 19 Nov 2025 23:22:25 +0000 (00:22 +0100)]
debug dmevent

11 days agotest: umounting by dmeventd
Zdenek Kabelac [Wed, 19 Nov 2025 23:21:58 +0000 (00:21 +0100)]
test: umounting by dmeventd

Correct and simplify test.
Use LVM_BINARY for path to lvm binary used by script.

11 days agotest: aux updates
Zdenek Kabelac [Wed, 19 Nov 2025 23:22:19 +0000 (00:22 +0100)]
test: aux updates

Ssend eval stderr to null as there is no need for extra trace
of eval values in teardown.

Drop passing args to lvmpoll_dump.

11 days agotest: show lvmlockd debug info in testing
Zdenek Kabelac [Thu, 20 Nov 2025 09:51:09 +0000 (10:51 +0100)]
test: show lvmlockd debug info in testing

11 days agolvmlockd: reduce require of two SIGTERM signals in shutdown
Zdenek Kabelac [Thu, 20 Nov 2025 09:49:41 +0000 (10:49 +0100)]
lvmlockd: reduce require of two SIGTERM signals in shutdown

When lvmlockd received SIGTERM, for_each_lockspace() would signal
lockspace threads to stop and then immediately check if they were
done. Due to scheduling, threads often hadn't finished yet, causing
for_each_lockspace() to return a non-zero count, which reset
daemon_quit to 0. This required a second SIGTERM to actually exit,
adding delays to daemon shutdown in tests.

Two issues were fixed:

1. Fixed mutex synchronization for thread_done flag:
   The lockspace thread was setting ls->thread_done while holding
   only lockspaces_mutex, but for_each_lockspace() was reading it
   while holding only ls->mutex, creating a race condition. Now
   thread_done is set while holding both mutexes in the correct
   order (lockspaces_mutex first, then ls->mutex).

2. Added wait loop during daemon shutdown:
   When daemon_quit is set and threads are signaled to stop,
   for_each_lockspace() now waits up to 100ms (checking every 1ms)
   for threads to actually finish before checking their status.
   This wait only activates during daemon shutdown to avoid adding
   delays to normal lockspace operations.

In practice, threads finish in 1-2ms, so shutdown completes quickly
with a single SIGTERM.

Co-Authored-By: Claude <noreply@anthropic.com>
11 days agodeviced_ids: extended refresh period 2168538272
David Teigland [Mon, 17 Nov 2025 21:47:42 +0000 (15:47 -0600)]
deviced_ids: extended refresh period

If an automatic device ID refresh is triggered, and does not find
some device IDs, then extend the refresh behavior for a number of
seconds, configured in lvm.conf:

device_ids_refresh=<seconds>  accepts 10-600 seconds

Previous settings remain the same:

device_ids_refresh=0  disables automatic refresh
device_ids_refresh=1  enables one refresh

While the refresh period is extended, a new line appears in
system.devices: REFRESH_UNTIL=<YYYYMMDDHHMMSS>

The timestamp is written by the first lvm command to trigger the
refresh, and is set to current time + device_ids_refresh seconds.
REFRESH_UNTIL is removed when all devices are found, or when the
time expires.

12 days agotest: tune slowdown 2168190076
Zdenek Kabelac [Wed, 19 Nov 2025 17:57:31 +0000 (18:57 +0100)]
test: tune slowdown

Here we have some tricky case - ATM we are using suspend with
flushing when changing DM tables for cache volume - but this
can take too much time with our delayed device.
So trying to minimize chance to hit this race on very fast machines.

12 days agotest: improve lvmpolld_talk error messages
Zdenek Kabelac [Tue, 18 Nov 2025 21:55:16 +0000 (22:55 +0100)]
test: improve lvmpolld_talk error messages

Refactor lvmpolld_talk() to provide clearer diagnostics when connection
fails. Previously misreported socket failures as "nc not available".
Now distinguishes between missing tools, missing socket, and connection
errors with actual error details.

Co-Authored-By: Claude <noreply@anthropic.com>
12 days agotest: enhance _check_size
Zdenek Kabelac [Tue, 18 Nov 2025 22:22:55 +0000 (23:22 +0100)]
test: enhance _check_size

Grab lv_size as the first thing.
Make tests easier and drop '_not' variants.

12 days agocache: add debug message
Zdenek Kabelac [Wed, 19 Nov 2025 17:35:48 +0000 (18:35 +0100)]
cache: add debug message

12 days agolibdaemon: log which signal triggered daemon shutdown
Zdenek Kabelac [Tue, 18 Nov 2025 22:22:34 +0000 (23:22 +0100)]
libdaemon: log which signal triggered daemon shutdown

Capture and log the signal number that triggers daemon shutdown.
This helps diagnose unexpected daemon terminations during testing.

13 days agotest: add more debug for abort case 2164898522
Zdenek Kabelac [Tue, 18 Nov 2025 11:05:52 +0000 (12:05 +0100)]
test: add more debug for abort case

Improve logging to better capture lvconvert problem.

13 days agodmeventd: drop unused var
Zdenek Kabelac [Mon, 17 Nov 2025 19:53:28 +0000 (20:53 +0100)]
dmeventd: drop unused var

fdd no longer needed.

13 days agosignals: rename interruptible_usleep to sigint_usleep
Zdenek Kabelac [Tue, 18 Nov 2025 09:49:54 +0000 (10:49 +0100)]
signals: rename interruptible_usleep to sigint_usleep

The interruptible_usleep() function returned 1 on interruption (error)
and 0 on success, opposite to LVM2 convention where 1=success, 0=failure.

Changes:
- Rename to sigint_usleep() to align with sigint_*() function family
- Invert return: 1 if sleep completed, 0 if interrupted
- Update all call sites to use ! operator for error checking

This makes the API more intuitive as ! clearly indicates error path
and return values match standard LVM2 conventions.

Co-Authored-By: Claude <noreply@anthropic.com>
13 days agoWHATS_NEW 2164662652
Peter Rajnoha [Tue, 18 Nov 2025 08:59:02 +0000 (09:59 +0100)]
WHATS_NEW

13 days agomake: generate
Peter Rajnoha [Tue, 18 Nov 2025 08:54:24 +0000 (09:54 +0100)]
make: generate

13 days agolvmconfig: make it possible to print various config types in list mode
Peter Rajnoha [Fri, 14 Nov 2025 09:46:28 +0000 (10:46 +0100)]
lvmconfig: make it possible to print various config types in list mode

For example:

❯  lvmconfig --type diff
report {
compact_output=1
headings=2
}
activation {
polling_interval=1
}

❯  lvmconfig --type diff --list
report/compact_output=1
report/headings=2
activation/polling_interval=1

13 days agoconfig: add support for list mode for all cfg_def_tree_t types
Peter Rajnoha [Fri, 14 Nov 2025 08:42:07 +0000 (09:42 +0100)]
config: add support for list mode for all cfg_def_tree_t types

Before, we printed only CFG_DEF_TREE_LIST as a list instead of
structured tree. But we can also print all the other types as lists
if needed which might be more suitable.

This patch adds a 'listmode' switch to struct config_def_tree_spec
so that the config printing functions (_out_prefix_fn, _out_line_fn,
_out_suffix_fn) can then decide on the actual format.

2 weeks agotest: use 4k blocks for fs 2163403800
Zdenek Kabelac [Mon, 17 Nov 2025 18:13:16 +0000 (19:13 +0100)]
test: use 4k blocks for fs

2 weeks agotest: correcting wait shell vars
Zdenek Kabelac [Mon, 17 Nov 2025 17:55:00 +0000 (18:55 +0100)]
test: correcting wait shell vars

2 weeks agotest: just skip test if there are suspended devices
Zdenek Kabelac [Mon, 17 Nov 2025 16:34:48 +0000 (17:34 +0100)]
test: just skip test if there are suspended devices

2 weeks agotest: use should for a while
Zdenek Kabelac [Mon, 17 Nov 2025 15:17:38 +0000 (16:17 +0100)]
test: use should for a while

2 weeks agotest: aux type 2162850760
Zdenek Kabelac [Mon, 17 Nov 2025 13:44:00 +0000 (14:44 +0100)]
test: aux type

Removed extra '/'.

2 weeks agotest: missed removal of clvmd testing
Zdenek Kabelac [Mon, 17 Nov 2025 13:40:05 +0000 (14:40 +0100)]
test: missed removal of clvmd testing

2 weeks agodmfilemap: stray close code reuse
Zdenek Kabelac [Mon, 17 Nov 2025 13:36:38 +0000 (14:36 +0100)]
dmfilemap: stray close code reuse

Reuse header file from libdaemon directory here.
It has better code to close stray descriptors - since there
are systems with very high numbers of supported opened descriptors.

In case project would ever split header file would need to be copied.

Also use >=  check for valid file descriptor.

2 weeks agoWHATS_NEW: update 2162742590
Zdenek Kabelac [Mon, 17 Nov 2025 12:55:27 +0000 (13:55 +0100)]
WHATS_NEW: update

2 weeks agotest: aux rename wait variable
Zdenek Kabelac [Mon, 17 Nov 2025 00:12:03 +0000 (01:12 +0100)]
test: aux rename wait variable

2 weeks agotest: rework bare wait commands
Zdenek Kabelac [Sun, 16 Nov 2025 23:39:26 +0000 (00:39 +0100)]
test: rework bare wait commands

Replace bare 'wait' commands with specific PID waiting to prevent
test hangs when base shell runs process in the background.

When tests use 'wait' without arguments, it waits for ALL background
processes. This may causes tests to hang indefinitely.
Fix by capturing background job PIDs and waiting
only for those specific processes.

Pattern changed from:
  some_command &
  wait

To:
  some_command &
  SOME_PID=$!
  wait "$SOME_PID" || true

The '|| true' handles cases where the process has already exited.

Co-Authored-By: Claude <noreply@anthropic.com>
2 weeks agotest: aux kill_sleep_kill
Zdenek Kabelac [Mon, 17 Nov 2025 00:13:15 +0000 (01:13 +0100)]
test: aux kill_sleep_kill

2 weeks agotest: remove clvmd testing infrastructure
Zdenek Kabelac [Sat, 15 Nov 2025 19:56:26 +0000 (20:56 +0100)]
test: remove clvmd testing infrastructure

Remove all clvmd-related test code since clvmd was removed from lvm2.
This includes prepare_clvmd(), SKIP_WITH/WITHOUT_CLVMD variables,
LOCAL_CLVMD conditional blocks, and outdated comments. Tests now run
unconditionally with non-cluster behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
2 weeks agotest: simplify corrupt_dev() function
Zdenek Kabelac [Sat, 15 Nov 2025 13:09:52 +0000 (14:09 +0100)]
test: simplify corrupt_dev() function

Replace strings+grep with grep -oba for byte pattern search. This is
more direct and efficient - grep finds the byte offset, we extract it
with cut, and use dd to overwrite at that position. Also add
conv=notrunc to prevent truncation.

2 weeks agotest: aux easier code for building config
Zdenek Kabelac [Fri, 14 Nov 2025 12:45:16 +0000 (13:45 +0100)]
test: aux easier code for building config

For older bash use more simple code.

Co-Authored-By: Claude <noreply@anthropic.com>
2 weeks agodaemonize: fix file descriptor leaks on error paths
Zdenek Kabelac [Mon, 17 Nov 2025 09:32:50 +0000 (10:32 +0100)]
daemonize: fix file descriptor leaks on error paths

Fix resource leaks in daemonization code across multiple daemons by
properly closing /dev/null file descriptor on all error paths.

Changes across all daemonizing code:
- Skip dup2() when fd already equals target (no-op optimization)
- Close fd on error paths before exit (prevents leak)
- Add Coverity annotations on both error and success paths
- Use consistent == -1 pattern for dup2() error checks
- Remove explicit close(0/1/2) in cmirrord (dup2 handles atomically)

This eliminates resource leak warnings from static analyzers while
maintaining correct daemonization behavior.

2 weeks agolvmpolld: signal child processes before pthread_cancel
Zdenek Kabelac [Mon, 17 Nov 2025 00:04:58 +0000 (01:04 +0100)]
lvmpolld: signal child processes before pthread_cancel

Fix lvmpolld shutdown to properly terminate child lvpoll processes
before cancelling monitoring threads.

Previously, pthread_cancel was called on monitoring threads while
their child processes were still running. This could leave orphaned
lvpoll processes and cause shutdown delays.

Now send SIGTERM to child lvpoll processes first, then immediately
cancel the monitoring threads which will reap the children during
their cleanup.

This significantly reduces shutdown time in tests with lvmpolld.

Co-Authored-By: Claude <noreply@anthropic.com>
2 weeks agolibdaemon: improve graceful shutdown of client threads
Zdenek Kabelac [Sun, 16 Nov 2025 23:45:54 +0000 (00:45 +0100)]
libdaemon: improve graceful shutdown of client threads

Optimize daemon shutdown to allow client threads to exit quickly
without blocking on socket operations, and refactor code to improve
maintainability.

Functional improvements:

1. Close listening socket BEFORE waiting for client threads
   - Prevents new connections during shutdown
   - Unlinks socket file earlier in shutdown sequence

2. Shutdown all client sockets with SHUT_RDWR
   - Interrupts blocking read() calls in client threads
   - Allows threads to exit immediately instead of hanging
   - Uses shutdown() to wake blocked threads, not just close()

3. Add early exit check in client thread loop
   - Check _shutdown_requested at start of while loop
   - Allows threads to exit gracefully when shutdown is initiated

Code organization improvements:

4. Eliminate goto statement
   - Replace "goto out" with direct function calls
   - Improves code readability and control flow clarity
   - Both daemon_main and daemon_init paths now follow same pattern

5. Extract _shutdown_sockets() helper function
   - Centralizes all socket shutdown logic in one place
   - Handles both listening socket close and client socket shutdown
   - Respects _systemd_activation flag for socket file unlinking
   - Includes comprehensive logging for shutdown operations

6. Extract _daemon_cleanup() helper function
   - Common cleanup path for both daemon_main and normal execution
   - Handles daemon_fini callback, logging, pidfile removal
   - Eliminates code duplication between execution paths

This allows daemon to shutdown cleanly without client threads
blocking on socket operations, enabling faster test execution and
cleaner shutdown sequences.

Co-Authored-By: Claude <noreply@anthropic.com>
2 weeks agocov: missing free
Zdenek Kabelac [Mon, 17 Nov 2025 09:47:52 +0000 (10:47 +0100)]
cov: missing free

With recent commit f7a308d2e71e332a9cbc01d917182ba562943b77
we missed to relase allocated idname.

2 weeks agodmeventd: fix missing lock when reading _timeout_thread_id
Zdenek Kabelac [Mon, 17 Nov 2025 09:48:01 +0000 (10:48 +0100)]
dmeventd: fix missing lock when reading _timeout_thread_id

Acquire _timeout_mutex before reading _timeout_thread_id to match
the locking pattern used when writing this variable. While the
variable is only written once and never changed, static analyzers
flag the inconsistent lock usage.

Release mutex before pthread_join() to avoid holding locks during
blocking operations.

2 weeks agomake: generate 2158653189
Zdenek Kabelac [Fri, 14 Nov 2025 10:19:15 +0000 (11:19 +0100)]
make: generate

2 weeks agotest: we need fs on origin as well 2158651752
Zdenek Kabelac [Fri, 14 Nov 2025 10:04:10 +0000 (11:04 +0100)]
test: we need fs on origin as well

Last commit made fs only on snapshot - but it's needed also on origin.

2 weeks agotest: bash clenaups 2158506479
Zdenek Kabelac [Thu, 13 Nov 2025 22:54:30 +0000 (23:54 +0100)]
test: bash clenaups

Various improvemetns to make shellcheck less complaining.

2 weeks agotest: check simplified
Zdenek Kabelac [Thu, 13 Nov 2025 14:17:18 +0000 (15:17 +0100)]
test: check simplified

We do not need to use 5 second sleep here for checking
opened device cannot be removed - just check with mounted
snapshot - which will also be seen as opened device - but
with known holder - thus 5sec retry loop is avoided.

2 weeks agotest: require newer target
Zdenek Kabelac [Thu, 13 Nov 2025 13:51:11 +0000 (14:51 +0100)]
test: require newer target

2 weeks agoman: update pvmove for pvmove_max_segment_size_mb
Zdenek Kabelac [Wed, 12 Nov 2025 22:56:00 +0000 (23:56 +0100)]
man: update pvmove for pvmove_max_segment_size_mb

2 weeks agodmeventd: cleanup
Zdenek Kabelac [Thu, 13 Nov 2025 17:10:42 +0000 (18:10 +0100)]
dmeventd: cleanup

Show help options in alphabetic order.

2 weeks agovgchange: limit persist stop in lockstop 2157562827
David Teigland [Thu, 13 Nov 2025 19:55:08 +0000 (13:55 -0600)]
vgchange: limit persist stop in lockstop

"vgchange --lockstop --persist stop" should skip the
persist_stop() on a VG without PR required, otherwise
it hits errors attempting to stop PR on VGs where it's
not used.

2 weeks agotest: select-report: fix checking of failure scenarios 2156259285
Peter Rajnoha [Thu, 13 Nov 2025 08:53:36 +0000 (09:53 +0100)]
test: select-report: fix checking of failure scenarios

2 weeks agoman: update lvmdevices refresh info 2155453664
David Teigland [Wed, 12 Nov 2025 21:25:53 +0000 (15:25 -0600)]
man: update lvmdevices refresh info

2 weeks agotest: fix lots of not usage 2154464032
Zdenek Kabelac [Tue, 11 Nov 2025 23:44:18 +0000 (00:44 +0100)]
test: fix lots of not usage

Added lots of FIXME - since these tests
are not working properly - but ATM it's unclear
what they are supposed to test.

2 weeks agotest: fix use of not mimages|mirrorlog....
Zdenek Kabelac [Wed, 12 Nov 2025 12:24:28 +0000 (13:24 +0100)]
test: fix use of not mimages|mirrorlog....

2 weeks agotest: fix use of not is_lv_opened_
Zdenek Kabelac [Wed, 12 Nov 2025 12:09:09 +0000 (13:09 +0100)]
test: fix use of not is_lv_opened_

Correct the test and wait till dmeventd really umounts directory.

2 weeks agotest: fix typo group to grep
Zdenek Kabelac [Wed, 12 Nov 2025 11:53:20 +0000 (12:53 +0100)]
test: fix typo group to grep

We actually want to use 'not grep'.

2 weeks agotest: fix use of not sel
Zdenek Kabelac [Wed, 12 Nov 2025 11:45:59 +0000 (12:45 +0100)]
test: fix use of not sel

Looks like we need to fix 101%.

2 weeks agotest: fix use of not test
Zdenek Kabelac [Wed, 12 Nov 2025 11:00:53 +0000 (12:00 +0100)]
test: fix use of not test

Fixing 'not ' and making it more readable.
Handle blkid error code 2.

2 weeks agotest: fix use of not fill
Zdenek Kabelac [Wed, 12 Nov 2025 09:58:39 +0000 (10:58 +0100)]
test: fix use of not fill

2 weeks agomake: generate
Zdenek Kabelac [Wed, 12 Nov 2025 12:24:44 +0000 (13:24 +0100)]
make: generate

2 weeks agoconfig: stop logging that a default value is used 2153071560
David Teigland [Tue, 11 Nov 2025 20:36:28 +0000 (14:36 -0600)]
config: stop logging that a default value is used

default values are not interesting to see

2 weeks agolvmlockd: fix lock_args flags usage with dlm 2153053463
David Teigland [Tue, 11 Nov 2025 20:24:49 +0000 (14:24 -0600)]
lvmlockd: fix lock_args flags usage with dlm

lockd_lockargs_get_meta_flags() only applies to sanlock, and
would cause dlm lockspaces to fail beause it doesn't recognize
the cluster name in a dlm VG lock_args string.

2 weeks agolvmlockd: fix to allow for no vg_args 2153005580
David Teigland [Tue, 11 Nov 2025 19:46:46 +0000 (13:46 -0600)]
lvmlockd: fix to allow for no vg_args

2 weeks agoman: update lvmdevices 2152814922
David Teigland [Mon, 10 Nov 2025 21:51:56 +0000 (15:51 -0600)]
man: update lvmdevices

2 weeks agolvmdevices: update force option
David Teigland [Fri, 7 Nov 2025 01:28:25 +0000 (19:28 -0600)]
lvmdevices: update force option

When lvmdevices --update doesn't see any reason to update
system.devices, it doesn't update.  Let the user force an
update in case they see a reason to do it.

2 weeks agodevice_id: prevent incorrect dm uuid idtype
David Teigland [Thu, 6 Nov 2025 22:45:28 +0000 (16:45 -0600)]
device_id: prevent incorrect dm uuid idtype

If a dm-uuid-based device was added to system.devices, and
the wrong dm-based type was specified, then the system.devices
entry would have the correct idname but the wrong idtype. e.g.

lvmdevices --adddev /dev/mapper/mpatha --deviceidtype crypt_uuid
would add an entry with: IDTYPE=crypt_uuid IDNAME=mpath-<uuid>
rather than the correct: IDTYPE=mpath_uuid IDNAME=mpath-<uuid>

This mistaken type would not affect lvm, and the device would
be entirely usable.  The dm-based types (mpath, crypt, lvmlv)
were interchangable because they all read the device id from
the same dm/uuid sysfs file.

Fix this by adding a missing check that the dm uuid prefix is
correct for the specified idtype.  Also, accept an existing
system.devices file which contains this mistake.

2 weeks agolvmdevices: new option --listids shows id types and names for dev
David Teigland [Thu, 6 Nov 2025 21:30:12 +0000 (15:30 -0600)]
lvmdevices: new option --listids shows id types and names for dev

2 weeks agolvmdevices: new option --delid to delete device by device_id
David Teigland [Mon, 10 Nov 2025 22:31:30 +0000 (16:31 -0600)]
lvmdevices: new option --delid to delete device by device_id

2 weeks agolvmdevices: new option --addid to add device by device_id
David Teigland [Wed, 5 Nov 2025 21:55:37 +0000 (15:55 -0600)]
lvmdevices: new option --addid to add device by device_id

2 weeks agotest: aux improve daemon killing 2150888794
Zdenek Kabelac [Mon, 10 Nov 2025 23:03:15 +0000 (00:03 +0100)]
test: aux improve daemon killing

When daemon takes multiple pids, handle them via array.
(as recently made with lvmlockd)

2 weeks agomakefile: indent
Zdenek Kabelac [Mon, 10 Nov 2025 23:06:32 +0000 (00:06 +0100)]
makefile: indent

2 weeks agogcc: fix fp complain about use of unit
Zdenek Kabelac [Mon, 10 Nov 2025 22:27:30 +0000 (23:27 +0100)]
gcc: fix fp complain about use of unit

Just quiting warning.

2 weeks agovdo: add missing synchronization
Zdenek Kabelac [Mon, 10 Nov 2025 22:10:31 +0000 (23:10 +0100)]
vdo: add missing synchronization

After wiping, formating and deactivating vdopool volume,
we should wait on udev before we continue and activate
same volume again with different UUID.

3 weeks agorevert "test: update for new vg attr field" 2150444626
Zdenek Kabelac [Mon, 10 Nov 2025 18:22:31 +0000 (19:22 +0100)]
revert "test: update for new vg attr field"

This reverts commit 2855526824fd815bb0394eda3973d34cc4b985f7
for incorrect merging.
We already have 85bef39ed00dd4f657cb7781f2754f5bb5c5ac86.

3 weeks agotest: use should for race-prone RAID unrepairable check
Zdenek Kabelac [Mon, 10 Nov 2025 18:05:38 +0000 (19:05 +0100)]
test: use should for race-prone RAID unrepairable check

The test attempts to verify that RAID6 repair fails when too many devices
are unavailable. However, due to timing issues, the RAID array may
occasionally sync or partially repair before the test disables devices,
making the repair operation succeed when we expect it to fail.

Use 'should' to tolerate race conditions where:
- Fast RAID sync completes before devices are disabled
- Partial recovery happens despite disabled devices
- Background repair processes interfere with test expectations

This test typically fails as expected (unrepairable RAID), but can
legitimately pass in race conditions.

TODO: Implement more reliable control over RAID sync/repair timing to
ensure consistent test behavior.

3 weeks agotest: use should for race-prone cache dirty state check
Zdenek Kabelac [Mon, 10 Nov 2025 18:03:06 +0000 (19:03 +0100)]
test: use should for race-prone cache dirty state check

It's currently difficult to guarantee the cache remains dirty long enough
to trigger the expected filesystem corruption check. In rare race conditions,
the cache may flush and become clean before the uncache operation completes,
resulting in a clean filesystem when we expect corruption.

Use 'should' allow occasional test passes when the race condition results
in a clean cache.

TODO: Find a more reliable way to ensure cache stays dirty during test.

3 weeks agotest: add some missing local keywords
Zdenek Kabelac [Mon, 10 Nov 2025 15:36:39 +0000 (16:36 +0100)]
test: add some missing local keywords

3 weeks agospec: fix ldconfig_scriptlets macro for old RPM versions
Zdenek Kabelac [Mon, 10 Nov 2025 18:01:18 +0000 (19:01 +0100)]
spec: fix ldconfig_scriptlets macro for old RPM versions

Fix the ldconfig_scriptlets macro to work with RPM < 4.13 (Fedora < 24,
RHEL < 7.3) which don't support the %{!-option:...} conditional syntax.

Changes:
- Replace %{!-n:%{1}} with %%{?1} for positional parameter
- Add proper %% escaping: %{-n:-n} → %%{-n:-n %%{-n*}}
- Use %%{?1} instead of %{!-n:%{1}} to handle optional positional arg

The %{!-n:...} syntax (inverse conditional) was introduced in RPM 4.13.
Older versions like Fedora 19-23 (RPM 4.11-4.12) don't support it and
fail with "Package does not exist" error.

The new syntax works on both old and new RPM:
- %ldconfig_scriptlets libs
  → expands to: %post libs -p /sbin/ldconfig
- %ldconfig_scriptlets -n device-mapper-libs
  → expands to: %post -n device-mapper-libs -p /sbin/ldconfig

Fixes regression from commit d6d13f1c9 which introduced the macro but
used syntax incompatible with old RPM versions.

3 weeks agotest: check for presence of seagate_ilm command 2150114756
Zdenek Kabelac [Mon, 10 Nov 2025 15:18:41 +0000 (16:18 +0100)]
test: check for presence of seagate_ilm command

3 weeks agotest: use exit 1 call in stacktrace 2150068051
Zdenek Kabelac [Sun, 9 Nov 2025 23:30:10 +0000 (00:30 +0100)]
test: use exit 1 call in stacktrace

3 weeks agotest: remove unused --silent option from aux device functions
Zdenek Kabelac [Sun, 9 Nov 2025 10:29:46 +0000 (11:29 +0100)]
test: remove unused --silent option from aux device functions

Remove the unused --silent parameter from aux device management functions:
  - disable_dev()
  - enable_dev()
  - restore_from_devtable()

The --silent option was declared but is never actually used in the function
implementations - no code checked or acted upon this flag.

Updated callers in test scripts:
  - lvchange-raid-transient-failures.sh
  - lvconvert-repair-transient.sh

Both scripts called disable_dev/enable_dev with --silent flag, which is
now removed since it had no effect.

3 weeks agotest: add declarative test requirement options
Zdenek Kabelac [Sun, 9 Nov 2025 13:23:17 +0000 (14:23 +0100)]
test: add declarative test requirement options

Add new inittest.sh options to declare test requirements declaratively:

New options:
  --with-multi-host: Test requires LVM_TEST_MULTI_HOST to be set
  --with-idm-failure: Test requires LVM_TEST_FAILURE to be set
  --with-lock-type-idm: Test requires LVM_TEST_LOCK_TYPE_IDM to be set
  --with-lock-type-dlm: Test requires LVM_TEST_LOCK_TYPE_DLM to be set
  --with-lock-type-sanlock: Test requires LVM_TEST_LOCK_TYPE_SANLOCK to be set

Implementation:
  - Initialize REQUIRE_* variables to 1 (enabled by default)
  - When option is specified, read from environment variable with :-0 default
  - Skip test if REQUIRE_* = 0 (environment variable not set or set to 0)
  - Tests declare requirements upfront in inittest sourcing line

Benefits:
  - Declarative: Requirements visible at top of test file
  - Consistent: Follows --skip-with-* pattern
  - No code duplication: Eliminates manual [ -z "$VAR" ] && skip checks
  - Self-documenting: Clear what environment each test needs

Example usage:
    Before: . lib/inittest --skip-with-lvmpolld
            [ -z "$LVM_TEST_MULTI_HOST" ] && skip

    After:  . lib/inittest --skip-with-lvmpolld --with-multi-host

Updated 20 test scripts to use declarative options:
  - Multi-host tests: multi_hosts_*.sh (8 files)
  - IDM failure tests: idm_*_failure*.sh, lvmlockd_failure.sh (5 files)
  - Lock type setup: aa-lvmlockd-{idm,dlm}-prepare.sh (2 files)
  - Lock type removal: zz-lvmlockd-{idm,dlm}-remove.sh (2 files)
  - Stress tests: stress_*.sh (3 files)

3 weeks agotest: optimize lvm-wrapper.sh bash
Zdenek Kabelac [Sat, 8 Nov 2025 20:19:25 +0000 (21:19 +0100)]
test: optimize lvm-wrapper.sh bash

Change shebang from /bin/sh to /usr/bin/env bash for consistency.
Convert all test commands to [[ ]] for better performance.

3 weeks agotest: optimize utils.sh bash
Zdenek Kabelac [Sat, 8 Nov 2025 20:44:54 +0000 (21:44 +0100)]
test: optimize utils.sh bash

Convert test/[ ] to [[ ]] for better performance.
Consolidate multi-line test conditions into single [[ ]] blocks.

Key changes:
  - Replace all test/[ ] with [[ ]] for better performance
  - Combine multiple test conditions with && into single [[ ]] blocks
  - Convert test && { } patterns to if [[ ]] for multi-line blocks
  - Standardize LVM_TEST_NODEBUG to use numeric comparison :-0

Notable improvements:
  - STACKTRACE(): Changed from
      test -z "$LVM_TEST_NODEBUG" && test -f TESTNAME && {
    to
      if [[ "${LVM_TEST_NODEBUG:-0}" -eq 0 && -f TESTNAME ]]; then

  - Unified multi-condition checks into single [[ ]] expressions
    (avoids multiple external command forks)

Performance benefits:
  - [[ ]] is bash built-in, no fork overhead
  - Single [[ ]] for multiple conditions more efficient than chained test

3 weeks agotest: fix aux heredoc indentation in generate_config()
Zdenek Kabelac [Sat, 8 Nov 2025 20:12:16 +0000 (21:12 +0100)]
test: fix aux heredoc indentation in generate_config()

Use tab indentation in heredocs with <<-EOF.
The - operator strips leading tabs for clean output.

3 weeks agotest: optimize aux.sh bash
Zdenek Kabelac [Sat, 8 Nov 2025 15:08:53 +0000 (16:08 +0100)]
test: optimize aux.sh bash

Convert test/[ ] to [[ ]] for better performance.
Replace $(seq) with brace expansion and C-style loops.
Use compact [[ ]] && command for single-line cases.
Keep if/then/fi blocks for multi-line readability.

Key optimizations:
  - Replace all test/[ ] with [[ ]] (eliminates external command forks)
  - Replace $(seq 1 N) with {1..N} brace expansion
  - Replace $(seq 0 $((N-1))) with C-style for (( i=0; i<N; i++ ))
  - Use [[ ]] && command pattern for simple one-line conditionals

Performance benefits:
  - Brace expansion {1..N} is built into bash, no fork needed
  - [[ ]] is bash keyword, faster than external [ command
  - C-style loops avoid subshell overhead of $(seq)

3 weeks agotest: optimize check.sh bash
Zdenek Kabelac [Sat, 8 Nov 2025 19:22:36 +0000 (20:22 +0100)]
test: optimize check.sh bash

Replace test/[ commands with [[ ]] for better performance.
Consolidate multi-line conditions into single [[ ]] blocks.

Changes:
  - Convert all test/[ ] to [[ ]]
  - Simplify multi-line test conditions
  - Improve readability of conditional expressions
  - Maintain consistent style across check functions

This is part of a broader effort to modernize the test suite bash code,
improve performance, and ensure consistency.

3 weeks agotest: optimize inittest.sh bash
Zdenek Kabelac [Sat, 8 Nov 2025 19:43:10 +0000 (20:43 +0100)]
test: optimize inittest.sh bash

Convert test/[ ] to [[ ]] for better performance and consistency.
Use compact [[ ]] && command form only for single-line cases.
Keep if/then/fi blocks for multi-line readability.

Change all boolean-style test variables from empty-string defaults
to numeric zero defaults for consistency and correctness.

Problem:
  Mixed initialization patterns caused bugs. For example,
  LVM_TEST_DEVICES_FILE=${LVM_TEST_DEVICES_FILE-} defaults to empty
  string, but when set to "0", tests like [[ -n "$VAR" ]] incorrectly
  treat "0" as true (non-empty string).

Solution:
  Standardize all boolean test variables to use :-0 (default to zero)
  and test with != 0 / = 0 (numeric comparison) instead of -n/-z
  (string empty/non-empty).

Changes:
  - Default to 0 for 17 boolean variables:
    LVM_TEST_NODEBUG, LVM_TEST_LVM1, LVM_TEST_FAILURE,
    LVM_TEST_MULTI_HOST, LVM_TEST_LVMLOCKD, LVM_TEST_LVMLOCKD_TEST,
    LVM_TEST_LVMPOLLD, LVM_TEST_DEVICES_FILE,
    LVM_TEST_LOCK_TYPE_DLM, LVM_TEST_LOCK_TYPE_SANLOCK,
    LVM_TEST_LOCK_TYPE_IDM, SKIP_WITHOUT_CLVMD, SKIP_WITH_CLVMD,
    SKIP_ROOT_DM_CHECK, SKIP_WITH_DEVICES_FILE, SKIP_WITH_LVMLOCKD,
    SKIP_WITH_LVMPOLLD

  - Update all conditional tests from -n/-z to != 0 / = 0

This makes the intent clear (numeric boolean), prevents string
comparison bugs, and works correctly with strict mode.

Key change: Updated from "13 boolean variables" to "17 boolean variables"
and added the 4 SKIP_* variables to the list (SKIP_ROOT_DM_CHECK,
SKIP_WITH_DEVICES_FILE, SKIP_WITH_LVMLOCKD, SKIP_WITH_LVMPOLLD).

3 weeks agotest: don't use global wait
Zdenek Kabelac [Sun, 9 Nov 2025 23:38:24 +0000 (00:38 +0100)]
test: don't use global wait

3 weeks agotest: correct _reshape_layout arg order
Zdenek Kabelac [Mon, 10 Nov 2025 09:57:50 +0000 (10:57 +0100)]
test: correct _reshape_layout arg order

Swapped args in lvconvert-raid-reshape-size.sh

3 weeks agotest: comment unused invalid tests
Zdenek Kabelac [Sun, 9 Nov 2025 17:23:51 +0000 (18:23 +0100)]
test: comment unused invalid tests

These test never failed for the proper reason anyway,
and they are racy since we wait for sync anyway.

So fix the test, but keep them commented out.

3 weeks agotest: correct checked parameter
Zdenek Kabelac [Sun, 9 Nov 2025 17:24:16 +0000 (18:24 +0100)]
test: correct checked parameter

Compare proper value is 512.00k.
Otherwise this is 100% failing check.

3 weeks agotest: update for new vg attr field
Zdenek Kabelac [Mon, 10 Nov 2025 10:51:32 +0000 (11:51 +0100)]
test: update for new vg attr field

3 weeks agospec: improve RPM packaging with backward-compatible fixes
Zdenek Kabelac [Fri, 7 Nov 2025 21:30:33 +0000 (22:30 +0100)]
spec: improve RPM packaging with backward-compatible fixes

Fix multiple RPM spec file issues while maintaining compatibility with
RHEL 6+ and Fedora 19+:

1. Add missing %{systemd_version} macro definition (set to 219)
   Fixes undefined macro warnings in dbusd package requirements

2. Fix %clean section syntax bug and make it conditional
   - Replaced buggy: test -n rpm-no-clean (missing quotes)
   - Made conditional: only for Fedora < 18 and RHEL < 7
   - %clean section deprecated in modern RPM

3. Make ldconfig scriptlets conditional using macro
   - Introduce ldconfig_scriptlets macro in macros.inc
   - Macro handles -n flag for subpackages (e.g., device-mapper-libs)
   - Expands to scriptlets on Fedora < 28 and RHEL < 8, %{nil} otherwise
   - Replaces 3 repetitive conditional blocks (18 lines -> 3 lines)
   - Affects: libs, device-mapper-libs, device-mapper-event-libs

4. Add conditional BuildRequires for systemd-rpm-macros
   - Only for Fedora 30+ and RHEL 8+
   - Provides proper dependencies for modern systemd macro usage

3 weeks agospec: add conditional SPDX license identifiers for Fedora
Zdenek Kabelac [Fri, 7 Nov 2025 21:23:25 +0000 (22:23 +0100)]
spec: add conditional SPDX license identifiers for Fedora

Add SPDX license identifiers conditionally for modern Fedora releases
while maintaining backward compatibility with older distributions.

Introduce license_gpl and license_lgpl macros in macros.inc to centralize
the license handling logic:
- Fedora 37+: GPL-2.0-only, LGPL-2.0-only (SPDX identifiers)
- Fedora <37, RHEL all: GPLv2, LGPLv2 (traditional names)

Replace all 10 conditional License blocks with macro references.

This page took 0.114068 seconds and 5 git commands to generate.