lvm2.git
5 months agolvmlockd-sanlock: remove info file when vg is removed 1900884930
David Teigland [Tue, 1 Jul 2025 18:36:23 +0000 (13:36 -0500)]
lvmlockd-sanlock: remove info file when vg is removed

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

5 months agolvmlockd: check adopt file fflush and fclose 1900704942
David Teigland [Tue, 1 Jul 2025 16:17:06 +0000 (11:17 -0500)]
lvmlockd: check adopt file fflush and fclose

5 months agolvmlockd: check sscanf results when reading file values 1900697067
David Teigland [Tue, 1 Jul 2025 16:11:59 +0000 (11:11 -0500)]
lvmlockd: check sscanf results when reading file values

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

5 months agolvmlockd-sanlock: fix size in dm_snprintf 1900604529
David Teigland [Tue, 1 Jul 2025 15:27:55 +0000 (10:27 -0500)]
lvmlockd-sanlock: fix size in dm_snprintf

5 months agolvmlockd-sanlock: fix uninitialized time value
David Teigland [Tue, 1 Jul 2025 15:25:48 +0000 (10:25 -0500)]
lvmlockd-sanlock: fix uninitialized time value

5 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

5 months agoconfigure: update 1900591918
Zdenek Kabelac [Tue, 1 Jul 2025 10:34:19 +0000 (12:34 +0200)]
configure: update

5 months agoWHATS_NEW: update 31/head 1900425768
Heinz Mauelshagen [Tue, 1 Jul 2025 14:33:18 +0000 (16:33 +0200)]
WHATS_NEW: update

5 months agotest: adjust lvconvert-raid.sh to now erroring non-changing image raid1 request 1900410974
Heinz Mauelshagen [Tue, 1 Jul 2025 14:29:02 +0000 (16:29 +0200)]
test: adjust lvconvert-raid.sh to now erroring non-changing image raid1 request

See commit c901528053e7f63538239431480f20db8b7d4ca.

5 months agolvconvert: error raid1 LV non-changing image count request 1900303270
Heinz Mauelshagen [Tue, 1 Jul 2025 13:51:42 +0000 (15:51 +0200)]
lvconvert: error raid1 LV non-changing image count request

In case a Raid1LV has e.g. 3 images already, running "lvconvert --mirrors 2 $Raid1LV"
results in success even though the image count didn't change.
Make it fail in such case.

Related issue: https://issues.redhat.com/browse/RHEL-82138

5 months agolvmlockd: add repair option to reinitialize sanlock leases 1898499112
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.

5 months agoWHATS_NEW: update 1898194616
Zdenek Kabelac [Mon, 30 Jun 2025 14:55:54 +0000 (16:55 +0200)]
WHATS_NEW: update

5 months agogcc: fix signness warnings with explicit casts
Zdenek Kabelac [Sun, 29 Jun 2025 14:52:51 +0000 (16:52 +0200)]
gcc: fix signness warnings with explicit casts

Add explicit type casts to resolve GCC signness comparison warnings:
- Cast dest_size to int in lvmlockctl.c
- Cast NVME_IDENTIFY_DATA_SIZE to int in nvme.c
- Cast bitwise AND results to int in nvme.c and persist.c
- Cast DM_STATS_GROUP_NOT_PRESENT to int in libdm-stats.c

5 months agogcc: clean cast from size_t to void ptr
Zdenek Kabelac [Sun, 29 Jun 2025 15:00:43 +0000 (17:00 +0200)]
gcc: clean cast from size_t to void ptr

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

5 months agocov: ensure nsid is defined
Zdenek Kabelac [Fri, 27 Jun 2025 10:18:30 +0000 (12:18 +0200)]
cov: ensure nsid is defined

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

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

5 months agocov: fix warn for variable-sized dm_ulog_request structure
Zdenek Kabelac [Mon, 30 Jun 2025 11:53:08 +0000 (13:53 +0200)]
cov: fix warn for variable-sized dm_ulog_request structure

Change kernel_send() function signature from accepting struct dm_ulog_request*
to void* to properly handle variable-sized data access.

The dm_ulog_request structure contains a flexible array member (data[0])
that allows variable-sized payloads to be appended. When accessing data
beyond the base structure size, Coverity correctly flags this as a
potential buffer overrun since the structure size doesn't account for
the variable data.

By using void* as the parameter type, we make it explicit that we're
working with a memory region that may extend beyond the base structure,
eliminating the false positive while maintaining type safety through
proper casting within the function.

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

5 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

5 months agocov: explicitly ignore return of _lv_types_match()
Zdenek Kabelac [Mon, 30 Jun 2025 12:32:25 +0000 (14:32 +0200)]
cov: explicitly ignore return of _lv_types_match()

Add explicit (void) cast to ignore the return value of _lv_types_match()
in _check_lv_rules() function. This addresses Coverity warning about
unused return values and maintains consistency with other similar
function calls in the codebase that properly handle return values.

5 months agocov: add annotations to suppress fp warnings
Zdenek Kabelac [Sun, 29 Jun 2025 18:43:31 +0000 (20:43 +0200)]
cov: add annotations to suppress fp warnings

Add Coverity annotations to suppress false positive warnings in several
files where the static analysis tool incorrectly flags potential issues
that are actually safe due to proper validation or intentional behavior.

The annotations address the following false positives:

- daemons/dmeventd/dmeventd.c: overflow_sink warnings for 'current' variable
  that is validated to be positive before use in buffer operations

- daemons/lvmlockd/lvmlockd-core.c: overflow_sink warning for 'ret' variable
  that is validated to be positive before use

- lib/config/config.c: overflow_sink warning for 'sz' variable that is
  validated to be positive before use in read operations

- libdm/dm-tools/dmsetup.c: overflow_sink, overflow, and deref_overflow
  warnings for 'n' variable that is validated to be positive before use
  in buffer operations and string termination

- libdm/libdm-stats.c: overflow_sink warning for 'i & j' variables that are
  validated to be positive before use in array indexing

5 months agocov: add checked variants for mda_is_ignored and rlocn_is_ignored
Zdenek Kabelac [Mon, 30 Jun 2025 13:31:10 +0000 (15:31 +0200)]
cov: add checked variants for mda_is_ignored and rlocn_is_ignored

Introduce _mda_is_ignored() and _rlocn_is_ignored() wrapper functions
with warn_unused_result attribute to enforce return value checking.

This follows the established pattern used by dm_strncpy() and _dm_strncpy():
- Functions without underscore prefix can be used without checking return values
- Functions with underscore prefix must have their return values checked

The change improves static analysis coverage by ensuring that critical
metadata area and raw location ignored state checks are properly validated,
reducing the risk of unhandled error conditions in metadata processing.

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

5 months agocov: replace unsafe strcpy
Zdenek Kabelac [Sun, 29 Jun 2025 13:16:48 +0000 (15:16 +0200)]
cov: replace unsafe strcpy

Replace potentially unsafe strcpy() with bounds-checked memcpy()
and proper null termination in the _sysfs_get_dm_name() function.
This prevents buffer overflow vulnerabilities when copying device
mapper names from sysfs.

Also replace another strcpy() with _dm_strncpy() which also checks
whether copied string with into a given buffer in the function
_sysfs_get_kernel_name().

Changes:

- Replace strcpy(buf, temp_buf) with memcpy(buf, temp_buf, len) + buf[len] = '\0'
- Use stack-allocated buffers instead of malloc/dm_malloc for better performance
- Improve error handling logic for ENOENT vs other errors
- Add proper newline stripping with bounds checking
- Remove memory allocation failure paths and cleanup code

This addresses potential security issues identified by static analysis
tools while also improving performance by avoiding dynamic memory allocation.

5 months agocov: reduce strcpy usage
Zdenek Kabelac [Fri, 27 Jun 2025 20:17:12 +0000 (22:17 +0200)]
cov: reduce strcpy usage

Coverity does not like strcpy() calls...

5 months agocov: improve page size validation and calculation
Zdenek Kabelac [Sat, 28 Jun 2025 20:50:29 +0000 (22:50 +0200)]
cov: improve page size validation and calculation

- Add bounds checking for sysconf(_SC_PAGESIZE) return value
- Validate page size is positive and reasonable (< 16MB)
- Use size_t for page_size variable to match usage context
- Simplify page calculation with ceiling division
- Fix potential integer overflow in page count calculation

This improves robustness when handling edge cases in clustered
mirror log disk operations.

5 months agocov: prevent unsigned underflow
Zdenek Kabelac [Sat, 28 Jun 2025 07:58:46 +0000 (09:58 +0200)]
cov: prevent unsigned underflow

Use signed int instead of size_t for loop counter to prevent reporting
unsigned underflow when decrementing from 0 in Coverity.
Loops itself worked just fine.

5 months agocov: prefer snprintf
Zdenek Kabelac [Fri, 27 Jun 2025 20:17:52 +0000 (22:17 +0200)]
cov: prefer snprintf

5 months agocov: ensure read got some bytes
Zdenek Kabelac [Fri, 27 Jun 2025 11:08:27 +0000 (13:08 +0200)]
cov: ensure read got some bytes

5 months agocov: check error return from mktime
Zdenek Kabelac [Sat, 28 Jun 2025 07:53:49 +0000 (09:53 +0200)]
cov: check error return from mktime

Handle mktime() error path value -1 and for such invalid time_t value
return 0 tz offset.

5 months agocov: simplify obtaining value
Zdenek Kabelac [Fri, 27 Jun 2025 12:00:08 +0000 (14:00 +0200)]
cov: simplify obtaining value

Function arg_str_value() calls arg_is_seg() to check whether arg is set.
At the same time Coverity can see check for non NULL of 'op'.

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

5 months agocov: fix double-close bug in _btrfs_get_mnt function
Zdenek Kabelac [Fri, 27 Jun 2025 10:22:24 +0000 (12:22 +0200)]
cov: fix double-close bug in _btrfs_get_mnt function

Ensure file descriptor is closed only once by moving close() call
to immediately after read() and setting fd = -1 to prevent reuse.

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

5 months agodebug: add missing error path traces
Zdenek Kabelac [Fri, 27 Jun 2025 09:27:05 +0000 (11:27 +0200)]
debug: add missing error path traces

Trace failures of close() and unlink() syscalls.

5 months agolvmlockd: optimize lock_type access in lockd_start_vg
Zdenek Kabelac [Fri, 27 Jun 2025 09:44:19 +0000 (11:44 +0200)]
lvmlockd: optimize lock_type access in lockd_start_vg

Store vg->lock_type in a local variable to avoid repeated null checks
and string comparisons throughout the function. This improves code
readability and eliminates redundant conditional evaluations.

5 months agolvconvert: refactor counting of failed mirrors
Zdenek Kabelac [Sun, 29 Jun 2025 15:55:45 +0000 (17:55 +0200)]
lvconvert: refactor counting of failed mirrors

Change return value semantics:
- Previously returned -1 for non-mirrored segments (error condition)
- Now returns 0 for non-mirrored segments (no failed mirrors) and
  reports INTERNAL_ERROR for such case.
- This makes the function more consistent as it counts failures, not errors

Simplify recursive calls:
- Remove unnecessary intermediate variable 'r' in both functions
- Directly add recursive call results to return value
- Eliminates redundant error checking for recursive calls

Code cleanup:
- Remove unused variable declarations
- Improve code readability and reduce compiler warnings

The refactoring makes the functions more robust and easier to understand
while preserving their core behavior of counting failed mirror images
and logs across logical volume segments.

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

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

5 months agotests: check lvcreate thin with setautoactivation
Zdenek Kabelac [Mon, 30 Jun 2025 14:55:02 +0000 (16:55 +0200)]
tests: check lvcreate thin with setautoactivation

5 months agolvcreate: accept --setautoactivation flag for all volumes
Friedrich Weber [Fri, 27 Jun 2025 15:23:40 +0000 (17:23 +0200)]
lvcreate: accept --setautoactivation flag for all volumes

lvcreate accepts --setautoactivation for thick logical volumes, but
not for e.g. thin volumes (see linked bug report). Currently, in such
cases, a subsequent lvchange invocation is necessary to change the
autoactivation flag.

To fix this, make lvcreate accept the flag for all volumes by adding
it to LVCREATE_ARGS.

Fixes: https://gitlab.com/lvmteam/lvm2/-/issues/32
Fixes: 0a28e3c44 ("Add metadata-based autoactivation property for VG and LV")
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
5 months agoaux: missed _executable in config name 1893428517
Zdenek Kabelac [Thu, 26 Jun 2025 20:56:59 +0000 (22:56 +0200)]
aux: missed _executable in config name

5 months agoWHATS_NEW: update
Zdenek Kabelac [Thu, 26 Jun 2025 19:41:50 +0000 (21:41 +0200)]
WHATS_NEW: update

5 months agomake: generate
Zdenek Kabelac [Thu, 26 Jun 2025 19:10:34 +0000 (21:10 +0200)]
make: generate

5 months agogcc: keep code compilable with std=c99
Zdenek Kabelac [Thu, 26 Jun 2025 19:48:42 +0000 (21:48 +0200)]
gcc: keep code compilable with std=c99

5 months agogcc: ensure proper value initialization
Zdenek Kabelac [Thu, 26 Jun 2025 20:09:47 +0000 (22:09 +0200)]
gcc: ensure proper value initialization

5 months agoman: install lvmpersist page
Zdenek Kabelac [Thu, 26 Jun 2025 20:02:48 +0000 (22:02 +0200)]
man: install lvmpersist page

5 months agotests: configure lvresize_fs_helper_executable_CFG
Zdenek Kabelac [Thu, 26 Jun 2025 19:25:00 +0000 (21:25 +0200)]
tests: configure lvresize_fs_helper_executable_CFG

Update test infrastructure to use the lvresize_fs_helper script
from the LVM2 codebase instead of relying on the system-installed
version. This ensures consistent testing behavior and avoids
issues when the system version doesn't exist or differs from
the expected implementation.

- Add lvresize_fs_helper to LVM_SCRIPTS in test/Makefile.in
  for installation
- Configure global/lvresize_fs_helper in test/lib/aux.sh
  to point to the test version

5 months agoconfig: add lvresize_fs_helper_executable option
Zdenek Kabelac [Thu, 26 Jun 2025 18:56:28 +0000 (20:56 +0200)]
config: add lvresize_fs_helper_executable option

- Add global_lvresize_fs_helper_executable_CFG config option to allow
  specifying the path to the lvresize_fs_helper script.
- Add DEFAULT_LVRESIZE_FS_HELPER_PATH macro for default value.
- Update _get_lvresize_fs_helper_path() in lib/device/filesystem.c
  to read the path from configuration using find_config_tree_str,
  similar to _fsadm_cmd().
- This allows users to override the helper path via configuration,
  improving flexibility and consistency with fsadm_executable handling.
- Avoid using static variable to get helper path just once, since
  it may change between commands via lvm.conf in lvm2 shell.

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

5 months agonvme: match header prototype for dev_find_key_nvme
Zdenek Kabelac [Thu, 26 Jun 2025 16:11:22 +0000 (18:11 +0200)]
nvme: match header prototype for dev_find_key_nvme

Missed to synchronize with previous commit.

5 months agodevice_id: Fix compiling when versionsort not found
Biswapriyo Nath [Fri, 28 Feb 2025 13:55:39 +0000 (13:55 +0000)]
device_id: Fix compiling when versionsort not found

alphasort was replaced with versionsort in 09e508cd438c755d293e4085ec584d87e7e7ea2e commit.

This commit fixes the following compiler error.

device/device_id.c:1608:65: error: use of undeclared identifier 'versionsort'
1608 |         sort_count = scandir(dirpath, &namelist, _filter_backup_files, versionsort);
     |                                                                        ^

5 months agoconfigure: autoreconf
Zdenek Kabelac [Thu, 26 Jun 2025 15:59:40 +0000 (17:59 +0200)]
configure: autoreconf

5 months agoconfigure: Use portable string comparison
A. Wilcox [Mon, 2 Jun 2025 04:08:08 +0000 (04:08 +0000)]
configure: Use portable string comparison

= and == are equivalent in Bash for strings, but = is the only portable
operator for compatibility with other shells.  Before this change,
running ./configure with Dash as /bin/sh resulted in:

./configure: 14558: test: yes: unexpected operator

and the test did not work (i.e. --enable-cmdlib --disable-shared allowed
a failed build to continue).  Now, the test works in Bash and Dash.

5 months agopersistent reservations
David Teigland [Thu, 14 Nov 2024 22:20:54 +0000 (16:20 -0600)]
persistent reservations

Enable lvm to use persistent reservations on a VG, which
are applied to each PV in the VG.

. lvmpersist is a low level script, which uses commands
  sg_persist, mpathpersist, and nvme to do PR operations
  on devices. This script is used by higher level lvm
  commands, and would not often be run by users.

. vgchange --setpersist is a VG metadata configuration command
  that specifies how PR should be started and enforced for a VG
  relative to other lvm commands.

. vgchange --persist is a command to change PR state of PVs in
  the VG, e.g. start PR to register and reserve.

The lvmpersist man page contains a complete description.

5 months agodevices: add dev_is_scsi and dev_is_mpath
David Teigland [Fri, 16 May 2025 18:50:51 +0000 (13:50 -0500)]
devices: add dev_is_scsi and dev_is_mpath

5 months agopost-release
Marian Csontos [Fri, 27 Jun 2025 08:14:33 +0000 (10:14 +0200)]
post-release

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
This page took 0.110931 seconds and 5 git commands to generate.