lvm2.git
7 weeks agolvmlockd: use persistent reservations for recovery with sanlock dev-dct-setlockargs-4
David Teigland [Wed, 13 Aug 2025 14:57:20 +0000 (09:57 -0500)]
lvmlockd: use persistent reservations for recovery with sanlock

The process of using persistent reservations for recovery:

host A owns a lock
host A fails
host B requests the lock
host B request fails because A owns the lock
host A enters the FAIL state in sanlock
host B retries the lock, and sees owner A is failed
host B runs lvmpersist to remove the PR key of host A
host B tells sanlock that host A is dead
host B retries the lock, which is now granted by sanlock

The new option: --setlockargs persist,notimeout
adds "persist" and "notimeout" components to the
lock_args string in the VG metadata, viewable with
vgs -o+lockargs.  The option is available in vgcreate
or vgchange.

. "persist" tells lvmlockd to remove the PR key of
  a failed host, by running lvmpersist, and set the
  sanlock host state to "dead".

. "notimeout" tells lvmlockd to configure sanlock
  leases to not time out.  sanlock does not use the
  watchdog to protect leases that do not time out.

With this combination, PR removal replaces the watchdog
for fencing hosts with expired leases that are blocking
other hosts.

The lock_args version component is "2.0.0" when
these new settings are used, otherwise remains
"1.0.0".  Previous lvm versions will not start a
VG with lockargs version 2.

Requires sanlock version 4.2.0 or later.

8 weeks agopersist: use a prefix in the key file 2086201754
David Teigland [Tue, 7 Oct 2025 17:40:50 +0000 (12:40 -0500)]
persist: use a prefix in the key file

key: 0xabc123
which makes it easier to add other lines in the future.

8 weeks agoCI: reboot VMs running gitlab-runner after tests 2085828295
Marian Csontos [Tue, 7 Oct 2025 14:15:26 +0000 (16:15 +0200)]
CI: reboot VMs running gitlab-runner after tests

8 weeks agopersist: do not use pr_key config setting for sanlock VGs v2 2084120883
David Teigland [Mon, 6 Oct 2025 18:09:58 +0000 (13:09 -0500)]
persist: do not use pr_key config setting for sanlock VGs v2

Use only hostid-based PR keys for sanlock VGs.
This will be required for PR-based recovery with sanlock.

Changes how persist_start() is used to update an existing key.
Previously, the updated key was passed to persist_start as if
it was the local pr_key setting.  It's now passed as a separate
parameter.

This also fixes an incorrect warning in vgchange --persist check
when checking a hostid-based key while the lockspace is stopped.

8 weeks agoRevert "persist: do not use pr_key config setting for sanlock VGs" 2084080704
David Teigland [Mon, 6 Oct 2025 17:48:00 +0000 (12:48 -0500)]
Revert "persist: do not use pr_key config setting for sanlock VGs"

This reverts commit 038af21fa1ab67bb9ad40c51cc4a19be73a8327e.

8 weeks agopersist: do not use pr_key config setting for sanlock VGs 2083786386
David Teigland [Mon, 6 Oct 2025 14:46:03 +0000 (09:46 -0500)]
persist: do not use pr_key config setting for sanlock VGs

Use only hostid-based PR keys for sanlock VGs.
This will be required for PR-based recovery with sanlock.

8 weeks agorevert "polldaemon: drop caches before daemonizing" 2078623641
Zdenek Kabelac [Fri, 3 Oct 2025 10:46:11 +0000 (12:46 +0200)]
revert "polldaemon: drop caches before daemonizing"

This reverts commit 8a704063edabffbe29e4369ccd47241e65335bcf.
Not the right way to fix this issue - needs different solution.

2 months agotest: shorten lvconvert 2077301483
Zdenek Kabelac [Thu, 2 Oct 2025 20:44:44 +0000 (22:44 +0200)]
test: shorten lvconvert

Test doesn't need to be there for 100second - shorten timeout.
Normally this is not an issue if the background process does not
have an output, but if the output is enabled, it may block exit.

2 months agopolldaemon: drop caches before daemonizing
Zdenek Kabelac [Thu, 2 Oct 2025 20:39:15 +0000 (22:39 +0200)]
polldaemon: drop caches before daemonizing

Droping cache after fork just make our internal bcache confused.
So droping early.

2 months agolibdm: drop propagation of delay_resume_if_new
Zdenek Kabelac [Thu, 2 Oct 2025 20:44:33 +0000 (22:44 +0200)]
libdm: drop propagation of delay_resume_if_new

When we disable 'delay' for pvmove as not useful, whole propagation
becomes useless - so drop it for now until we have better plan.

Previous patch was not working well for some snapshot construction.

2 months agoWHATS_NEW: update 2076719044
Zdenek Kabelac [Thu, 2 Oct 2025 14:37:16 +0000 (16:37 +0200)]
WHATS_NEW: update

2 months agotest: more excluded kernels
Zdenek Kabelac [Tue, 30 Sep 2025 09:34:38 +0000 (11:34 +0200)]
test: more excluded kernels

2 months agotest: raid restart
Zdenek Kabelac [Thu, 2 Oct 2025 10:58:30 +0000 (12:58 +0200)]
test: raid restart

2 months agoclean: sort suffixes alphabetically
Zdenek Kabelac [Thu, 2 Oct 2025 09:51:28 +0000 (11:51 +0200)]
clean: sort suffixes alphabetically

Just list suffixes 1 per line here.

2 months agolibdm: fix pvmove preload for complex devices
Zdenek Kabelac [Thu, 2 Oct 2025 09:59:28 +0000 (11:59 +0200)]
libdm: fix pvmove preload for complex devices

Change delay_resume_if_new propagation from "> 1" to "!= 1" to ensure
devices are resumed when required by parent devices. This specifically
fixes issues where RAID devices using legs that are being pvmoved need
their preloaded legs resumed before the RAID device itself is preloaded.

The fix ensures pvmove operations start when needed by parent devices,
even though this means pvmove begins before metadata commit. This is
acceptable since pvmove mirrors to previously unallocated extents.

2 months agointegrity: fix activation race during setup
Zdenek Kabelac [Thu, 2 Oct 2025 13:54:12 +0000 (15:54 +0200)]
integrity: fix activation race during setup

Add synchronization after deactivate_lv() to prevent races between
deactivation and subsequent activation using the same udev cookie.

This ensures proper ordering when wiping prepared integrity metadata
devices during RAID integrity setup, affecting both active and inactive
code paths.

2 months agoRevert "integrity: proper rounding for sizes" 2070193766
David Teigland [Mon, 29 Sep 2025 16:48:50 +0000 (11:48 -0500)]
Revert "integrity: proper rounding for sizes"

This reverts commit cdf57ddfa4af12803fd8f3dfe0c7543913b72cb6.

2 months agopersist: fix vgremove key check 2070116151
David Teigland [Mon, 29 Sep 2025 15:56:34 +0000 (10:56 -0500)]
persist: fix vgremove key check

Fix commit ab1405034d23f01b4ea35af88d607363b93ad666
"persist: vgremove should check for other keys"

which counted keys without eliminating the duplicates
that are reported for mpath devices, so vgremove would
report multiple registered keys for a single host using
an mpath device.

2 months agoWHATS_NEW: update 2069830923
Zdenek Kabelac [Mon, 29 Sep 2025 13:52:05 +0000 (15:52 +0200)]
WHATS_NEW: update

2 months agotests: continue with next filesystem
Zdenek Kabelac [Sun, 28 Sep 2025 20:00:36 +0000 (22:00 +0200)]
tests: continue with next filesystem

If the kernel fails to mount - continue with next fs.
(i.e kernel no longer supports reiserfs, but tools can be still there).

2 months agotests: add tuned to checked services
Zdenek Kabelac [Sun, 28 Sep 2025 19:41:16 +0000 (21:41 +0200)]
tests: add tuned to checked services

Running tuned will change device properties in parallel so i.e.
setting read_ahead will not work as expected.

2 months agocov: initialize variables
Zdenek Kabelac [Sun, 28 Sep 2025 11:33:09 +0000 (13:33 +0200)]
cov: initialize variables

Address Coverity static analysis warnings by initializing variables
that could theoretically be used uninitialized in edge cases:

While these uninitialized uses are unlikely to occur in practice due to
the surrounding logic, explicit initialization eliminates potential static
analysis warnings.

2 months agogcc: make variable initialized
Zdenek Kabelac [Sun, 28 Sep 2025 13:37:00 +0000 (15:37 +0200)]
gcc: make variable initialized

2 months agocov: check for no patterns
Zdenek Kabelac [Sun, 28 Sep 2025 13:26:18 +0000 (15:26 +0200)]
cov: check for no patterns

2 months agocov: use checked pr_op pointer
Zdenek Kabelac [Sun, 28 Sep 2025 11:04:49 +0000 (13:04 +0200)]
cov: use checked pr_op pointer

Directly assign pr_op pointer and at the same time
use its checked value.

2 months agocov: check result
Zdenek Kabelac [Sun, 28 Sep 2025 13:18:09 +0000 (15:18 +0200)]
cov: check result

2 months agocov: check resulting values
Zdenek Kabelac [Sun, 28 Sep 2025 13:13:26 +0000 (15:13 +0200)]
cov: check resulting values

2 months agocov: raise MAX_FILTERS
Zdenek Kabelac [Sun, 28 Sep 2025 11:18:32 +0000 (13:18 +0200)]
cov: raise MAX_FILTERS

After adding filter MAX_FILTERS might have been too small
if all filters would be applied.

2 months agodebug: fix error message
Zdenek Kabelac [Sun, 28 Sep 2025 17:49:44 +0000 (19:49 +0200)]
debug: fix error message

Extent is correct here.

2 months agodisplay: add helper display_mb_size
Zdenek Kabelac [Sun, 28 Sep 2025 17:37:12 +0000 (19:37 +0200)]
display: add helper display_mb_size

Add function to simplify printing number that are stored
in MiB units that we use in couple places.
Avoids adding multiplication to sector units...

2 months agovdo: extract magic numbers as named constant
Zdenek Kabelac [Sun, 28 Sep 2025 17:27:06 +0000 (19:27 +0200)]
vdo: extract magic numbers as named constant

Replace scattered magic numbers throughout VDO code with
descriptive named constants to improve code maintainability.

2 months agointegrity: fix adding integrity to RAID
Zdenek Kabelac [Mon, 29 Sep 2025 12:03:42 +0000 (14:03 +0200)]
integrity: fix adding integrity to RAID

Fix several issues in integrity addition to RAID logical volumes and
improve error handling and cleanup:

Synchronization and activation fixes:
- Add sync_local_dev_names() before LV activation to handle potential
  udev deactivation in-flight from metadata device wiping
- Consolidate deactivate_lv() calls to avoid code duplication in
  _set_integrity_block_size() error path

Missing segment relationship:
- Add missing add_seg_to_segs_using_this_lv() call for imeta LV to
  properly establish segment relationships

Enhanced error recovery:
- Improve error path cleanup in case integrity addition fails

2 months agointegrity: proper rounding for sizes
Zdenek Kabelac [Mon, 29 Sep 2025 12:01:53 +0000 (14:01 +0200)]
integrity: proper rounding for sizes

2 months agointegrity: add some basic lvdisplay support
Zdenek Kabelac [Sat, 27 Sep 2025 21:08:40 +0000 (23:08 +0200)]
integrity: add some basic lvdisplay support

Print _iorig and _imeta for integrity LVs.
Print "on" for RAIDs with integrity.

2 months agointegrity: lv_raid_has_integrity accepts const
Zdenek Kabelac [Sat, 27 Sep 2025 21:08:04 +0000 (23:08 +0200)]
integrity: lv_raid_has_integrity accepts const

2 months agointegrity: use suffix -real for iorig and imeta
Zdenek Kabelac [Sat, 27 Sep 2025 18:19:26 +0000 (20:19 +0200)]
integrity: use suffix -real for iorig and imeta

Add private -real suffix for active _iorig and _imeta volumes.

TODO: ATM we will keep using "-real" suffix also for raid leg with integrity.
      Better fit would be i.e. "-integ" suffix for such LV, but this
      requires more complicated table manipulation as we would need
      to also change the raid leg name, so leave this for later...
      Usage of "-real" suffix to keep raid leg private is already better
      than previous state.

2 months agointegrity: add segment validation
Zdenek Kabelac [Sat, 27 Sep 2025 18:18:29 +0000 (20:18 +0200)]
integrity: add segment validation

Add some more validation checks for integrity segments.

2 months agointegrity: drop use of origin pointer for integrity
Zdenek Kabelac [Sat, 27 Sep 2025 19:35:06 +0000 (21:35 +0200)]
integrity: drop use of origin pointer for integrity

Integrity segment is not using 'origin' anywhere and every code
is now using seg_lv(seg, 0) to reach origin LV from Integrity segment.
So do not set this pointer to any value for integrity segment.

Also for lv_origin_lv() presence of origin is already made by
validation - integrity must have origin defined.

2 months agointegrity: fix ordering during integrity removal
Zdenek Kabelac [Sat, 27 Sep 2025 18:17:39 +0000 (20:17 +0200)]
integrity: fix ordering during integrity removal

Reorder integrity cleanup operations to ensure proper LV state before
device suspension. Move layer removal and visibility changes to occur
before the first metadata write, so that _iorig and _imeta LVs are
already marked as public and visible during suspend/resume operations.

This prevents issues where the device mapper operations occur on LVs
that are still marked as internal components rather than proper public
LVs ready for removal.

Note: this code had not set ->origin used in other places,
but it's going to be replaced with use of seg_lv().

2 months agointegrity: refactor lv_is_integrity_origin
Zdenek Kabelac [Sat, 27 Sep 2025 18:20:09 +0000 (20:20 +0200)]
integrity: refactor lv_is_integrity_origin

Extract common integrity origin detection logic into new helper function
lv_integrity_from_origin() to eliminate code duplication:

- Add lv_integrity_from_origin() that returns the integrity LV for a given origin
- Refactor lv_is_integrity_origin() to use the new helper function
- Replace duplicate logic in lv_raid_integrity_image_in_sync() with helper call
- Consolidate multiple condition checks into single if statement
- Replace direct seg->origin access with seg_lv(seg, 0) for consistency

The seg_lv(seg, 0) approach is preferred throughout the codebase as it
provides a consistent interface to access the origin LV from segments.

2 months agoraid: fix -real suffix for external origins 2062687047
Zdenek Kabelac [Thu, 25 Sep 2025 13:26:49 +0000 (15:26 +0200)]
raid: fix -real suffix for external origins

With recent change to use -real suffices for raid/mirror legs,
we need to take special care for devices that already use -real
suffix normally - patchset missed check for external origins.

Also avoid even creating UUID for these LVs in _lv_info_real().

2 months agoWHATS_NEW: update 2062378713
Zdenek Kabelac [Thu, 25 Sep 2025 11:21:54 +0000 (13:21 +0200)]
WHATS_NEW: update

2 months agomirror: add -real suffix for mirrors
Zdenek Kabelac [Wed, 30 Jul 2025 13:50:06 +0000 (15:50 +0200)]
mirror: add -real suffix for mirrors

Extend "-real" suffix handling to mirror operations, similar to RAID
functionality for managing internal-to-public LV transitions.

- Add reactivation logic in _split_mirror_images() to update UUIDs
- Enable "real" suffix for mirror images and logs in build_dm_uuid()
- Detect temporary mirror sync layers using MIRROR_SYNC_LAYER pattern
- Force deactivate/activate cycle to transition from private to public UUID

This ensures mirror split operations properly transition split LVs from
internal components with private UUIDs to public LVs with correct UUIDs.

2 months agoraid_manip: reactivate after split to update UUID
Zdenek Kabelac [Mon, 15 Sep 2025 10:49:29 +0000 (12:49 +0200)]
raid_manip: reactivate after split to update UUID

After RAID leg split operations, the resulting LV becomes public but
retains its private "-real" UUID suffix from when it was an internal
component. Since active device mapper devices cannot change their UUID,
the split LV must be deactivated and reactivated to acquire the proper
public UUID.

Add reactivation logic to lv_raid_split() and lv_raid_split_and_track()
that handles both shared and non-shared volume groups, ensuring split
LVs are properly transitioned from internal to public state.

2 months agoraid: add -real suffix handling for internal LVs
Zdenek Kabelac [Wed, 30 Jul 2025 13:48:45 +0000 (15:48 +0200)]
raid: add -real suffix handling for internal LVs

Add support for managing RAID internal LVs that use "-real" suffix
during transitions from internal components to public LVs.

- Add _lv_info_real() to detect orphan devices with private UUIDs
- Add _lv_adjust_real_uuid() to handle UUID mismatches in device tree
- Use "real" suffix for non-visible RAID images and metadata in build_dm_uuid()
- Integrate checks into activation and device manager code paths

This handles edge cases where RAID leg splits leave public devices active
with private "-real" UUIDs, requiring explicit reactivation.

Note: RAID image and metadata gets "-real" suffix only when it is marked
as not visible LV in lvm2 metadata as there is also a public activation
of these devices.

2 months agodev_manager: helper function to set UUID suffixes
Zdenek Kabelac [Tue, 23 Sep 2025 19:39:13 +0000 (21:39 +0200)]
dev_manager: helper function to set UUID suffixes

Add _set_optional_uuid_suffixes() helper to reduce code duplication
when calling dm_tree_set_optional_uuid_suffixes() with the global
_uuid_suffix_list.

2 months agometadata: lv_is_linear/striped needs only const
Zdenek Kabelac [Wed, 24 Sep 2025 09:25:49 +0000 (11:25 +0200)]
metadata: lv_is_linear/striped needs only const

2 months agomemlock: add [aio] into skiped regions
Zdenek Kabelac [Thu, 25 Sep 2025 11:16:57 +0000 (13:16 +0200)]
memlock: add [aio] into skiped regions

Stay away of locking aio memory regions.

2 months agopersist: check key generation 2060644878
David Teigland [Wed, 24 Sep 2025 18:41:20 +0000 (13:41 -0500)]
persist: check key generation

vgchange --persist check was getting the key generation and
the sanlock generation, but wasn't actually comparing them
to warn about a mismatch.

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

Major rewrite of the beginning description/setup/introduction.

2 months agomake: generate 2051406601
Zdenek Kabelac [Sat, 20 Sep 2025 12:37:58 +0000 (14:37 +0200)]
make: generate

2 months agocommands: enusure stable sorting result 2051406432
Zdenek Kabelac [Sat, 20 Sep 2025 12:34:29 +0000 (14:34 +0200)]
commands: enusure stable sorting result

When options do have same name, use it's enum
as secondary key.

2 months agocommands: preserve any_ro_count
Zdenek Kabelac [Sat, 20 Sep 2025 12:33:10 +0000 (14:33 +0200)]
commands: preserve any_ro_count

Previous patch unintentionally mixed these options
together while sorting.

2 months agolvmpersist: fix hex digit key check 2050679774
David Teigland [Fri, 19 Sep 2025 19:00:18 +0000 (14:00 -0500)]
lvmpersist: fix hex digit key check

was incorrectly checking for a-z rather than a-f.

2 months agolvmpersist: run sg_turs to clear unit attention errors 2050546902
David Teigland [Fri, 19 Sep 2025 17:43:37 +0000 (12:43 -0500)]
lvmpersist: run sg_turs to clear unit attention errors

Sometimes sg_persist/mpathpersist commands will fail if the
device returns a Unit Attention, e.g. if the host's last
registration was cleared.  Run sg_turs on each scsi/mpath
device at the start of each command to clear any UA errors.
This is simpler than adding code to retry commands throughout
the script if they happen to hit a UA error.

2 months agomake: generate 2049910429
Zdenek Kabelac [Fri, 19 Sep 2025 12:49:41 +0000 (14:49 +0200)]
make: generate

2 months agotest: update lisf of unusable kernels for raid resize
Zdenek Kabelac [Fri, 19 Sep 2025 12:48:46 +0000 (14:48 +0200)]
test: update lisf of unusable kernels for raid resize

2 months agodmeventd: use define for mirror sync layer
Zdenek Kabelac [Wed, 17 Sep 2025 11:00:31 +0000 (13:00 +0200)]
dmeventd: use define for mirror sync layer

Use existing define, just in case someone would have ever changed it.

2 months agocommand: add validation and sorting for args.h
Zdenek Kabelac [Wed, 20 Aug 2025 19:56:29 +0000 (21:56 +0200)]
command: add validation and sorting for args.h

Add comprehensive validation to ensure args.h option definitions follow
the established sorting rules:
1. Options without short options - sorted alphabetically
2. Alias options (without descriptions) - sorted alphabetically
3. Options with short options - sorted by uppercase symbol with
   lowercase variants first, then by long option name

Changes include:
- Enhanced validation logic in _find_lvm_command_enum() to check args.h
  ordering during MAN_PAGE_GENERATOR builds
- Improved error messages showing which entries violate sorting rules
- Added _sort_opt_args() function to sort optional/required option args
  for consistent man page and help generation output
- Fixed validation flag handling to properly report multiple errors

This ensures the args.h reorganization from the previous commit is
maintained and prevents future ordering regressions that could affect
code maintainability and generated documentation consistency.

2 months agoargs: sort by rules
Zdenek Kabelac [Wed, 20 Aug 2025 12:44:43 +0000 (14:44 +0200)]
args: sort by rules

tools: reorganize args.h argument definitions by sorting rules

Reorganize argument definitions in args.h to follow consistent sorting:
1. Options without short options - sorted alphabetically
2. Alias options (unadvertised, no description)
3. Options with short options - sorted by uppercase symbol
   with lowercase variants first, then by long option name

This improves code organization and maintainability by establishing
a clear, documented ordering for LVM command line argument definitions.

No functional changes - only reordering of existing argument definitions.

Also note there should never be a command using 2 options with the same
short option symbol

2 months agopersist: support --setpersist in vgcreate 2047927591
David Teigland [Wed, 17 Sep 2025 18:43:45 +0000 (13:43 -0500)]
persist: support --setpersist in vgcreate

Previously, setpersist was only supported in vgchange
on an existing VG.  The PR is acquired exclusively before
the devices are modified, and in the case of a shared
VG the PR is subsequently changed to a shared mode.

2 months agopersist: use vgid in the key file name 2045570086
David Teigland [Wed, 13 Aug 2025 14:57:20 +0000 (09:57 -0500)]
persist: use vgid in the key file name

adding a new helper function to create key file path.

Including vgid protects against cases of reading a
stale key file that was left over from a previous VG
with the same name.

2 months agopersist: vgremove should check for other keys 2045475571
David Teigland [Wed, 17 Sep 2025 16:31:48 +0000 (11:31 -0500)]
persist: vgremove should check for other keys

vgremove should check for keys registered by other hosts
before removing the VG to avoid leaving dangling PR keys
on devices.  This involves refactoring the related commit
ca6fe99162 "lvmpersist: fix vgremove when another key is registered"
that separated persist_stop into before and after parts.

2 months agoscripts: lvresize-fs-helper.sh: logmsg and not fail if unable to get XFS mount option... 2044910813
Peter Rajnoha [Wed, 17 Sep 2025 12:36:48 +0000 (14:36 +0200)]
scripts: lvresize-fs-helper.sh: logmsg and not fail if unable to get XFS mount options for remount

2 months agoWHATS_NEW: update 2044615096
Peter Rajnoha [Wed, 17 Sep 2025 10:16:26 +0000 (12:16 +0200)]
WHATS_NEW: update

2 months agotests: lvresize-xfs: test quota mount options are preserved 32/head 2044599294 2044601810
Peter Rajnoha [Mon, 18 Aug 2025 09:53:10 +0000 (11:53 +0200)]
tests: lvresize-xfs: test quota mount options are preserved

2 months agoscripts: lvresize-fs-helper.sh: detect and use proper quota mount options for XFS
Peter Rajnoha [Fri, 15 Aug 2025 12:23:18 +0000 (14:23 +0200)]
scripts: lvresize-fs-helper.sh: detect and use proper quota mount options for XFS

When an XFS file system was previously mounted with quota mount options
(combination of -o uquota,gquota,pgquota) and then we are mounting the
file system as part of the lvresize/lvextend operation (through the fs
resize helper script), we need to preserve the quota mount options.

Otherwise, the XFS would need to recheck quotas - in that case the kernel
log contains:

  XFS (<device>): Quotacheck needed: Please wait.

This may take a long time, depending on the file system size.

Related issue: https://github.com/lvmteam/lvm2/issues/182

2 months agoman: simplify vmautoactivation(7) 33/head 2042943208 2042945237
Arnout Engelen [Mon, 25 Aug 2025 13:55:44 +0000 (15:55 +0200)]
man: simplify vmautoactivation(7)

Previously this was hard-coded to: "Autoactivation commands use a number
of temp files in /run/lvm (with the expectation that /run is cleared
between boots.)"

Since c1bfc8737f08bf7558b2d788e9756f895cd9eaaa it was made more generic,
but on some systems this logic leads to "Autoactivation commands use a
number of temp files in /run/lvm (with the expectation that /var/run
is cleared between boots)." which I'd say adds more confusion than it
solves.

2 months agopersist: fix start/stop with vgchange ay/an 2040592454
David Teigland [Fri, 12 Sep 2025 20:06:12 +0000 (15:06 -0500)]
persist: fix start/stop with vgchange ay/an

vgchange -ay --persist start
wasn't working, and should exclude shared VGs.
vgchange -an --persist stop
code was missing for this case.

2 months agomake: generate 2036485425
Zdenek Kabelac [Fri, 12 Sep 2025 12:21:06 +0000 (14:21 +0200)]
make: generate

2 months agoman: print better arg for persist
Zdenek Kabelac [Fri, 12 Sep 2025 12:17:55 +0000 (14:17 +0200)]
man: print better arg for persist

As man pages now tend to print options as man macro reference,
we may still need some local 'specialization'.

ATM --persist option is known expection where command may accept only
certain argument to be recognized/allowed - so generic String printed
in Italic can be replaced with just specific argument printed in Bold.

TODO: recognize only cases where the 'generic' String is NOT used and
for rest of them use the common O_persist macro reference.

2 months agocodespell: typos 2034535870
Zdenek Kabelac [Thu, 11 Sep 2025 13:18:04 +0000 (15:18 +0200)]
codespell: typos

2 months agodoc: Few fixes and additions in pages 2034533068
Marian Csontos [Thu, 11 Sep 2025 14:02:57 +0000 (16:02 +0200)]
doc: Few fixes and additions in pages

(cherry picked from commit 4561756bda8a0b5417c7cf5df269bb37af6eaec5)

2 months agolvmpersist: fix remove exit code if an invalid local key is specified 2032913816
David Teigland [Wed, 10 Sep 2025 20:54:41 +0000 (15:54 -0500)]
lvmpersist: fix remove exit code if an invalid local key is specified

Exit with an error if the wrong local key is specified.

2 months agopost-release 2029749109
Marian Csontos [Tue, 9 Sep 2025 12:19:37 +0000 (14:19 +0200)]
post-release

2 months agopre-release 2.03.35 2029749422 v2_03_35
Marian Csontos [Tue, 9 Sep 2025 12:19:37 +0000 (14:19 +0200)]
pre-release 2.03.35

2 months agodoc: Update WHATS_NEW and release-notes
Marian Csontos [Tue, 9 Sep 2025 12:17:35 +0000 (14:17 +0200)]
doc: Update WHATS_NEW and release-notes

2 months agospec: Install /var/lib/lvm directory
Marian Csontos [Tue, 9 Sep 2025 12:16:55 +0000 (14:16 +0200)]
spec: Install /var/lib/lvm directory

2 months agotest: update with unresizable kernels 2027614171
Zdenek Kabelac [Mon, 8 Sep 2025 12:30:18 +0000 (14:30 +0200)]
test: update with unresizable kernels

These kernels do miss fixing commit for mdraid resize to work.

2 months agotest: thin monitoring optimization
Zdenek Kabelac [Fri, 18 Jul 2025 14:47:11 +0000 (16:47 +0200)]
test: thin monitoring optimization

2 months agolvmlockd: always free ls struct after ls thread exits 2024547541
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.

2 months agolvmpersist: fix key file for vgrename and vgremove
David Teigland [Fri, 5 Sep 2025 18:18:22 +0000 (13:18 -0500)]
lvmpersist: fix key file for vgrename and vgremove

2 months agolvmpersist: print other key blocking start 2018116948
David Teigland [Tue, 2 Sep 2025 21:10:08 +0000 (16:10 -0500)]
lvmpersist: print other key blocking start

3 months agolvmpersist: fix check for no keys on mpath device 2017819525
David Teigland [Tue, 2 Sep 2025 17:55:46 +0000 (12:55 -0500)]
lvmpersist: fix check for no keys on mpath device

3 months agolvmpersist: allow deactivation without PR
David Teigland [Tue, 2 Sep 2025 17:44:59 +0000 (12:44 -0500)]
lvmpersist: allow deactivation without PR

3 months agodmstats: fix parsing of list regions 2017263742
Zdenek Kabelac [Mon, 1 Sep 2025 21:54:55 +0000 (23:54 +0200)]
dmstats: fix parsing of list regions

Replace %4095c sscanf format specifier with position-based copying.

The _stats_parse_list_region() function previously used %4095c to read
the remaining part of the input buffer. Recent glibc versions
(2.42.9000-3.fc44) have changed the behavior of this format
specifier to align with C standard specifications, which affects
parsing when the buffer contains fewer than 4095 characters.

To ensure compatibility across different glibc versions, switch to
using %n to track the parsing position and manually copy the string
data using dm_strncpy().

Note: Binaries compiled with the previous implementation may experience
compatibility issues with newer glibc versions.

3 months agodmeventd: ignore result of pthread_cond_timedwait() 2014991966
Zdenek Kabelac [Mon, 1 Sep 2025 11:40:34 +0000 (13:40 +0200)]
dmeventd: ignore result of pthread_cond_timedwait()

Used just for some sleep....

3 months agodmeventd: simplify grace period synchronization
Zdenek Kabelac [Mon, 1 Sep 2025 11:26:24 +0000 (13:26 +0200)]
dmeventd: simplify grace period synchronization

Remove per-thread grace_mutex and use existing global_mutex
with per-thread condition variables.

We separate take of grace mutex there was slight race chance
of hitting wait condition while 2nd. thread already signaled wakeup.

With the use of global mutex (which must be held before and after
anyway), there is no such race chance even possible.

3 months agodmeventd: handle case for missing udev link
Zdenek Kabelac [Sun, 31 Aug 2025 19:35:01 +0000 (21:35 +0200)]
dmeventd: handle case for missing udev link

With old systems we cannot always check /dev/mapper/vg-lv name,
as those might be symlinks managed by udev. However monitoring
is not 'synchronized' with udev as dmventd API is major:minor
based and does not needed symlinks. So to 'compensate' this
and make just 'old system' working - just check also for
presence of /dev/dm-X device.

3 months agodmeventd: simplify _grace_period 2012285254
Zdenek Kabelac [Fri, 29 Aug 2025 20:00:24 +0000 (22:00 +0200)]
dmeventd: simplify _grace_period

Use plain 'int' time - so it doesn't make problems
on some archs (x32) printing time_t.
Also drop ret asign from pthread_cond_timedwait().

3 months agodmeventd: fix inode check for old kernels <3.x
Zdenek Kabelac [Fri, 29 Aug 2025 19:38:37 +0000 (21:38 +0200)]
dmeventd: fix inode check for old kernels <3.x

Improve _get_device_inode() function with kernel version check

For kernel >=3: Use sysfs path format (/sys/dev/block/major:minor).
For kernel <3: Use /dev/mapper device path format.

Add explicit handling for very old kernels (<3.x) that don't change
inode numbers for /sys  device-mapper devices.

3 months agolvmpersist: fix vgremove when another key is registered 2012220275
David Teigland [Fri, 29 Aug 2025 14:42:29 +0000 (09:42 -0500)]
lvmpersist: fix vgremove when another key is registered

For vgremove, split persist stop steps into:
1. prepare, which gets the pr key and VG devices,
   and happens before the normal vgremove.
2. run, which removes pr key from the VG devices,
   and happens after the normal vgremove.

This is necessary if another PR key is registered on the device
(which likely doesn't happen in the normal usage pattern, but is
still possible.)

When another key exists, removing the local PR key will cause the
machine to lose the ability to write VG metadata to the device.
So, the removal of the local PR key must happen after the VG metadata
is written for vgremove.  The prepare step must remain at the beginning
of the command, while the list of PVs in the VG still exists.

3 months agotools: pvchange: unlock devices file at the end of cmd processing 2011540374
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.

3 months agotools: pvchange: unlock devices file at the end of cmd processing 2011536141
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.

3 months agodmeventd: fixes for grace period timer 2009080571
Zdenek Kabelac [Thu, 28 Aug 2025 12:43:50 +0000 (14:43 +0200)]
dmeventd: fixes for grace period timer

Fix several problems in recent dmeventd grace period enhancement:

1. **Timer reset bug**: Threads exiting grace period were starting
   time period with rather random time 'offset' causing change
   in behavior and firing monitor action in non-deterministic time.
   Reset timer (next_time = current_time + timeout) AFTER grace
   period wait.

2. **Device identity verification**: Add inode tracking to prevent
   incorrect thread reuse when device UUID is recycled. Grace period
   thread lookup now verifies device inode matches to ensure same
   physical device. This avoid reusing of monitored values for
   a different device.
   'diskseq' was also considered as unique identifier, but inode
   check seems to be easier to check and is not 'so new'.
   Also another solution could have been to change dmeventd protocol,
   and introduce supend/resume calls - but this could be another source
   of problem.

3. **Signal handling order**: Move SIGALRM reset to occur BEFORE
   entering grace period instead of after. This prevents potential
   error path trouble that may have shutdown reused thread causing
   the actual monitoring to be silently lost.

4. **Event state cleanup**: Clear current_events before grace period
   to prevent stale event processing after thread reuse.

Note: wondering if there can be any problem with inode check....

3 months agoman lvmpersist: shared VGs with locktype dlm work with PR 2002621070
David Teigland [Mon, 25 Aug 2025 17:39:39 +0000 (12:39 -0500)]
man lvmpersist: shared VGs with locktype dlm work with PR

3 months agovgchange persist stop: use lockopt force to skip lockstop check 2002615539
David Teigland [Mon, 25 Aug 2025 17:33:24 +0000 (12:33 -0500)]
vgchange persist stop: use lockopt force to skip lockstop check

vgchange --persist stop requires locking to first be stopped
(vgchange --lockstop).  Allow setting --lockopt force to bypass
this check so that PR can be forcibly stopped.

3 months agolvmpersist: fix device support check 2002595738
David Teigland [Mon, 25 Aug 2025 17:16:41 +0000 (12:16 -0500)]
lvmpersist: fix device support check

Fix commit b2bc06caf8e653828cbfd70250114043846c377a
"lvmpersist: check devices support PR before certain commands"

which broke clear and read commands.  Change to skip individual
devices in clear/read if they don't support PR.

3 months agoman lvmpersist: improve description 2002476625
David Teigland [Mon, 25 Aug 2025 15:54:35 +0000 (10:54 -0500)]
man lvmpersist: improve description

3 months agotoollib: proper error path handling 1991702793
Marian Csontos [Tue, 19 Aug 2025 13:56:21 +0000 (15:56 +0200)]
toollib: proper error path handling

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