lvm2.git
3 weeks agoWHATS_NEW: update rhel-9.8.0
Heinz Mauelshagen [Mon, 27 Oct 2025 18:15:06 +0000 (19:15 +0100)]
WHATS_NEW: update

3 weeks agotest: add new test for snapshot on raid creation/activation warning/error
Heinz Mauelshagen [Mon, 27 Oct 2025 18:12:25 +0000 (19:12 +0100)]
test: add new test for snapshot on raid creation/activation warning/error

(cherry picked from commit 6704ef4012e8c187deaeadb1275e2d80661c3941)

3 weeks agolv_manip: show a warning during classic snapshot creation on a RaidLV.
Heinz Mauelshagen [Mon, 27 Oct 2025 16:37:09 +0000 (17:37 +0100)]
lv_manip: show a warning during classic snapshot creation on a RaidLV.

The RaidLV will fail to activate in case of the loss of any of its snapshots.
Once created, commit 2760e804630a36bab2c3938ce9ac0b08c5e75395 will
catch any loss of such snapshots and provide remedy information.

(cherry picked from commit ae81b41811ede78b77f6badf0c65c88fa56cc951)

3 weeks agoactivating raid LV with partial snapshot is an error
David Teigland [Mon, 27 Oct 2025 16:01:16 +0000 (11:01 -0500)]
activating raid LV with partial snapshot is an error

Detect and report this error early in the command, with
a clear message, including a possible remedy.  Previously,
the command failed at a lower level, where the message is
confusing or even misleading.

Old error message:
  "Aborting.  LV vg/snap1 is incomplete and --activationmode partial was not specified."

New error message:
  "Activating raid LV vg/main requires the removal of partial snapshot vg/snap1."

(cherry picked from commit 2760e804630a36bab2c3938ce9ac0b08c5e75395)

2 months agomake: generate
Marian Csontos [Mon, 29 Sep 2025 13:44:24 +0000 (15:44 +0200)]
make: generate

2 months agotools: pvchange: unlock devices file at the end of cmd processing
Peter Rajnoha [Fri, 29 Aug 2025 11:50:20 +0000 (13:50 +0200)]
tools: pvchange: unlock devices file at the end of cmd processing

Remove the line, not just comment out.

(cherry picked from commit d89869f17ec217ee758918047b7edba6c9aa017a)

2 months agotools: pvchange: unlock devices file at the end of cmd processing
Peter Rajnoha [Fri, 29 Aug 2025 11:43:20 +0000 (13:43 +0200)]
tools: pvchange: unlock devices file at the end of cmd processing

Unlock devices file at the end of cmd processing, after all the PVs are
processed, not after the first processed PV.

Before this patch:

❯  pvchange -u /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  WARNING: Devices file unlock no fd.
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

With this patch applied:

❯  pvchange -u /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

The lvm_run_command/devices_file_exit/unlock_devices_file will
do the unlock at the very end of cmd processing.

(cherry picked from commit 16d3195a69fbe15d9fad4a16cceec468ea542e5a)

2 months agolvmdevices: do not create system.devices when deleting entries
David Teigland [Fri, 8 Aug 2025 17:36:11 +0000 (12:36 -0500)]
lvmdevices: do not create system.devices when deleting entries

When using "lvmdevices --deldev" or "lvmdevices --delpvid" and no
system.devices file exists, the commands should not create the file.

(cherry picked from commit e61aab70498a887557c133fcba21fcc41345d272)

2 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"

(cherry picked from commit 3fe57cc892fc984c30fb14c866a109ef17772ed4)

2 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"

(cherry picked from commit 185455659347722a5eab26f1cc9f189076847e45)

2 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

(cherry picked from commit 6a31246bdd50ee8619d58704d83e4e916e0608d8)

2 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.

(cherry picked from commit fa2ec32c4eaab7f6c7e85dd71fba455a0022dc38)

2 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().

(cherry picked from commit 175a80157a2116a64f72e912c04b4a45a03c50f6)

2 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.

(cherry picked from commit a23ef8e26f5468c37d676da15d0125bff6de7095)

2 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.

(cherry picked from commit 5d16b1d7348aad816424b2a8e95fd31a59c3e2e2)

2 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.

(cherry picked from commit 0b7b6ccd79929611131549a70bcb339f0c67530e)

2 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.

(cherry picked from commit f82c46e6735ce123da27fb576371e660697b0bb7)

2 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.

(cherry picked from commit b86b1da80acfa97ee6cc18e3d3a44809d4083a1b)

2 months agogcc: for C90 don't mix declaration and code
Zdenek Kabelac [Sun, 29 Jun 2025 14:45:49 +0000 (16:45 +0200)]
gcc: for C90 don't mix declaration and code

This commit fixes C90 compatibility issues by ensuring variable declarations
are placed at the beginning of code blocks before any executable statements.

(cherry picked from commit 0be635934c9cb4ac56e53d95adc7d7800d15e11f)

2 months agocov: check for potential empty row list
Zdenek Kabelac [Mon, 30 Jun 2025 12:14:01 +0000 (14:14 +0200)]
cov: check for potential empty row list

Skip potential 0 length allocation and return early for empty list.

(cherry picked from commit 9fcc66316cd5f4b78b78ab1e0d50fafad362d499)

2 months agocov: check for potential empty registry list
Zdenek Kabelac [Mon, 30 Jun 2025 12:11:16 +0000 (14:11 +0200)]
cov: check for potential empty registry list

Check early for empty thread_registry list and return EINVAL
instead of doing zero length allocation.

(cherry picked from commit bf580fcc2f17a0c7c732b929ed08acaf9dd831d7)

2 months agocov: explicitly zero allocated mem for array
Zdenek Kabelac [Mon, 30 Jun 2025 12:32:10 +0000 (14:32 +0200)]
cov: explicitly zero allocated mem for array

Replace malloc() with calloc() when allocating the string pointer array
for regex pattern matching in _create_field_selection(). This ensures
all array elements are initialized to NULL pointers, preventing potential
use of uninitialized memory objected by Coverity.

Existing code sets all elements in the follow up loop.

(cherry picked from commit 2c5489dd13045624e9597d11a85a29c8408cc0e8)

2 months agocov: add explicit check for 0 size
Zdenek Kabelac [Mon, 30 Jun 2025 11:55:11 +0000 (13:55 +0200)]
cov: add explicit check for 0 size

(cherry picked from commit ae407d2f3cb1d607463d6d5964e44f11857cdb1f)

2 months agocov: fix va_end resource leak in szscanf()
Zdenek Kabelac [Sat, 28 Jun 2025 20:42:17 +0000 (22:42 +0200)]
cov: fix va_end resource leak in szscanf()

- Fix potential resource leak by ensuring va_end() is called on error path
- Set matched = -1 and break from while loop instead of immediate return
- This ensures proper cleanup of va_list when unsupported format
  specifiers are encountered in lvmlockctl.

The szscanf function is a custom string scanner used for parsing lvmlockd
status information. Previously, encountering an unsupported format
specifier would cause an immediate return without calling va_end(),
leading to undefined behavior and potential resource leaks.

This fix ensures proper cleanup of variable argument lists in all code paths.

(cherry picked from commit a53352b4aaa9277cec96f61c50b05d6334320bfe)

2 months agocov: fix integer underflow in _count handling
Zdenek Kabelac [Fri, 27 Jun 2025 11:46:01 +0000 (13:46 +0200)]
cov: fix integer underflow in _count handling

The _count variable was declared as uint64_t but used in arithmetic operations
that could result in underflow when subtracting from smaller values. This
could cause issues when calculating interval numbers or handling count-based
reporting.

Changes:
- Change _count variable type from uint64_t to int64_t
- Update _interval_num() to use proper casting for arithmetic
- Change UINT64_MAX to INT64_MAX for default count value
- Remove unnecessary casting in count assignment

This prevents potential underflow issues when _count is decremented or used
in subtraction operations, ensuring proper behavior for interval-based
reporting and count tracking in dmsetup commands.

The fix maintains compatibility while providing safer integer arithmetic
for the reporting loop logic.

(cherry picked from commit 8873599b66612852136b3dbcb4ebefe0164271dd)

2 months agocov: prevent potential negative array index
Zdenek Kabelac [Sun, 29 Jun 2025 18:47:13 +0000 (20:47 +0200)]
cov: prevent potential negative array index

The _stats_map_extents() function processes file extents returned
by FIEMAP ioctl calls. When handling the case where a file has
only a single extent, the code accesses fm_ext[i - 1] to check
if the logical offset is 0.

However, when i is 0 (no extents processed yet), this results in a negative
array index access which can cause undefined behavior or crashes.

So check early whether there are fm_mapped_extents to process.
This avoids using negative index array.

Existing code already checks fm_mapped_extents == 0 before calling
this function so the patch is not fixing any real bug.

(cherry picked from commit 2a2ad7317f19f15982045d847aacd74922a28572)

2 months agolibdm-stats: fix type mismatch in bit operations
Zdenek Kabelac [Fri, 27 Jun 2025 09:38:24 +0000 (11:38 +0200)]
libdm-stats: fix type mismatch in bit operations

The stats implementation was using uint64_t for group_id and loop variables
while calling dm_bit_* functions that return int types. This created a
potential issue where large values could be incorrectly handled due to
implicit casting between signed and unsigned types.

Changes:
- Change loop variables from uint64_t to int in _stats_group_tag_len()
- Change loop variable from uint64_t to int in _stats_clear_group_regions()
- Change loop variables from uint64_t to int in dm_stats_get_counter()
- Change loop variable from uint64_t to int in dm_stats_get_region_len()
- Fix _stats_create_group() to properly handle dm_bit_get_first() return value

This ensures consistent type usage and prevents potential issues with
values exceeding INT_MAX (2^31 - 1). Also this limitats group_id to 31 bits
as a constraint that may need addressing in the future.

FIXME: Maybe consider implementing 64-bit variants of dm_bit functions or
documenting this limitation more prominently is this ever become an
issue...

(cherry picked from commit 2dec6f5493e573b7a4012708931226bcbc9af32f)

2 months agolvmlockd: allow 1 more extra character
Zdenek Kabelac [Fri, 27 Jun 2025 09:15:05 +0000 (11:15 +0200)]
lvmlockd: allow 1 more extra character

Function dm_strncpy() ensures the last character is \0,
so pass whole array size for buffer size.

This give 1 extra character for use to store owner state and name.

(cherry picked from commit 879fb36f0a6c4fda783efbc02b4bf6477f18a4af)

2 months agoman lvmlockd: updates
David Teigland [Tue, 23 Sep 2025 16:09:08 +0000 (11:09 -0500)]
man lvmlockd: updates

Major rewrite of the beginning description/setup/introduction.

(cherry picked from commit f15d948720b4a8b52b7929856ee52e20ab0da798)

2 months agolvmlockd: always free ls struct after ls thread exits
David Teigland [Fri, 5 Sep 2025 17:21:12 +0000 (12:21 -0500)]
lvmlockd: always free ls struct after ls thread exits

The ls struct was being freed after ls thread exit for common stop,
but was missing when the ls thread was stopped for drop and rename.
Also free ls->actions structs in case any still exist.

(cherry picked from commit 5b410e589c75d0d540e4ebe4f44cc71b5624cbc6)

2 months agolvmlockd-sanlock: check lock_lv_offset_from_args result
David Teigland [Tue, 1 Jul 2025 16:23:16 +0000 (11:23 -0500)]
lvmlockd-sanlock: check lock_lv_offset_from_args result

(cherry picked from commit f35f074afdaa52b0db098911d97202b478a33085)

2 months agolvmlockd: free structs in adopt error path
David Teigland [Tue, 1 Jul 2025 15:53:33 +0000 (10:53 -0500)]
lvmlockd: free structs in adopt error path

(cherry picked from commit fcca60fda61b5a545c936e61380e047deb887779)

2 months agolvmlockd-sanlock: fix struct pointer in release_rename
David Teigland [Tue, 1 Jul 2025 15:22:50 +0000 (10:22 -0500)]
lvmlockd-sanlock: fix struct pointer in release_rename

(cherry picked from commit 03a343dc9e49b164fe0d153b0b0dc815f18edd6e)

2 months agosanlock: match lm_lock_sanlock prototype
Zdenek Kabelac [Wed, 2 Jul 2025 09:46:20 +0000 (11:46 +0200)]
sanlock: match lm_lock_sanlock prototype

(cherry picked from commit 95c77bc922ec9867764ddd95df635444804c12ba)

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

(cherry picked from commit 3dc5c3fc9e1dcbca8f74fa5e7df3e0750d66975a)

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

(cherry picked from commit d5abc55fcf31dbd8b52036340e085c9f7e8d61b2)

2 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.

(cherry picked from commit 80144223e700703f76267b8d033e2d7d04156ee9)

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

(cherry picked from commit 986ff7b9cdd6a4af1d79706c80e9660c4ccbf423)

2 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

(cherry picked from commit 1cd2f35655e79d880d28914998b738baa0be5c07)

2 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

(cherry picked from commit 03e3b27ba094cc6e58113713a0d36a8b3190a2f3)

2 months agolv_manip.c: fix lvresize corruption in LV->crypt->FS stack if near crypt min size...
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.

(cherry picked from commit 5da3676ff3901fd099dcdd2bd7478fa9ea4f54dc)

2 months agoudev: fix autoactivation on top of loop dev PVs
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).

(cherry picked from commit bd26e768efa534ba95f801c411a2a9581992a993)

2 months agolvmlockd: add repair option to reinitialize sanlock leases
David Teigland [Mon, 30 Jun 2025 17:59:49 +0000 (12:59 -0500)]
lvmlockd: add repair option to reinitialize sanlock leases

If sanlock leases become corrupted, adding --lockopt repair
to the command will let lvmlockd reinitialize them.

(cherry picked from commit 4bc52d2dc5dee3c57f88d58c3143e8a2f4d44d9f)

2 months agolvmlockd: fix missing free in vg_status
David Teigland [Thu, 26 Jun 2025 18:42:38 +0000 (13:42 -0500)]
lvmlockd: fix missing free in vg_status

and add more checking of get_hosts result.

used by lockd_vg_is_started() for the PR feature.

(cherry picked from commit 5f0ddd0fd891e769577f6cd3546326f18dbc3bca)

2 months agoWHATS_NEW_DM: update
Marian Csontos [Mon, 5 May 2025 15:36:05 +0000 (17:36 +0200)]
WHATS_NEW_DM: update

(cherry picked from commit 72f203a02d7f30d5afdaa853a082b2b1d1f56297)

2 months agoRevert "10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"
Marian Csontos [Thu, 16 May 2024 13:30:48 +0000 (15:30 +0200)]
Revert "10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"

This reverts commit f98d020eadafe7d8db7bec1f5a26915615e5a6a9.

(cherry picked from commit ebd5feaca2779c9379a14ba6f74a47214d03d94b)

2 months agoRevert "11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"
Marian Csontos [Thu, 16 May 2024 13:30:37 +0000 (15:30 +0200)]
Revert "11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"

This reverts commit 2b2f11a74cd5cc05f266fd0c65f0e55eb8bafd9f.

(cherry picked from commit 4316c786f25f8b01b831458f8baf1f77faad79ba)

2 months agoRevert "dm udev rules: don't export and save DM_SUSPENDED"
Marian Csontos [Thu, 16 May 2024 13:30:24 +0000 (15:30 +0200)]
Revert "dm udev rules: don't export and save DM_SUSPENDED"

This reverts commit 21ca92c4325b6b161fb1e1f10942ad9f8d23c144.

(cherry picked from commit 2280f85310b82c03b43dfd88e0712c5921a36ffc)

2 months agoRevert "dm udev rules: don't export and save DM_NOSCAN"
Marian Csontos [Thu, 16 May 2024 13:30:15 +0000 (15:30 +0200)]
Revert "dm udev rules: don't export and save DM_NOSCAN"

This reverts commit a196752969320cfc34a97cc97afa1978fa57da73.

(cherry picked from commit 6a15577cb02603512afce0f13a591183105c8f73)

2 months agoRevert "10-dm.rules: bump DM_UDEV_RULES_VSN to 3"
Marian Csontos [Thu, 16 May 2024 13:30:02 +0000 (15:30 +0200)]
Revert "10-dm.rules: bump DM_UDEV_RULES_VSN to 3"

This reverts commit 038f9254d9554654197b59c160e3f775af27cdb1.

(cherry picked from commit 408a80fdd46d3854c92dfce1bff3a376aea611d1)

2 months agoRHEL9
Marian Csontos [Thu, 3 Oct 2024 14:14:11 +0000 (16:14 +0200)]
RHEL9

(cherry picked from commit 4ed40e67197778b28e4b822558614a517242e3e1)

5 months agopre-release 2.03.33 1893428868 v2_03_33
Marian Csontos [Fri, 27 Jun 2025 08:14:33 +0000 (10:14 +0200)]
pre-release 2.03.33

5 months agoWHATS_NEW: update 1890649736
Peter Rajnoha [Thu, 26 Jun 2025 08:50:20 +0000 (10:50 +0200)]
WHATS_NEW: update

5 months agolibdm: Escape all literal control characters in report strings 30/head 1890642143
Adrian Astley [Wed, 25 Jun 2025 16:04:56 +0000 (12:04 -0400)]
libdm: Escape all literal control characters in report strings

LVM objects (like pv_device_id) can sometimes contain literal control characters. The JSON spec disallows control characters. So we need to escape them for output.

Closes https://gitlab.com/lvmteam/lvm2/-/issues/35

5 months agoWHATS_NEW: update 1889790107
Zdenek Kabelac [Wed, 25 Jun 2025 20:46:06 +0000 (22:46 +0200)]
WHATS_NEW: update

5 months agocodespell: fix various typos across codebase
Zdenek Kabelac [Wed, 25 Jun 2025 19:07:28 +0000 (21:07 +0200)]
codespell: fix various typos across codebase

- lib/device/filesystem.c: 'avaiable' -> 'available' in btrfs comment
- lib/format_text/export.c: 'sting' -> 'string' in comment
- lib/log/log.c: 'expectes' -> 'expects' in coverity comment
- lib/metadata/metadata.c: 'damanging' -> 'damaging' in comment
- lib/metadata/metadata.h: 'Aditional' -> 'Additional' in comment
- test/shell/000-basic.sh: 'supression' -> 'suppression' in comment
- test/shell/pvcreate-partition.sh: 'lable' -> 'label' in comment
- test/shell/topology-support.sh: 'standart' -> 'standard' in comment
- WHATS_NEW:
  * 'propperly' -> 'properly'
  * 'cachable' -> 'cacheable'

5 months agotests: switch to new skip options for test scripts
Zdenek Kabelac [Sat, 21 Jun 2025 21:39:03 +0000 (23:39 +0200)]
tests: switch to new skip options for test scripts

Update test scripts to use new command-line options for skipping tests,
replacing the previous use of environment variables. The following options
are now supported:

  --skip-root-dm-check
  --skip-with-devices-file
  --skip-with-lvmpolld
  --skip-with-lvmlockd

- Add command-line option parsing to lib/inittest.sh.
- Replace SKIP_ROOT_DM_CHECK=1 with --skip-root-dm-check.
- Replace SKIP_WITH_DEVICES_FILE=1 with --skip-with-devices-file.
- Replace SKIP_WITH_LVMPOLLD=1 with --skip-with-lvmpolld.
- Replace SKIP_WITH_LVMLOCKD=1 with --skip-with-lvmlockd.
- Update 410 test files to use the new syntax.

This change provides a cleaner, more consistent, and maintainable
way to handle test skipping across the test suite.
Also eliminates number of shellcheck errors.

TODO: convert couple more remaining.

5 months agobuild: fix include paths for out-of-source builds
Zdenek Kabelac [Wed, 25 Jun 2025 19:46:01 +0000 (21:46 +0200)]
build: fix include paths for out-of-source builds

Fix include paths in cmd_enum.h and command.c by removing the "include/"
prefix from #include directives. This resolves build failures when
building from a directory different from the source directory.

The include paths were incorrectly referencing "include/cmds.h" instead
of "cmds.h", causing compilation errors in out-of-source builds.

5 months agoman: fix ellipsis formatting
Zdenek Kabelac [Wed, 25 Jun 2025 17:52:54 +0000 (19:52 +0200)]
man: fix ellipsis formatting

(use \&... instead of ... for proper troff rendering)
in lvmlockd, lvmreport, lvmvdo man pages

5 months agoman: remove quotes from section headers
Zdenek Kabelac [Wed, 25 Jun 2025 17:46:53 +0000 (19:46 +0200)]
man: remove quotes from section headers

Remove unnecessary quotes from section headers in man pages:
- lvm_import_vdo.8_main: .SH "NAME" -> .SH NAME
- fsadm.8_main: .SH "NAME" -> .SH NAME

This improves consistency and follows man page conventions.

Originated-by: Cursor AI
5 months agoman: fix company name formatting (missing comma)
Zdenek Kabelac [Wed, 25 Jun 2025 17:38:26 +0000 (19:38 +0200)]
man: fix company name formatting (missing comma)

Fix company name format in .TH headers by adding missing comma:
- dmeventd.8_main: 'Red Hat Inc' -> 'Red Hat, Inc.'
- cmirrord.8_main: 'Red Hat Inc' -> 'Red Hat, Inc.'
- lvmpolld.8_main: 'Red Hat Inc' -> 'Red Hat, Inc.'
- lvmdbusd.8_main: 'Red Hat Inc' -> 'Red Hat, Inc.'
- lvm_import_vdo.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmlockctl.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmcache.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmvdo.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- blkdeactivate.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmthin.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmreport.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmsadc.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmautoactivation.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmlockd.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- fsadm.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmraid.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmsystemid.7_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'
- lvmsar.8_main: 'Red Hat, Inc' -> 'Red Hat, Inc.'

This ensures consistent company name formatting across all man pages.

Originated-by: Cursor AI
5 months agoman: fix English grammar and style issues
Zdenek Kabelac [Sat, 21 Jun 2025 19:22:21 +0000 (21:22 +0200)]
man: fix English grammar and style issues

- cmirrord.8_main: Remove unnecessary article 'the' before 'corosync'
- dmsetup.8_main: Fix multiple grammar and punctuation issues
  * Add missing 'to' in 'Set this to zero to continue'
  * Fix 'eg,' -> 'e.g.,' and add missing comma
  * Add missing 'the' in 'for the live device'
  * Fix 'customised by following options' -> 'customised by the following options'
  * Fix 'comma-separate' -> 'comma-separated'
- fsadm.8_main: Improve sentence structure for dm-crypt description
- lvm.8_main: Fix capitalization 'volume Groups' -> 'Volume Groups'
- lvm_import_vdo.8_main: Fix header title and multiple grammar issues
  * Fix header title 'FSADM' -> 'LVM_IMPORT_VDO'
  * Fix 'LV a backend device' -> 'LV as a backend device'
  * Fix 'the of volume group' -> 'the name of the volume group'
  * Remove extra 'with' in 'with within volume group'
- lvmsystemid.7_main: Fix punctuation 'e.g.' -> 'e.g.,' and 'i.e.' -> 'i.e.,'

These changes improve grammatical correctness, consistency, and readability.

Originated-by: Cursor AI
5 months agoman: fix grammar and spelling issues
Zdenek Kabelac [Sat, 21 Jun 2025 19:43:19 +0000 (21:43 +0200)]
man: fix grammar and spelling issues

- dmeventd.8_main: Fix verb form 'present' -> 'presents' and spelling
  'free recover' -> 'recover free'
- dmfilemapd.8_main: Fix missing preposition
  'mode the daemon' -> 'mode of the daemon'
- dmstats.8_main: Fix American spelling 'Capitalise' -> 'Capitalize'
- lvmcache.7_main: Fix missing article
  'writecache block size' -> 'a writecache block size'

These changes improve grammatical correctness and consistency.

Originated-by: Cursor AI
5 months agotools: fix English grammar and spelling issues in args.h
Zdenek Kabelac [Sat, 21 Jun 2025 19:31:25 +0000 (21:31 +0200)]
tools: fix English grammar and spelling issues in args.h

- Fix typo: writethough -> writethrough in cachemode description
- Fix grammar: 'enabled or disable' -> 'enabled or disabled' for VDO options
- Fix typo: 'user date' -> 'user data' in RAID nosync description
- Fix grammar: 'a an LV' -> 'an LV' in poolmetadata description

These changes improve documentation clarity and correctness.

Originated-by: Cursor AI
5 months agotests: typo test-branch-list 1867454503
Zdenek Kabelac [Thu, 12 Jun 2025 21:37:37 +0000 (23:37 +0200)]
tests: typo

7 should have replaced 8.

5 months agotests: aux lower 8EiB size 1866929155
Zdenek Kabelac [Thu, 12 Jun 2025 14:52:06 +0000 (16:52 +0200)]
tests: aux lower 8EiB size

Reduce ~8EiB sized device by few sectors to avoid endless loop
from systemd-udev device scan.

Use of 180143985094819876 solves the issues.

5 months agotests: aux teardown clear tables in parallel
Zdenek Kabelac [Wed, 11 Jun 2025 11:39:36 +0000 (13:39 +0200)]
tests: aux teardown clear tables in parallel

To avoid getting possibly stuck waiting on suspended LVs,
run 'dmsetup clear' in parallel in teardown of device stack.

5 months agoWHATS_NEW: update 1866159748
Peter Rajnoha [Wed, 11 Jun 2025 12:08:30 +0000 (14:08 +0200)]
WHATS_NEW: update

5 months agotools: reporter: cleanup: setting of cmd->report_strict_type_mode
Peter Rajnoha [Wed, 11 Jun 2025 11:06:07 +0000 (13:06 +0200)]
tools: reporter: cleanup: setting of cmd->report_strict_type_mode

Make setting of cmd->report_string_type_mode easier to follow.

5 months agotools: reporter: override LC_NUMERIC if needed for json_std format
Peter Rajnoha [Wed, 11 Jun 2025 09:55:30 +0000 (11:55 +0200)]
tools: reporter: override LC_NUMERIC if needed for json_std format

Override LC_NUMERIC part of the locale to "C" if we detect that the
radix character interferes with JSON_STD format. If that's the case,
override LC_NUMERIC locale to "C" in report_format_init, that is,
before any reporting is executed (including log reporting). Restore
it back in report_format_destroy, that is, once we're sure that all
reporting is finished.

Related: https://gitlab.com/lvmteam/lvm2/-/issues/33

5 months agotools: reporter: cleanup: factor out code to new report_format_destroy
Peter Rajnoha [Wed, 11 Jun 2025 11:08:42 +0000 (13:08 +0200)]
tools: reporter: cleanup: factor out code to new report_format_destroy

We already have report_format_init. Having report_format_destroy makes
it easier to read and follow the code using these functions.

5 months agolibdm: report: require '.' radix char for DM_REPORT_GROUP_JSON_STD
Peter Rajnoha [Wed, 11 Jun 2025 09:21:29 +0000 (11:21 +0200)]
libdm: report: require '.' radix char for DM_REPORT_GROUP_JSON_STD

When a report is under DM_REPORT_GROUP_JSON_STD, the formatting of the
report follows more standard form of the JSON output. This includes
unquoted numbers (as opposed to the DM_REPORT_GROUP_JSON).

The JSON standard dictates the radix character (decimal point) must
be '.' only (https://www.rfc-editor.org/rfc/rfc7158#section-6).

However, some locales may use other character for the radix delimiter,
like ','. This character also interferes with ',' used as delimiter for
json items.

Therefore, we need to check whether current locale is not posing an
issue when using DM_REPORT_GROUP_JSON_STD. If that's the case, simply
error out from dm_report_group_create as we don't want to override
current locale in libdm or do anything else at this level. The libdm
caller is responsible here for setting the proper locale.

Related: https://gitlab.com/lvmteam/lvm2/-/issues/33

6 months agolvmlockctl: fix leading spaces in scanf alternative commit 0217887fcdd901ccaa4ed06165... 1817158097
Heinz Mauelshagen [Wed, 14 May 2025 12:36:27 +0000 (14:36 +0200)]
lvmlockctl: fix leading spaces in scanf alternative commit 0217887fcdd901ccaa4ed06165cd2c223fb376c1

6 months agotests: aux use 8EiB sized devices 1816967841
Zdenek Kabelac [Wed, 14 May 2025 10:49:37 +0000 (12:49 +0200)]
tests: aux use 8EiB sized devices

From kernel 6.15 DM block devices with size >= 8EiB can't be created.

6 months agotest: addm shell/lvresize-btrfs.sh 1815646373
Su Yue [Tue, 13 May 2025 06:14:27 +0000 (14:14 +0800)]
test: addm shell/lvresize-btrfs.sh

refer legacy patche:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00055.html

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
[Adjust to lvresize]
Signed-off-by: Su Yue <glass.su@suse.com>
6 months agolvresize: add btrfs support
Su Yue [Tue, 13 May 2025 06:14:26 +0000 (14:14 +0800)]
lvresize: add btrfs support

This commit adds lvresize/lvextend/lvreduce support for btrfs.
'btrfs filesystem resize [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path>'
is used to resize one device only when it's mounted.
The code pattern is like xfs but it supports shrink.

For multi-devices btrfs, There is one difficulty to be handled:

If `lvreduce --fs resize` is given, lvm2 will check newsize vs current fs size
to judge if it's need to shrink fs or not.
For one device btrfs, fslastblock * fsblocksize/FSSIZE is the correct value like
ext* and xfs. But for multi-devices btrfs, the two values are whole fs size.
There is no other way without relying btrfs superblock parse. It's too
complicated and inproper to implemnt the logic in lvm2.
So here just sets fs_last_byte to 0 for btrfs and skips boundary check in
_fs_reduce_allow(). It's safe as btrfs will handle it well.

The another complicated part is how to get mount point info if multi-devices.
There is only one mnt entry per mounted fs in /etc/mtab even it's a
multi-devices btrfs. So we first get uuid from lv device then traverse devices
under /sys/fs/btrfs/$uuid/devices and compare them to the mnt entry to get the
mount point.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agofilesystem: factor out get mount point logic from fs_get_info() into _fs_get_mnt()
Su Yue [Tue, 13 May 2025 06:14:25 +0000 (14:14 +0800)]
filesystem: factor out get mount point logic from fs_get_info() into _fs_get_mnt()

The new _fs_get_mnt() is used to get mount point info for fses.
No functional change.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agofilesystem: get device uuid in fs_get_blkid
Su Yue [Tue, 13 May 2025 06:14:24 +0000 (14:14 +0800)]
filesystem: get device uuid in fs_get_blkid

Add new field fs_info::uuid to record device uuid when calling
fs_get_blkid() for further use.

No functional change.

Signed-off-by: Su Yue <glass.su@suse.com>
6 months agoraid: use byte order conversion macros 1813095425
Zdenek Kabelac [Mon, 12 May 2025 13:48:35 +0000 (15:48 +0200)]
raid: use byte order conversion macros

As we already use  le_to_cpu() and cpu_to_be() elsewhere
and have a macros usable across wide variety of distros,
switch to use these.

6 months agotests: fix typo in PAGE_SIZE check 1813001121
Zdenek Kabelac [Mon, 12 May 2025 09:19:55 +0000 (11:19 +0200)]
tests: fix typo in PAGE_SIZE check

Here 1 meant to by shifted by 20 bits...
Otherwise it always falback to just 4K.

6 months agoWHATS_NEW: update
Zdenek Kabelac [Mon, 12 May 2025 13:07:15 +0000 (15:07 +0200)]
WHATS_NEW: update

6 months agoman: update raid man
Zdenek Kabelac [Mon, 12 May 2025 13:05:46 +0000 (15:05 +0200)]
man: update raid man

Mention repair of transiently lost devices.

6 months agolvmlockd: fix sanlock_release for vgremove 1807814397
David Teigland [Thu, 8 May 2025 15:54:50 +0000 (10:54 -0500)]
lvmlockd: fix sanlock_release for vgremove

incorrect data was being copied to lease structs passed
to sanlock_release(), making the lease removal fail.

6 months agolvmlockd: fix hosts check for vgremove
David Teigland [Wed, 7 May 2025 22:51:01 +0000 (17:51 -0500)]
lvmlockd: fix hosts check for vgremove

errors from lock manager were not being considered.
EAGAIN from sanlock should be considered EBUSY.

6 months agolvmlockd: keep using ifdef 1805630267
Zdenek Kabelac [Wed, 7 May 2025 14:58:46 +0000 (16:58 +0200)]
lvmlockd: keep using ifdef

We are not defining LOCKDSANLOCK_SUPPORT when there is no support
for sanlock enabled.

6 months agoconfigure: autoreconf
Zdenek Kabelac [Wed, 7 May 2025 14:56:20 +0000 (16:56 +0200)]
configure: autoreconf

6 months agoconfigure.ac: set lowest version
Zdenek Kabelac [Wed, 7 May 2025 15:00:41 +0000 (17:00 +0200)]
configure.ac: set lowest version

As we always require and check for version 3.7,
avoid extra CHECK_EXIST and go for CHECK_MODULE.

LOCKDSANLOCK_SUPPORT is not defined is the build
is not enabled.

When build for sanlock is enabled, and
CHEKC_MODULE does not detect at least version 3.7
then whole configure process errors out.

6 months agotest: check raid superblock clearing
Zdenek Kabelac [Sun, 2 Feb 2025 18:21:05 +0000 (19:21 +0100)]
test: check raid superblock clearing

6 months agolvconvert: allow clearing superblocks
Zdenek Kabelac [Fri, 31 Jan 2025 20:45:57 +0000 (21:45 +0100)]
lvconvert: allow clearing superblocks

6 months agoraid: count or clear transiently failed devices
Heinz Mauelshagen [Tue, 5 Nov 2024 17:33:19 +0000 (18:33 +0100)]
raid: count or clear transiently failed devices

Count or clear transiently failed devices as of dm-raid superblocks.
Updated debuging.
Use lvconvert --repair to repair transiently failed legs.
Activating all 'meta' LVs with single sync_local_dev_names().
Using proper DM path for meta LV.

Modified-by: zkabelac@redhat.com
6 months agolvmlockd: detect sanlock version in configure to enable new code 1803796799
David Teigland [Tue, 6 May 2025 21:06:24 +0000 (16:06 -0500)]
lvmlockd: detect sanlock version in configure to enable new code

6 months agolvmlockd: disable use of new sanlock apis 1803307864
David Teigland [Tue, 6 May 2025 17:07:54 +0000 (12:07 -0500)]
lvmlockd: disable use of new sanlock apis

6 months agolvmlockd: use error for corrupted sanlock lease in start
David Teigland [Thu, 17 Apr 2025 16:25:00 +0000 (11:25 -0500)]
lvmlockd: use error for corrupted sanlock lease in start

if sanlock delta lease for host_id is corrupt, then
return ELOCKREPAIR.

6 months agolvmlockd: add error for corrupted sanlock lease
David Teigland [Fri, 21 Mar 2025 20:26:51 +0000 (15:26 -0500)]
lvmlockd: add error for corrupted sanlock lease

A specific error message can be printed for this case:
"sanlock lease needs repair"

6 months agolvmlockd: add vg_status operation and fix sanlock read_lockspace_info
David Teigland [Tue, 22 Apr 2025 20:26:24 +0000 (15:26 -0500)]
lvmlockd: add vg_status operation and fix sanlock read_lockspace_info

6 months agolvmlockd: use new sanlock_read_lockspace_host for prev generation
David Teigland [Thu, 17 Apr 2025 16:12:40 +0000 (11:12 -0500)]
lvmlockd: use new sanlock_read_lockspace_host for prev generation

return previous sanlock generation number in the start_vg response.

6 months agolvmlockd: use new sanlock_acquire2 to return owner info
David Teigland [Fri, 21 Mar 2025 16:36:49 +0000 (11:36 -0500)]
lvmlockd: use new sanlock_acquire2 to return owner info

Use the new sanlock_acquire2() which returns info about the owner
of a lease.  Pass this info back to the lvm command, where it's
initially used to print the host_id of a host holding a lock
when it cannot be acquired.

6 months agolvmlockctl: sscanf alternative 1801476200
David Teigland [Mon, 5 May 2025 20:44:47 +0000 (15:44 -0500)]
lvmlockctl: sscanf alternative

Add szscanf() to use in place of sscanf. It takes a buffer size for
strings, so avoids needing to use max field width, which is hard to
read when implemented with stringify macros.

6 months agopost-release 1801459039
Marian Csontos [Mon, 5 May 2025 15:02:06 +0000 (17:02 +0200)]
post-release

6 months agopre-release 2.03.32 1801459141 v2_03_32
Marian Csontos [Mon, 5 May 2025 15:02:06 +0000 (17:02 +0200)]
pre-release 2.03.32

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