lvm2.git
8 weeks agolvmlockd: use persistent reservations for recovery with sanlock dev-dct-setlockargs-3
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.

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

2 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

2 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

3 months agotools: allow --reportformat for pv/vg/lvdisplay log report 1991076911
Peter Rajnoha [Tue, 19 Aug 2025 08:54:21 +0000 (10:54 +0200)]
tools: allow --reportformat for pv/vg/lvdisplay log report

The pv/vg/lvdisplay (without -C|--columns) does not use the reporting
mode for the output. However, we can still allow the --reportformat
option for these commands, but it will affect only the log report,
like we have for other non-reporting lvm commands
(e.g. lvchange,vgchange...).

3 months agolvmdevices: do not create system.devices when deleting entries 1985226635
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.

3 months agolvmpersist: check devices support PR before certain commands 1985225865
David Teigland [Thu, 14 Aug 2025 21:27:09 +0000 (16:27 -0500)]
lvmpersist: check devices support PR before certain commands

Produce a proper error message, avoiding an ugly jq null list
error when handling nvme devs that do not support PR.

3 months agovgchange: setpersist enabling should check if PR works on devs
David Teigland [Thu, 14 Aug 2025 21:03:32 +0000 (16:03 -0500)]
vgchange: setpersist enabling should check if PR works on devs

attempt to read PR keys from VG devs before enabling PR on the VG
to ensure PR works.

3 months agotests: update listings.sh 1982090499
Peter Rajnoha [Wed, 13 Aug 2025 11:57:55 +0000 (13:57 +0200)]
tests: update listings.sh

Test further reporting options that can be used only with -C|--columns
for pv/vg/lvdisplay.

3 months agoWHATS_NEW: update 1982055556
Peter Rajnoha [Wed, 13 Aug 2025 11:43:20 +0000 (13:43 +0200)]
WHATS_NEW: update

3 months agotoollib: also initialize processing handle in process_each_pv
Peter Rajnoha [Wed, 13 Aug 2025 10:52:57 +0000 (12:52 +0200)]
toollib: also initialize processing handle in process_each_pv

Just like process_each_vg and process_each_lv, the top-level process_each_pv
should also initialize the processing handle (if the handle not already passed
as argument for use). This is mainly important, among others, for proper
log_report tracking and proper output formatting.

For example:

Before this patch - there are two "log" sections as the processing handle is
initialized dynamically more times if not passed explicitly from the top-level
process_each_pv function:

❯  pvdisplay --config 'log/report_command_log=1 report/output_format=json'
  {
      "log": [
          ...
      ]
  }
  {
      "log": [
         ...
      ]
  }

❯  pvdisplay --config 'log/report_command_log=1 report/output_format=json' | jsonlint
<stdin>:17:2: Error: Unexpected text after end of JSON value
   |  At line 17, column 2, offset 4463
<stdin>: has errors

With this patch applied:

❯  pvdisplay --config 'log/report_command_log=1 report/output_format=json'
  {
      "log": [
          ...
       ]
  }

❯  pvdisplay --config 'log/report_command_log=1 report/output_format=json' | jsonlint
<stdin>: ok

3 months agomake: generate
Peter Rajnoha [Wed, 13 Aug 2025 07:24:59 +0000 (09:24 +0200)]
make: generate

3 months agotools: allow report options only with pv/vg/lvdisplay -C|--columns
Peter Rajnoha [Wed, 13 Aug 2025 07:23:31 +0000 (09:23 +0200)]
tools: allow report options only with pv/vg/lvdisplay -C|--columns

--configreport, --logonly, --reportformat and --select options can be
used only if -C|--columns is used at the same time. These options are
only to control the reporting infrastructure. We switch to reporting
mode using that -C|--columns switch.

Using the options for reporting mode if reporting is not initiated
(using the -C|--columns switch) can cause various issues and
inconsistencies in the output.

See also https://github.com/lvmteam/lvm2/issues/144.

3 months agodmeventd: fix error with older compilers 1979781348
Peter Rajnoha [Tue, 12 Aug 2025 12:14:00 +0000 (14:14 +0200)]
dmeventd: fix error with older compilers

3 months agodmeventd: fix error with older compilers 1979776686
Peter Rajnoha [Tue, 12 Aug 2025 12:11:13 +0000 (14:11 +0200)]
dmeventd: fix error with older compilers

dmeventd.c:97: error: initializer element is not constant

3 months agotests: vgsplit-cache: remove the splitted VG 1979693119
Peter Rajnoha [Tue, 12 Aug 2025 11:25:03 +0000 (13:25 +0200)]
tests: vgsplit-cache: remove the splitted VG

3 months agoWHATS_NEW: update 1979689810
Peter Rajnoha [Tue, 12 Aug 2025 11:23:28 +0000 (13:23 +0200)]
WHATS_NEW: update

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

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

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

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

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

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

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

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

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

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

Before this patch:

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

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

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

With this patch applied:

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

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

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

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

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

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

This reverts commit e50e59ae42a5def33e7d2fa514fccdf6db2cc060.

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

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

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

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

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

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

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

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

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

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

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

Before this patch:

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

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

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

With this patch applied:

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

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

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

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

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

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

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

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

lvconvert output printed message was slighlty updated

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

This reverts commit 53db14171c6b516058486b2a80eaa17af32a246b.

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

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

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

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

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

This case currently returns success.

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

This reverts commit ed139168596f1a85b81bc6bbbb7280796eb83476.

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

This reverts commit 612a22ac0829669a5bd8d6fc171d734dce583bf5.

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

This reverts commit 8e2cdcc0067526c29197c2ba92ea6e7921a19558.

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

This reverts commit d2a66d43435fd20f248647c78579586fa8bbb1d9.

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

This reverts commit 1593a6e47c37d57f0d69ab81bc70a186be908f98.

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

This reverts commit c901528053e7f63538239431480f20db8b7d4ca6.

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

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

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

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

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

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

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

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

they were mistakenly logging as dev_read_reservation

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

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

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

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

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

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

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

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

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

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

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

Use matching dm_percent_t type to store percent values.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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