lvm2.git
3 months agotests: vgsplit-cache: also test splitting a PV not used for cachevol LV 1979644969
Peter Rajnoha [Tue, 12 Aug 2025 10:56:58 +0000 (12:56 +0200)]
tests: vgsplit-cache: also test splitting a PV not used for cachevol LV

3 months agovgsplit: fix check for not splitting an LV between two VGs for cachevol
Peter Rajnoha [Tue, 12 Aug 2025 09:32:18 +0000 (11:32 +0200)]
vgsplit: fix check for not splitting an LV between two VGs for cachevol

When cachevol was used for the cache LV, the check for not splitting an
LV between two VGs was incorrect, not allowing to split the VG in cases
it should have been possible.

For example, splitting a VG which contains the cache LV with cachevol
only on two devices (sda and sdb here) and leaving third device completely
unused (sdc here) should clearly allow us to split it into a new VG:

❯  vgcreate vg /dev/sd{a..c}
  Physical volume "/dev/sda" successfully created.
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Volume group "vg" successfully created

❯  lvcreate -l2 -n main vg /dev/sda
  Logical volume "main" created.

❯  lvcreate -l2 -n fast vg /dev/sdb
  Logical volume "fast" created.

❯  lvconvert -y --type cache --cachevol fast vg/main
  Logical volume vg/main is now cached.

❯  lvs -a -o name,devices vg
  lv_name      devices
  [fast_cvol]  /dev/sdb(0)
  main         main_corig(0)
  [main_corig] /dev/sda(0)

❯  lsblk -o name /dev/sd{a..c}
NAME
sda
└─vg-main_corig
  └─vg-main
sdb
└─vg-fast_cvol
  ├─vg-fast_cvol-cdata
  │ └─vg-main
  └─vg-fast_cvol-cmeta
    └─vg-main
sdc

Before this patch:

❯  vgsplit vg vg2 /dev/sdc
  Logical volume vg/main must be inactive.

❯  vgchange -an vg
  0 logical volume(s) in volume group "vg" now active

❯  vgsplit vg vg2 /dev/sdc
  Can't split LV main between two Volume Groups

With this patch applied:

❯  vgsplit vg vg2 /dev/sdc
  New volume group "vg2" successfully split from "vg"

3 months agotest integrity.sh use writemostly to reliably detect mismatches 1978280924
Mikulas Patocka [Mon, 11 Aug 2025 16:34:57 +0000 (11:34 -0500)]
test integrity.sh use writemostly to reliably detect mismatches

The test shell/integrity.sh creates raid arrays, corrupts one of the
legs, then reads the array and verifies that the corruption was
corrected. Finally, the test tests that the number of mismatches on the
corrupted leg is non-zero.

The problem is that the raid1 implementation may freely choose which leg
to read from. If it chooses to read the non-corrupted leg, the corruption
is not detected, the number of mismatches is not incremented and the test
reports this as failure.

Fix this failure by marking the non-corrupted leg as "writemostly", so
that the kernel doesn't try to read it (it reads it only if it finds
corruption on the other leg).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
3 months agoRevert "test integrity.sh cannot rely on mismatches being detected for raid1"
David Teigland [Mon, 11 Aug 2025 16:27:06 +0000 (11:27 -0500)]
Revert "test integrity.sh cannot rely on mismatches being detected for raid1"

This reverts commit e50e59ae42a5def33e7d2fa514fccdf6db2cc060.

3 months agolvmlockd: --lockopt was mistakenly ignored when --nolocking was set 1974979820
David Teigland [Fri, 8 Aug 2025 19:06:24 +0000 (14:06 -0500)]
lvmlockd: --lockopt was mistakenly ignored when --nolocking was set

3 months agotest integrity.sh cannot rely on mismatches being detected for raid1 1972703498
Mikulas Patocka [Thu, 7 Aug 2025 15:55:09 +0000 (10:55 -0500)]
test integrity.sh cannot rely on mismatches being detected for raid1

The test shell/integrity.sh creates raid arrays, corrupts one of the
legs, then reads the array and verifies that the corruption was
corrected. Finally, the test tests that the number of mismatches on the
corrupted leg is non-zero.

The problem is that the raid1 implementation may freely choose which leg
to read from. If it chooses to read from the non-corrupted leg, the
corruption is not detected, the number of mismatches is not incremented
and the test reports this as a failure.

Fix the test by not checking the number of integrity mismatches for
raid1.

3 months agotest: vgsplit-raid: also test RAID LVs with integrity 1964715419
Peter Rajnoha [Mon, 4 Aug 2025 10:51:27 +0000 (12:51 +0200)]
test: vgsplit-raid: also test RAID LVs with integrity

3 months agovgsplit: fix check for not splitting an LV between two VGs
Peter Rajnoha [Fri, 25 Jul 2025 08:45:07 +0000 (10:45 +0200)]
vgsplit: fix check for not splitting an LV between two VGs

Fix check for not splitting an LV between two VGs in case
where the LVs contains an internal layer.

For example, integrity layer for RAIDs and splitting a PV that
is not part of the RAID LV at all (sdc here):

❯  vgcreate vg /dev/sda /dev/sdb /dev/sdc
  Volume group "vg" successfully created

❯  lvcreate -l1 -m1 --type raid1 --raidintegrity y vg /dev/sda /dev/sdb
  Logical volume "lvol0" created.

Before this patch:

❯  vgsplit vg vg2 /dev/sdc
  Logical volume vg/lvol0_rimage_0 (part of lvol0) must be inactive.

❯  vgchange -an vg
  0 logical volume(s) in volume group "vg" now active

❯  vgsplit vg vg2 /dev/sdc
  Can't split LV lvol0_rimage_0 between two Volume Groups

With this patch applied:

❯  vgsplit vg vg2 /dev/sdc
  New volume group "vg2" successfully split from "vg"

4 months agotest: aux starts dmeventd with small grace period 1958085161
Zdenek Kabelac [Wed, 30 Jul 2025 22:54:23 +0000 (00:54 +0200)]
test: aux starts dmeventd with small grace period

For our tests we expect very fast reaction.
So to keep i.e. reporting for the test 'lvextend-thin-metadata-dmeventd'
fast use just 2 seconds grace period (thread reuse).

4 months agodmeventd: add thread grace period for monitoring
Zdenek Kabelac [Tue, 22 Jul 2025 11:52:37 +0000 (13:52 +0200)]
dmeventd: add thread grace period for monitoring

Add thread reuse mechanism to reduce overhead when devices are frequently
registered/unregistered by introducing a configurable grace period where
monitoring threads wait for potential reuse before termination.

Key changes:
- Add -g option to configure grace period (0-300 seconds, default: 10s)
- Introduce DM_THREAD_GRACE_PERIOD state for threads awaiting reuse
- Implement thread reuse for matching device/dso combinations
- Add pthread condition variables and mutexes for grace period synchronization
- Add thread usage counter and enhanced debug logging
- Add _reset_pending_signal() to handle SIGALRM cleanup on thread reuse
- Refactor _monitor_thread() to support grace period workflow
- Update timeout thread to skip non-running threads
- Simplify thin plugin logging

This optimization significantly reduces thread creation/destruction overhead
in scenarios with rapid device registration/unregistration cycles, such as
creating snapshots of thin volumes, while maintaining proper cleanup and
thread safety.

4 months agotests: update checked message 1957478116
Zdenek Kabelac [Wed, 30 Jul 2025 15:03:58 +0000 (17:03 +0200)]
tests: update checked message

lvconvert output printed message was slighlty updated

4 months agoRevert "tests: Adapt RAID test to changes"
Zdenek Kabelac [Wed, 30 Jul 2025 15:00:32 +0000 (17:00 +0200)]
Revert "tests: Adapt RAID test to changes"

This reverts commit 53db14171c6b516058486b2a80eaa17af32a246b.

4 months agopost-release 1957270999
Marian Csontos [Wed, 30 Jul 2025 13:34:41 +0000 (15:34 +0200)]
post-release

4 months agopre-release 2.03.34 1957271289 v2_03_34
Marian Csontos [Wed, 30 Jul 2025 13:34:41 +0000 (15:34 +0200)]
pre-release 2.03.34

4 months agoWHATS_NEW: update 1956565790
Zdenek Kabelac [Wed, 30 Jul 2025 09:03:26 +0000 (11:03 +0200)]
WHATS_NEW: update

4 months agolvconvert: add non changing conversion message
Zdenek Kabelac [Wed, 30 Jul 2025 09:06:23 +0000 (11:06 +0200)]
lvconvert: add non changing conversion message

Print message about raid/mirror conversion for case,
where the raid/mirror is already in the requested state.

This case currently returns success.

4 months agoRevert "test: adjust lvconvert-raid.sh to now erroring non-changing image raid1 request"
Zdenek Kabelac [Wed, 30 Jul 2025 09:01:21 +0000 (11:01 +0200)]
Revert "test: adjust lvconvert-raid.sh to now erroring non-changing image raid1 request"

This reverts commit ed139168596f1a85b81bc6bbbb7280796eb83476.

4 months agoRevert "test: fix invalid if-then-fi logic"
Zdenek Kabelac [Wed, 30 Jul 2025 09:01:16 +0000 (11:01 +0200)]
Revert "test: fix invalid if-then-fi logic"

This reverts commit 612a22ac0829669a5bd8d6fc171d734dce583bf5.

4 months agoRevert "test: adjust lvconvert-mirror-basic.sh to now erroring non-changing image...
Zdenek Kabelac [Wed, 30 Jul 2025 08:59:10 +0000 (10:59 +0200)]
Revert "test: adjust lvconvert-mirror-basic.sh to now erroring non-changing image mirror request"

This reverts commit 8e2cdcc0067526c29197c2ba92ea6e7921a19558.

4 months agoRevert "test: use proper if-then-fi sequence"
Zdenek Kabelac [Wed, 30 Jul 2025 08:58:50 +0000 (10:58 +0200)]
Revert "test: use proper if-then-fi sequence"

This reverts commit d2a66d43435fd20f248647c78579586fa8bbb1d9.

4 months agoRevert "lvconvert: error mirror LV non-changing request"
Zdenek Kabelac [Wed, 30 Jul 2025 09:06:35 +0000 (11:06 +0200)]
Revert "lvconvert: error mirror LV non-changing request"

This reverts commit 1593a6e47c37d57f0d69ab81bc70a186be908f98.

4 months agoRevert "lvconvert: error raid1 LV non-changing image count request"
Zdenek Kabelac [Wed, 30 Jul 2025 08:56:39 +0000 (10:56 +0200)]
Revert "lvconvert: error raid1 LV non-changing image count request"

This reverts commit c901528053e7f63538239431480f20db8b7d4ca6.

4 months agodmeventd: _get_status returns success for non monitoring
Zdenek Kabelac [Tue, 29 Jul 2025 14:00:39 +0000 (16:00 +0200)]
dmeventd: _get_status returns success for non monitoring

No longer returning EINVAL when the dmeventd is not monitoring
any device (there are no registered devices).

This makes usable i.e. 'dmeventd -R' for the case, the dmeventd
was not monnitoring anything during this call.

Previously this actually cause refuse of 'restart' - since
restarting 'dmeventd' has seen failing resutl of a call:
DM_EVENT_CMD_GET_STATUS

4 months agovgextend: fix dev_read_reservation message 1953168728
David Teigland [Mon, 28 Jul 2025 18:35:16 +0000 (13:35 -0500)]
vgextend: fix dev_read_reservation message

Common vgextend commands were logging a message about
dev_read_reservation when PR was not being used.

Only attempt PR work from vgextend when either the
PR require or autostart settings are enabled on the VG.

4 months agonvme: fix log messages in dev_find_key_nvme
David Teigland [Mon, 28 Jul 2025 18:34:11 +0000 (13:34 -0500)]
nvme: fix log messages in dev_find_key_nvme

they were mistakenly logging as dev_read_reservation

4 months agoman: add note about return codes for LV resize with and without FS resize 1945399825
Peter Rajnoha [Thu, 24 Jul 2025 08:51:59 +0000 (10:51 +0200)]
man: add note about return codes for LV resize with and without FS resize

4 months agoWHATS_NEW: update 1943731362
Zdenek Kabelac [Wed, 23 Jul 2025 12:47:55 +0000 (14:47 +0200)]
WHATS_NEW: update

4 months agodmeventd: add device existence check
Zdenek Kabelac [Tue, 22 Jul 2025 18:35:24 +0000 (20:35 +0200)]
dmeventd: add device existence check

Add device existence check after successful wait ioctl to prevent
processing events on removed devices.

When dm_task_run() succeeds on a WAITEVENT ioctl, the success might
actually indicate that the device was removed rather than a genuine
device event. Without this check, dmeventd would attempt to process
ERROR events on non-existent devices, leading to unnecessary error
commands and log noise.

This fix adds a _fill_device_data() call immediately after successful
wait completion to verify the device still exists. If the device is
gone, execution jumps to the existing ENXIO error path which properly
handles device disappearance.

Note: Future kernel versions may return ENXIO directly from the wait
ioctl when devices are removed, making this workaround unnecessary.
Until then, this extra INFO ioctl provides the needed verification.

4 months agodmeventd: check device exists
Zdenek Kabelac [Tue, 22 Jul 2025 18:34:38 +0000 (20:34 +0200)]
dmeventd: check device exists

Check first whether the monitored device actually really exists,
before resolving its device name.

In the case device is not present in DM table, fail _fill_device_data().

4 months agodmeventd: update types in thin plugin
Zdenek Kabelac [Tue, 22 Jul 2025 11:53:05 +0000 (13:53 +0200)]
dmeventd: update types in thin plugin

Use matching dm_percent_t type to store percent values.

4 months agoscripts: refactor lvmdump directory validation
Zdenek Kabelac [Thu, 17 Jul 2025 21:07:05 +0000 (23:07 +0200)]
scripts: refactor lvmdump directory validation

Break down complex one-liner directory check into explicit steps with
clear error messages and comments.

The original code used a dense subshell expression combining multiple
tests with logical operators, making it difficult to understand and
maintain. This refactoring separates the logic into:

1. Check directory accessibility (read/write/execute permissions)
2. Check if directory is empty (including hidden files)

Each check now has a specific error message, making it easier for users
to understand what went wrong. The functionality remains identical, but
the code is now more maintainable and debuggable.

Changes:
- Split accessibility and emptiness checks into separate if statements
- Add descriptive comments explaining each validation step
- Provide specific error messages for different failure conditions
- Maintain original behavior including dotglob/nullglob handling

4 months agovdo: fix 32b portability issue in vdo_header struct
Zdenek Kabelac [Wed, 23 Jul 2025 12:01:07 +0000 (14:01 +0200)]
vdo: fix 32b portability issue in vdo_header struct

Replace size_t with uint64_t in struct vdo_header to ensure consistent
64-bit size field across all architectures.

On 32-bit platforms, size_t is only 4 bytes, which causes incorrect
structure layout when reading VDO metadata that expects a 64-bit size
field. This fix ensures the VDO header structure maintains the same
binary layout regardless of target architecture.

While 32-bit architectures are not officially supported for VDO,
this change improves code correctness and prevents potential issues
during cross-compilation or when building on 32-bit development
environments.

4 months agolvmdevices: log_error when writing devices file fails 1943174511
Peter Rajnoha [Wed, 23 Jul 2025 07:24:07 +0000 (09:24 +0200)]
lvmdevices: log_error when writing devices file fails

4 months agodevice_id: log_warn instead of log_error in device_ids_write
Peter Rajnoha [Wed, 23 Jul 2025 07:17:36 +0000 (09:17 +0200)]
device_id: log_warn instead of log_error in device_ids_write

It is not always the case that the whole command fails if
device_ids_write fail so change all log_error to log_warn and let the
caller decide.

4 months agotest: lvresize-fs-crypt: test not enough space left for crypt data 1941212704
Peter Rajnoha [Tue, 22 Jul 2025 10:16:56 +0000 (12:16 +0200)]
test: lvresize-fs-crypt: test not enough space left for crypt data

4 months agoWHATS_NEW: update 1940921748
Peter Rajnoha [Tue, 22 Jul 2025 07:46:39 +0000 (09:46 +0200)]
WHATS_NEW: update

4 months agolvmdevices: return error if writing device ids fail for --delldev
Peter Rajnoha [Mon, 21 Jul 2025 11:41:32 +0000 (13:41 +0200)]
lvmdevices: return error if writing device ids fail for --delldev

4 months agodevice_id: always log_error on device ids write error
Peter Rajnoha [Mon, 21 Jul 2025 11:40:30 +0000 (13:40 +0200)]
device_id: always log_error on device ids write error

4 months agolv_manip.c: fix lvresize corruption in LV->crypt->FS stack if near crypt min size... 1934510688
Peter Rajnoha [Fri, 18 Jul 2025 13:06:36 +0000 (15:06 +0200)]
lv_manip.c: fix lvresize corruption in LV->crypt->FS stack if near crypt min size limit

If we have LV->crypt->FS stack, check that the adjustment for the crypt
data offset will left space for the crypt data itself. Fix possible underflow.

Example:

❯  lvs -o name,size vg/lvol0
  lv_name lv_size
  lvol0   124.00m

❯  lsblk /dev/vg/lvol0
NAME     MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
vg-lvol0 252:2    0  124M  0 lvm
└─a      252:4    0  108M  0 crypt

Before this patch (the incorrect resulting underflowed file system size after adjustment
for crypt data offset, crypt data then severed by the LV resize without proper
crypt resize beforehand):

❯  lvreduce --yes --resizefs -L -123M  vg/lvol0
  Rounding size to boundary between physical extents: 120.00 MiB.
  Checking crypt device /dev/dm-4 on LV vg/lvol0.
  File system size 18446744073696968704b is adjusted for crypt data offset 16777216b.
  File system ext4+crypto_LUKS found on vg/lvol0.
  File system size (108.00 MiB) is smaller than the requested size (<16.00 EiB).
  File system reduce is not needed, skipping.
  crypt device is already reduced to 113246208 bytes.
  Size of logical volume vg/lvol0 changed from 124.00 MiB (31 extents) to 4.00 MiB (1 extents).
  Logical volume vg/lvol0 successfully resized.

With this patch applied:

❯  lvreduce --yes --resizefs -L -123M  vg/lvol0
  Rounding size to boundary between physical extents: 120.00 MiB.
  Checking crypt device /dev/dm-4 on LV vg/lvol0.
  Crypt header requires 16.00 MiB, not enough space left for crypt data.

4 months agotest: simplify bash 1933068028
Zdenek Kabelac [Thu, 17 Jul 2025 19:11:28 +0000 (21:11 +0200)]
test: simplify bash

Just check directly /proc/mdstat  - if it's missing or there is not
raid1 string present do 'modprobe'.

4 months agotest: aux simplify bash condition
Zdenek Kabelac [Thu, 17 Jul 2025 18:02:13 +0000 (20:02 +0200)]
test: aux simplify bash condition

4 months agotest: report possibly issue for loop device remove
Zdenek Kabelac [Thu, 17 Jul 2025 18:01:00 +0000 (20:01 +0200)]
test: report possibly issue for loop device remove

Warn if there are problems when removing loop devices.
Also use slightly smaller raid arrays with smaller extent size.

4 months agotest: use proper DM_DEV_DIR
Zdenek Kabelac [Thu, 17 Jul 2025 15:52:21 +0000 (17:52 +0200)]
test: use proper DM_DEV_DIR

Use correct path - if the system does not have installed lvm udev rules
these /dev/vgname/lvname symlinks are not created - but test
running in test's dev dir gets symlinks created by lvm2 itself.

4 months agotest: simplify if logic
Zdenek Kabelac [Thu, 17 Jul 2025 12:10:52 +0000 (14:10 +0200)]
test: simplify if logic

Easier to read set of  'if' conditions.

4 months agotest: fix invalid if-then-fi logic
Zdenek Kabelac [Wed, 16 Jul 2025 14:55:58 +0000 (16:55 +0200)]
test: fix invalid if-then-fi logic

Replace incorrect test && lvconvert || lvconvert
Use simplier NOT.

4 months agotest: raid tuning
Zdenek Kabelac [Wed, 16 Jul 2025 13:08:14 +0000 (15:08 +0200)]
test: raid tuning

Use slightly bigger PVs, so the raid takes a bit more time to fully
reshape arrays - so we avoid conversion to be finished to fast even
with slowered devices.

Grab blockdev size before calling 'lvs' command.

4 months agoscripts: lvm_import_vdo simplier bash logic
Zdenek Kabelac [Thu, 17 Jul 2025 18:00:36 +0000 (20:00 +0200)]
scripts: lvm_import_vdo simplier bash logic

4 months agoscripts: blkdeactivate simplify bash
Zdenek Kabelac [Thu, 17 Jul 2025 12:29:27 +0000 (14:29 +0200)]
scripts: blkdeactivate simplify bash

Use correct if-then-fi.
Use local IFS  instead handling ORIG_IFS.

4 months agorevert: lv_manip: retuurn failure for LV resize without actual LV+FS resize 1932021280
Peter Rajnoha [Thu, 17 Jul 2025 10:07:00 +0000 (12:07 +0200)]
revert: lv_manip: retuurn failure for LV resize without actual LV+FS resize

We have different behavior for lvreduce (contains the fs size
pre-check before calling the external script) and lvextend
(does not ave the pre-check).

Also, there's different behavior with "lvreduce --fs resize"
(contains the pre-check) and "lvreduce --fs resize_fsadm"
(does not have the pre-check).

Obvously, only "lvreduce --fs resize" does have the pre-check.
To make it consitent all across, we should remove that one
and everybody will be happy.

4 months agolv_manip: also track if FS resize executed when using fsadm 1931782226
Peter Rajnoha [Thu, 17 Jul 2025 08:24:32 +0000 (10:24 +0200)]
lv_manip: also track if FS resize executed when using fsadm

4 months agolv_manip: add error message for size 0 after adjusting size for LV resize 1930194012
Peter Rajnoha [Wed, 16 Jul 2025 13:16:55 +0000 (15:16 +0200)]
lv_manip: add error message for size 0 after adjusting size for LV resize

4 months agotests: resizing to same size is considered an error
Peter Rajnoha [Wed, 16 Jul 2025 12:52:18 +0000 (14:52 +0200)]
tests: resizing to same size is considered an error

4 months agolv_manip: return failure for LV resize without actual LV+FS resize
Peter Rajnoha [Tue, 15 Jul 2025 10:10:28 +0000 (12:10 +0200)]
lv_manip: return failure for LV resize without actual LV+FS resize

Also return failure if there is no change in file system size while
resizing an LV including the file system, lik with lvresize/lvreduce --fs resize'.

4 months agoWHATS_NEW: update 1929871580
Zdenek Kabelac [Wed, 16 Jul 2025 10:37:48 +0000 (12:37 +0200)]
WHATS_NEW: update

4 months agotest: some updates for valgrind run
Zdenek Kabelac [Wed, 16 Jul 2025 10:35:14 +0000 (12:35 +0200)]
test: some updates for valgrind run

Since execution with valgrind is much slower we need
to skip some 'race-based' tests.

4 months agotest: skip raid resizing on buggy kernel 1928892908
Zdenek Kabelac [Tue, 15 Jul 2025 21:56:43 +0000 (23:56 +0200)]
test: skip raid resizing on buggy kernel

Kernel without commit kernel commit 9f346f7d4ea73692b82f5102ca8698e4040469ea
cannot reasize raid LV without failing the raid itself.
So skip some tests for kernels 6.13 6.13 6.15.

TODO: maybe we want to print some warning message to the users
with affected kernels ??

4 months agotest: lvconvert-raid-reshape-size add verify udev
Zdenek Kabelac [Mon, 14 Jul 2025 14:14:55 +0000 (16:14 +0200)]
test: lvconvert-raid-reshape-size  add verify udev

With the use of --noudevsync we actually need to also ensure
we verify link create - as without synchronization we are not
able to properly wait - so lvm2 needs to create links itself.
It's hack where it would be better to not use it - but so far
there is no easy fix.

Make skip variables easily overridable by setting make vars.
Also further reduce used PV sizes.

4 months agodebug: add message for noudevsync path
Zdenek Kabelac [Mon, 14 Jul 2025 14:14:15 +0000 (16:14 +0200)]
debug: add message for noudevsync path

To avoid confusion, there is no synchronization of device names
when option --noudevsync is used. Make it obvious from debug trace.

4 months agotest: aux add more ignored dirs 1924472760
Zdenek Kabelac [Sun, 13 Jul 2025 21:41:57 +0000 (23:41 +0200)]
test: aux add more ignored dirs

4 months agotest: fix skipping of this repair test
Zdenek Kabelac [Sun, 13 Jul 2025 21:22:11 +0000 (23:22 +0200)]
test: fix skipping of this repair test

Fix the usage of delay_dev so the test is properly executed
and not skiped. For major mirror slowdown use smalled region
sizes that are cause way more frequent commits so we can go
with significantly smaller delays.

Also check repair to work for failing mirror leg and mirror log.

4 months agotest: update for upper case warning
Zdenek Kabelac [Sun, 13 Jul 2025 20:09:41 +0000 (22:09 +0200)]
test: update for upper case warning

As WARNING consistency patch slighly change some reported messages,
update some tests (and use  'grep -i').

4 months agotest: use same device match for btrfs testing
Zdenek Kabelac [Mon, 14 Jul 2025 00:28:05 +0000 (02:28 +0200)]
test: use same device match for btrfs testing

Copy the btrfs device matching from lvresize helper script.

4 months agolvresize: use major:minor to compare btrfs device
Zdenek Kabelac [Mon, 14 Jul 2025 00:26:19 +0000 (02:26 +0200)]
lvresize: use major:minor to compare btrfs device

What we really do want to compare is devnode the device
name is actually using - this is uniq match.

4 months agoWHATS_NEW: update 1924267701
Zdenek Kabelac [Sun, 13 Jul 2025 15:13:52 +0000 (17:13 +0200)]
WHATS_NEW: update

4 months agomake: generate
Zdenek Kabelac [Fri, 11 Jul 2025 12:31:47 +0000 (14:31 +0200)]
make: generate

4 months agoconfigure: update autotools
Zdenek Kabelac [Thu, 10 Jul 2025 13:00:03 +0000 (15:00 +0200)]
configure: update autotools

4 months agotest: refactor lvconvert-raid-reshape-size.sh
Heinz Mauelshagen [Fri, 4 Jul 2025 20:11:05 +0000 (22:11 +0200)]
test: refactor lvconvert-raid-reshape-size.sh

Improve the RAID reshape size test script with the following changes:

**Code Quality Improvements:**
- Add proper shell quoting throughout the script to prevent word splitting issues
- Replace manual arithmetic with cleaner shell arithmetic syntax
- Improve variable handling and remove unnecessary local variable assignments
- Fix typo: "hilesystem" -> "filesystem"

**Test Reliability Enhancements:**
- Add EXTENSIVE_FSCK environment variable for optional additional filesystem validation
- Reduce delay times from 40ms/25ms to 20ms for all RAID types to speed up testing
- Add helper functions _delay_dev() and _restore_dev() for cleaner device delay management
- Use --noudevsync flag in lvconvert to avoid udev-related timing issues
- Remove unnecessary sleep calls and udevadm settle commands

**Functionality Improvements:**
- Improve _check_size() function to return proper exit codes instead of echo statements
- Better error handling in conditional statements using proper test syntax
- Cleaner parameter passing using "$@" instead of manual argument handling
- More robust device path handling using $DM_DEV_DIR consistently

**Code Structure:**
- Extract device delay logic into reusable helper functions
- Improve readability with better variable naming and consistent formatting
- Add explanatory comments for complex operations

4 months agotest: lvconvert-raid-reshape-size.sh return from _check_size
Heinz Mauelshagen [Fri, 4 Jul 2025 15:04:04 +0000 (17:04 +0200)]
test: lvconvert-raid-reshape-size.sh return from _check_size

4 months agotest: lvconvert-raid-reshape-size.sh only create PVs+VG once
Heinz Mauelshagen [Fri, 4 Jul 2025 11:09:50 +0000 (13:09 +0200)]
test: lvconvert-raid-reshape-size.sh only create PVs+VG once

Saves a few seconds in test run.
Add --noudevsync to save big time.

4 months agotest: lvconvert-raid-reshape-size.sh fix test bug 2nd
Heinz Mauelshagen [Thu, 3 Jul 2025 15:09:00 +0000 (17:09 +0200)]
test: lvconvert-raid-reshape-size.sh fix test bug 2nd

Up'ed millisecnd delays.
Undelayed earlier.
Only delaying rimage allocations, not lvm2 mda or rmeta ones.

4 months agotest: lvconvert-raid-reshape-size.sh fix test bug further
Heinz Mauelshagen [Thu, 3 Jul 2025 13:16:50 +0000 (15:16 +0200)]
test: lvconvert-raid-reshape-size.sh fix test bug further

_check_size_timeout function added compensating the block layer bdev update race
thus avoiding other explicit sleeps spread in the test code.
"udevadm settle" approach gone.
No --noudevsync mandatory.

4 months agotest: lvconvert-raid-reshape-size.sh fix test bug
Heinz Mauelshagen [Wed, 2 Jul 2025 13:44:29 +0000 (15:44 +0200)]
test: lvconvert-raid-reshape-size.sh fix test bug

Size check for stripe size reshape was bogus.

Whilst on it, optimize delay on test device to
avoid delying LVM2 MDA and RAID rmeta SubLV.

Also update some comments.

4 months agotest: update lvresize-btrfs.sh
Zdenek Kabelac [Sat, 12 Jul 2025 10:03:10 +0000 (12:03 +0200)]
test: update  lvresize-btrfs.sh

Slightlty better integration with test suite.
Use $lv1, $lv2, $lv3.
Use properly "" around string (shellcheck).

4 months agotest: drop unused variable
Zdenek Kabelac [Sat, 12 Jul 2025 11:43:12 +0000 (13:43 +0200)]
test: drop unused variable

Remove unused max_log_count.
Update some skip messages.

4 months agotest: use proper if-then-fi sequence
Zdenek Kabelac [Sat, 12 Jul 2025 11:43:40 +0000 (13:43 +0200)]
test: use proper if-then-fi sequence

Adapting the test for the changed behavior of lvconvert
where the mirror leg and log count is not changing.

Properly test for this condition - checking only leg count is
not enough to expect error return code.

And finaly fixing invalid bash scripting logic since:

test && TRUE || FALSE

is not bash equivalent of:

if test ; then
   TRUE
else
   FALSE
fi

4 months agodebug: log_warn sentence begins with capital
Zdenek Kabelac [Fri, 11 Jul 2025 17:41:15 +0000 (19:41 +0200)]
debug: log_warn sentence begins with capital

Improve the consistency and readability of warning messages.
Capitalize the first word of all warning messages.
Add periods at the end of warning messages.

The changes are purely cosmetic and do not affect functionality.

4 months agoman: fix some typos and grammar issues
Zdenek Kabelac [Fri, 11 Jul 2025 09:21:42 +0000 (11:21 +0200)]
man: fix some typos and grammar issues

Drop misplaced letter 'I'.
Missing articles (a, an, the)
Incorrect prepositions (in/into, to/in)
Subject-verb agreement errors.
Awkward phrasing that needs smoothing.
Fixed prepositions ("prior to" instead of "prior the")
Corrected subject-verb agreement ("are becoming" instead of "is becoming")
Fixed word choices ("represents" instead of "presents")
Used consistent terminology ("environment" instead of "environmental")
Fixed pronoun references ("them" instead of "it" when referring to plural subjects)

Originated-by: warp-terminal
4 months agocleanup: a/an fixups
Andre Beaud [Sat, 5 Jul 2025 15:03:03 +0000 (01:03 +1000)]
cleanup: a/an fixups

Some a/an fixups along with a couple more odds and ends.
Hopefully this is useful like this as plain diff output
or let me know if something else will work better.

4 months agogcc: ensure pointer is properly initialized
Zdenek Kabelac [Wed, 9 Jul 2025 21:26:03 +0000 (23:26 +0200)]
gcc: ensure pointer is properly initialized

Fix gcc warning by ensuring pointers are properly defined and
initialized before use in man-generator code to prevent potential
undefined behavior.

4 months agocov: replace unsafe string sscanf
Zdenek Kabelac [Sun, 13 Jul 2025 18:23:06 +0000 (20:23 +0200)]
cov: replace unsafe string sscanf

Althouh here we were copying to the properly allocated space
let's just replace it with this copy code.

4 months agocov: reduce strcpy
Zdenek Kabelac [Sun, 13 Jul 2025 17:36:45 +0000 (19:36 +0200)]
cov: reduce strcpy

Copy fix we already have device_mapper through commit:
7bc5c8ac3d4c6004de24050fd51d3eaa4732822d

4 months agocov: remove unused header
Zdenek Kabelac [Thu, 10 Jul 2025 23:26:31 +0000 (01:26 +0200)]
cov: remove unused header

Remove unused header file.
Warp also identified duplicated header file inclusion.

4 months agocov: remove unused variables
Zdenek Kabelac [Thu, 10 Jul 2025 19:31:15 +0000 (21:31 +0200)]
cov: remove unused variables

Remove unused variables identified by coverity analysis to clean up
code and eliminate static analysis warnings.

4 months agocov: reduce printf format string parameters
Zdenek Kabelac [Thu, 10 Jul 2025 18:35:59 +0000 (20:35 +0200)]
cov: reduce printf format string parameters

Simplify printf format strings by removing unnecessary parameters
in libdm-report and toollib components to resolve coverity warnings
about format string mismatches.

4 months agocov: use proper enum value for bitmask operation
Zdenek Kabelac [Thu, 10 Jul 2025 15:38:27 +0000 (17:38 +0200)]
cov: use proper enum value for bitmask operation

Fix coverity warning by using the correct enum value instead of
a raw integer for bitmask operations in activation code.

4 months agocov: suppress false positive warnings
Zdenek Kabelac [Thu, 10 Jul 2025 13:21:58 +0000 (15:21 +0200)]
cov: suppress false positive warnings

Add coverity annotations to suppress false positive warnings for
unimportant results across multiple files including dmeventd,
lvmlockd, display, logging, dmsetup, and man-generator components.

4 months agoglibc: switch to standard endian conversion macros
Zdenek Kabelac [Thu, 10 Jul 2025 20:27:09 +0000 (22:27 +0200)]
glibc: switch to standard endian conversion macros

Replace all uses of Linux kernel-style endian conversion macros/functions
(e.g., le32_to_cpu, cpu_to_le32, xlate32, xlate64, etc.) with the standard
POSIX/glibc macros (e.g., le32toh, htole32, htobe32, be32toh, etc.) from
<endian.h>.

- Update all code to use le16toh, le32toh, le64toh, htole16, htole32, htole64,
  htobe16, htobe32, htobe64, be16toh, be32toh, be64toh as appropriate.
- Provide fallback macro definitions in xlate.h for systems lacking these
  standard macros, ensuring backward compatibility with older glibc and non-glibc
  systems.
- Remove or replace all project-specific xlateXX and cpu_to_leXX/cpu_to_beXX
  macros.
- No functional change intended; this is a mechanical, treewide modernization
  for clarity, portability, and future maintainability.

4 months agocov: add explicit enum casts to fix type warnings
Zdenek Kabelac [Thu, 10 Jul 2025 16:37:56 +0000 (18:37 +0200)]
cov: add explicit enum casts to fix type warnings

Add explicit casts to enum types in dmeventd and libdevmapper-event
to resolve coverity warnings about implicit type conversions.

4 months agolvresize: update code to get btrfs devid
Zdenek Kabelac [Sun, 13 Jul 2025 18:52:32 +0000 (20:52 +0200)]
lvresize: update code to get btrfs devid

Let's try different mechanism to obtain devid when
resizing btrfs filesystem spread across multiple volumes.

Using patch from https://github.com/lvmteam/lvm2/issues/180

Originated-by: Damenly Su <l@damenly.org>
4 months agolvconvert: error mirror LV non-changing request
Zdenek Kabelac [Sat, 12 Jul 2025 14:16:51 +0000 (16:16 +0200)]
lvconvert: error mirror LV non-changing request

To have the very same matching logic to raid1 commit:
c901528053e7f63538239431480f20db8b7d4ca6
we add similar check for mirror where we check if mirror leg and
log count is not changing which will now return also an error.

4 months agotools: simplify LVM_DID_EXEC environment variable
Zdenek Kabelac [Thu, 10 Jul 2025 19:40:14 +0000 (21:40 +0200)]
tools: simplify LVM_DID_EXEC environment variable

Set LVM_DID_EXEC to "1" instead of using the command name string,
avoiding potential issues with unusual command names and improving
consistency in environment variable handling.

4 months agotools: add arg_force_value() for enum handling
Zdenek Kabelac [Thu, 10 Jul 2025 17:09:22 +0000 (19:09 +0200)]
tools: add arg_force_value() for enum handling

Add arg_force_value() function that returns the correct force_t enum
type, replacing direct string comparisons. Update lvconvert and
pvremove to use this new function for better type safety.

This is cleaner solution over just plain cast to force_t as we can
validate force level in use.

4 months agocommand: replace manual binary search with bsearch
Zdenek Kabelac [Thu, 10 Jul 2025 10:39:13 +0000 (12:39 +0200)]
command: replace manual binary search with bsearch

Replace custom binary search implementation with the standard library's
bsearch() function for better maintainability.
Also convert command_name from pointer to char array and simplify name
ordering validation logic.

4 months agocommand: fix alignment in help output formatting
Zdenek Kabelac [Thu, 10 Jul 2025 10:05:45 +0000 (12:05 +0200)]
command: fix alignment in help output formatting

Fix inconsistent spacing in command help output by introducing
_print_opt_with_align() function that properly handles alignment
for options with and without short forms. This resolves the extra
spaces that were being printed in --longhelp output.

Fixes regression introduced in commit:
491c6652ae39b4a22f79dc47dbebd40495ed03c2.

4 months agocommand-lines: fix typo in configurable name
Zdenek Kabelac [Fri, 11 Jul 2025 12:29:41 +0000 (14:29 +0200)]
command-lines: fix typo in configurable name

Fix type in lvm.conf option name used for lvcreate
and replace global/mirror_segfault_default with correct
name global/mirror_segtype_default.

4 months agosanlock: fix file descriptor leak in error path
Zdenek Kabelac [Thu, 10 Jul 2025 13:13:18 +0000 (15:13 +0200)]
sanlock: fix file descriptor leak in error path

Add proper cleanup of file descriptor in the error handling path
to prevent resource leaks when sanlock operations fail.

4 months agosanlock: fix struct copy to avoid aliasing issues
Zdenek Kabelac [Thu, 10 Jul 2025 13:11:30 +0000 (15:11 +0200)]
sanlock: fix struct copy to avoid aliasing issues

Replace direct structure assignment with explicit copying to prevent
potential undefined behavior from structure aliasing. This ensures
proper memory handling when working with sanlock structures.

This possibly fixes regression introduced with commit: e9640e5178769
as unintended side effect.

4 months agoudev: fix autoactivation on top of loop dev PVs 1915928259
Peter Rajnoha [Wed, 9 Jul 2025 10:48:48 +0000 (12:48 +0200)]
udev: fix autoactivation on top of loop dev PVs

We already check loop devices for LVM_LOOP_PV_ACTIVATED="1" in udev
rules to see if have executed pvscan before. If that is the case, we
don't want to execute it again to avoid VG reactivation.

However, the rules missed the IMPORT{db}="LVM_LOOP_PV_ACTIVATED" rule
to actually get the value already stored in udev db from previous event.
As a result, the pvscan executed on each CHANGE udev event, hence the
VG autoactivation triggered each time as well.

Fix this by adding the missing IMPORT{db}="LVM_LOOP_PV_ACTIVATED" rule
(just like we already do for MD devices).

Note: Keep the behavior for ADD events. That is, we still want the
autoactivation to trigger each time, otherwise coldplug will not work
(again, we have the same principle used for MD devices).

5 months agotest: adjust lvconvert-mirror-basic.sh to now erroring non-changing image mirror... 1902307019
Heinz Mauelshagen [Wed, 2 Jul 2025 12:04:40 +0000 (14:04 +0200)]
test: adjust lvconvert-mirror-basic.sh to now erroring non-changing image mirror request

See commit c901528053e7f63538239431480f20db8b7d4ca

5 months agosanlock: add function only for newer SANLOCK 1901931238
Zdenek Kabelac [Wed, 2 Jul 2025 09:48:53 +0000 (11:48 +0200)]
sanlock: add function only for newer SANLOCK

Avoid adding unused static function with older SANLOCK.

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