1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

19688 Commits

Author SHA1 Message Date
Marian Csontos
a468c4028a WHATS_NEW: update 2025-01-09 15:59:48 +01:00
Zdenek Kabelac
f3eb858a30 memlock: check for proper reserved size
Fix regression introduced with commit:
964012fdb924076e9ab97fabe00e759ddbf7c3bd
that effectively disabled memory locking before suspending volumes.
From merging/testing there remained wrong condition
as we really want to check for 0 memory reservation value
for both checked settings.

(cherry picked from commit 4ef211a187dac348fa1857d577f5c17c9dace190)
2025-01-09 15:51:05 +01:00
Peter Rajnoha
7027d3897a WHATS_NEW: update
(cherry picked from commit 1576273273b84bc8d3d330f113ffb1ac67f2c0a2)
2025-01-09 15:50:47 +01:00
Peter Rajnoha
97713c89cf tests: adjust lvresize-xfs tests for recent lvextend changes
Because now, we are doing the fsinfo check before extending an LV and if
that check fails, we do not proceed to the LV extension itself and the
lvextend command bails out immediatelly.

(cherry picked from commit e86a75b4fe5873f563c930a575f54143ddca7c7c)
2025-01-09 15:50:37 +01:00
Peter Rajnoha
9d9c8b8676 lv_manip: check fs resize is supported before LV extension
This avoids a situation where we would extend an LV and then we would
not do anything to the FS on it because the FS info check failed for some
reason, like the type was not supported (e.g. swap) or we could not resize
the FS unless being in some supported state (e.g. XFS to be mounted for
the xfs_growfs to work).

Before this patch (LV resized, FS not resized):

❯  lvextend --fs resize -L+4M vg/swap
  Size of logical volume vg/swap changed from 32.00 MiB (8 extents) to 36.00 MiB (9 extents).
  File system extend is not supported (swap).
  File system extend error.
  Logical volume vg/swap successfully resized.

With this patch (LV not resized, FS not resized):

❯  lvextend --fs resize -L+4M vg/swap
  File system extend is not supported (swap).

(cherry picked from commit 5f53ecda3600834e920eef14065d35cd0fb6c59b)
2025-01-09 15:50:22 +01:00
Zdenek Kabelac
93aed32972 WHATS_NEW: update
(cherry picked from commit 5ef958704c82c45a6bd8215d920e4366c0c5e1bd)
2025-01-09 15:50:04 +01:00
Zdenek Kabelac
41aaea4349 tests: check conversion of in-use volume
Thin-pool conversion fails early when trying to convert
volume which is in use  (simulated by sleep <)

(cherry picked from commit 3e641578d80bc7a28bcb451115b06da87d232b3a)
2025-01-09 15:44:19 +01:00
Zdenek Kabelac
4627ca20dc thin: deactivate converted volume early
Deactivate converted volume to pool early, so the conversion
exits early and does not leave some already created metadata
volumes that needed manual cleanup by user after command
aborted its conversion operation when the converted volume
was actually in-use  (i.e. when user tried to convert
a mounted LV into a thin-pool, 2 extra volumes needed removal).

(cherry picked from commit 6326d0093730fe945eeb4748738ddda55bf8a3c9)
2025-01-09 15:44:13 +01:00
Zdenek Kabelac
f8d2dda397 configure: autoreconf
(cherry picked from commit 928b8e9c6eaf871b3405b91c64eac5ea854f2572)
2024-12-16 20:18:11 +01:00
Zdenek Kabelac
b2cec1fc0e configure.ac: add support for libnvme
Add 2 new options for linking  libnvme with lvm2.
Option  --without-libnvme, --disable-nvme-wwid

(cherry picked from commit cb87e184bcbade1ac2da8fb611177f520169decd)
2024-12-16 20:18:02 +01:00
David Teigland
5f10e49c72 device_id: nvme devices may use alternate wwids
Device quirks may cause sysfs wwid file to change what it
displays, from a bogus eui... string to an nvme... string.

The old wwid may be saved in system.devices, so recognizing
the device requires finding the old value from libnvme.

After matching the old bogus value using libnvme, system.devices
is updated with the current sysfs wwid value.

(cherry picked from commit d952358636887348c390784a8ca5efb87b26784f)
2024-12-16 20:17:54 +01:00
Zdenek Kabelac
cce339d487 WHATS_NEW: update
(cherry picked from commit 473e93fbfff513f849e76eba919c44aa07608c30)
2024-11-13 15:45:24 +01:00
Zdenek Kabelac
bdcd4f18fe tests: check _tdata conversion to raid1
(cherry picked from commit 7b9bdcb4d4aef7f0a079e2278869f19aa7fb7c83)
2024-11-13 15:45:12 +01:00
Zdenek Kabelac
2bc2dad1e2 raid: fix name rotation
Since we now keep lv names valid all the time (as they are part
of radix_tree) - there is a problem with this renaming code, that
for a moment used duplicated name in vg struct.

Fix it by interating LVs backwared - which avoids breaking consitency
and also actually makes code more simple.

(cherry picked from commit c2f41c1a59351772b78f2328edd61f996cc37c3b)
2024-11-13 15:44:58 +01:00
Zdenek Kabelac
aa78a84b20 tests: check vdo minimum_io_size
(cherry picked from commit dcac774f0982470b29bf04f27b6394fe27c4df71)
2024-11-12 11:36:29 +01:00
Zdenek Kabelac
55bfaca8a8 vdo: fix input units for minimim_io_size
When specifying minimum_io_size with --vdosettings,
command assumed wrong unit (sectors).

So '--vdosettings minimum_io_size=512|4096' resulted into
an error that only 512 or 4096 values are allowed, but
at the same time values  1 or 8 were accepted.

So fix by converting any number >= 512 to 'sectors' and
keep input of 1 or 8 still valid if anyone has been using
this before.

So now we take  512 or 4096  and still also  1 or 8 with the
same effect.

Also correct the 'error' message when invalid minimum_io_size
is specified.

(cherry picked from commit 158d3243b638f50f62c60128168c21840787f1ab)
2024-11-12 11:26:44 +01:00
Peter Rajnoha
06dae73111 WHATS_NEW: update
(cherry picked from commit 44a04b71f8e8ff730b5538c4b6323041cf904ece)
2024-11-12 11:26:22 +01:00
Peter Rajnoha
66aa04c39c tests: remove superfluous -a option for df used in lvresize-xfs.sh
The df -a looks at whole system and it returns an error code in case
there's an inaccessible fs which is not even part of the testing environment.
The -a for df is not actually needed here in the lvresize-xfs test, so remove it.

(cherry picked from commit a2ca20dad98f4d7389d449672b3ff0b16858f02b)
2024-11-12 11:11:04 +01:00
Peter Rajnoha
75d4056f39 lv_manip: use the same param validation for RAID 0 as for RAID 1/4/5/6
This actually reverts commit 83ae675f8df53010c984b78d0318d0d92d5ac83a.

(cherry picked from commit 1d8a4c4817895f45a5fee00ccf721b351e5a4668)
2024-11-12 11:10:45 +01:00
Peter Rajnoha
f2e8b49e1d lv_manip: fix stripe count and size validation for RAID LVs
Fix stripe count and size parameter validation for RAID LVs and
include existing automatic setting of these parameters based
on current shape of the RAID LV in case these are not set
on command line fully.

Previously, this was done only to a certain subset given by this
condition (where the 'stripes' is the '-i|--stripes' cmd line arg
and  the 'stripe_size' is actually the '-I|--stripesize' cmd line arg):

  !(stripes == 1 || (stripes > 1 && stripe_size))

This condition is a bit harder to follow at first sight and there
are no comments around with explanation for why this one is used,
so let's analyze it a bit more.

First, let's convert this to an equivalent condition (De Morgan law)
so it's easier to read for humans:

  stripes != 1 && !(stripes > 1 && stripe_size)

Note: Both stripe and stripesize are unsigned integers, so they can't be negative.

Now, based on that condition, we were running the code to deduce the
stripe/stripesize and do the checks ("the code") only if both of these
are true:

  - stripes is different from 1

  - we don't have stripes > 1 and stripe_size defined at the same time

But this is not correct in all cases, because:

  A) if someone uses stripes = 0, then "the code" is executed
    (correct)

  B) if someone uses stripes = 1, then "the code" is not executed
    (wrong: we still need to be able to check the args against
            existing RAID LV stripes whether it matches)

  - if someone uses stripes > 1, then "the code" is:

     C) if stripe_size = 0, executed
       (correct)

     D) if stripe_size > 0, not executed
       (wrong: we still want to check against existing RAID LV stripes)

Current issues with this condition:
  The B) ends up with segfault.

    ❯ lvextend -i 1 -l+1 vg/lvol0
      Rounding size 4.00 MiB (1 extents) up to stripe boundary size 8.00 MiB (2 extents).
    Segmentation fault (core dumped)

  The D) ends up with errors like:

    ❯ lvextend -i 3 -l+1 -I128k vg/lvol0
      Rounding size 4.00 MiB (1 extents) up to stripe boundary size 8.00 MiB (2 extents).
      Rounding size (4 extents) up to stripe boundary size for segment (5 extents).
      Size of logical volume vg/lvol0 changed from 8.00 MiB (2 extents) to 20.00 MiB (5 extents).
      LV lvol0: segment 1 with len=5  has inconsistent area_len 3
      Couldn't read all logical volumes for volume group vg.
      Failed to write VG vg.

Conclusion:
  The condition needs to be removed so we always run "the code" to check
  given striping args given on command line against existing RAID LV
  striping. The reason is that we don't want to allow changing stripe
  count for RAID LVs through lvextend and we need to end up with the
  error:
    "Unable to extend <RAID segment type> segment type with different number of stripes"

  (We do support changing the striping by lvconvert's reshaping functionality only).

(cherry picked from commit b5249fa3c20fe5d9e1d4811e7e5bfd957b15a820)
2024-11-12 11:10:04 +01:00
Marian Csontos
e6f8d98553 WHATS_NEW: update 2024-11-04 17:05:21 +01:00
Marian Csontos
cccc336a97 Revert "10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"
This reverts commit f98d020eadafe7d8db7bec1f5a26915615e5a6a9.
2024-11-04 17:03:34 +01:00
Marian Csontos
89058bc068 Revert "11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db"
This reverts commit 2b2f11a74cd5cc05f266fd0c65f0e55eb8bafd9f.
2024-11-04 17:03:34 +01:00
Marian Csontos
885113b30d Revert "dm udev rules: don't export and save DM_SUSPENDED"
This reverts commit 21ca92c4325b6b161fb1e1f10942ad9f8d23c144.
2024-11-04 17:03:34 +01:00
Marian Csontos
57fa9b8400 Revert "dm udev rules: don't export and save DM_NOSCAN"
This reverts commit a196752969320cfc34a97cc97afa1978fa57da73.
2024-11-04 17:03:34 +01:00
Marian Csontos
290f2740ef Revert "10-dm.rules: bump DM_UDEV_RULES_VSN to 3"
This reverts commit 038f9254d9554654197b59c160e3f775af27cdb1.
2024-11-04 17:03:34 +01:00
Marian Csontos
4ed40e6719 RHEL9 2024-11-04 17:03:31 +01:00
Marian Csontos
f87a6ad6d6 pre-release 2.03.28 v2_03_28 2024-11-04 16:42:12 +01:00
Zdenek Kabelac
8ada61dbed gcc: fix warning about uninitialized use
get_sizes_lockspace() may not always initilize all passed values
in case the bitfield would not trigger if() path.
So just in case keep the path initilized.

TODO: maybe add INTERNAL_ERROR to get_sizes_lockspace().
2024-11-01 17:48:28 +01:00
David Teigland
0aa585a29f lvmlockd: remove unused vg_sysid
from structs and info dump.
2024-11-01 10:48:12 -05:00
Zdenek Kabelac
fc2e4a7b70 tests: skip test on older version
Prevent crashing kernel on older systems.
2024-11-01 13:27:20 +01:00
Zdenek Kabelac
057314ff8d lvmlockd: update prototype for non-lvmlockd build
Match prototype to last updates of lockd_init_lv_args().
2024-11-01 11:27:02 +01:00
David Teigland
88a085c485 lvmlockd: optimize new lv lease search
When converting a VG to locktype sanlock, a new
lease is allocated for each existing lv.  Finding
a new lease location involved searching the lvmlock
LV from the start for an unused location, which
would be very slow with many LVs.  Improve this by
starting each search from the last used location.
2024-10-31 20:29:00 -05:00
David Teigland
4eb66fd20c lvmlockd: fix vgchange --locktype sanlock
Fix regression from commit 7f29afdb06d
"lvmlockd: configurable sanlock lease sizes on 4K disks"

That change failed to recognize that a running lockspace will not
exist in lvmlockd when converting a local VG to a sanlock VG, i.e.
vgchange --locktype sanlock vgname.  When the vgchange attempted
to initialize new lv leases for existing LVs, lvmlockd would
return an error when it found no lockspace.
2024-10-31 16:31:35 -05:00
Zdenek Kabelac
354ca52e8c WHATS_NEW: update 2024-10-31 17:56:59 +01:00
Zdenek Kabelac
c2afa7a116 vg: add radix_tree for lv uuids
When searching for committed LV by uuid, this search can
be expensive for commands like 'vgremove' - so for
this part introduce  'lv_uuids' radix_tree that is
build with first access to lv_committed().
2024-10-31 17:55:31 +01:00
Zdenek Kabelac
db0f1b799f metadata: use radix_tree for find_lv_in_vg
Since there is a group of commands that need to access 'lv_list'
while still need to search for LV by its name, make the whole
struct lv_list a member of logical_volume structure.
This makes it easy to return also 'lv_list' this list this LV
within VG.
Also the patch should not use more memory, since we were allocating
lv_list for each LV anyway when linkin LV to VG.

Since find_lv_by_name() is now using radix_tree(),
use the same 'search for /' in LV in name for both
find_lv() & find_lv_in_vg().

TODO: Possibly refactor code and use only dm_list
instead of lv_list and dereference LV with container_of()
(thus saving pointer within struct logical_volume) - but
we use 'lv_list' currently in many places...
2024-10-31 17:55:31 +01:00
Zdenek Kabelac
0e5beb92c5 config: introduce validate_metadata
Add lvm.conf  config/validate_metadata  configurable setting.
Allows to disable validation of volume_group structure before
writing to disk.
Call of vg_validate() is supposed to catch any inconsistency
of in-memory volume group structure and possibly early aborting
commnand before making any more 'damage' in case the VG struct
is found insistent after some metadata manipulation.

This is almost always useful for devel - and also for normal user
as for small metadata size this doesn't add too much overhead.

However if the volume_group size is large and operations are just
adding removing simple LVs - this validation time may add noticable
to final command running time.

So if the user seeks the highest perfomance of command and does
not do any 'complex' metadata manipulation - it's reasonably safe
to disable validation (with the use of setting "none") here.
2024-10-31 17:55:31 +01:00
Zdenek Kabelac
7bf404db3b validate_lvname: early exit
If the LV name does not any have '_' chr,
there is no point trying to call 'strstr()' to look for "_suffix".
Also we can search from _.
2024-10-31 17:55:31 +01:00
Zdenek Kabelac
ae8ba49142 cov: validate string with lock mode
Check the dev_mode string is not NULL before use.
2024-10-30 13:09:31 +01:00
Zdenek Kabelac
6ebcb0015e cov: add stacktraces
Add stacktraces for unexpected paths.
2024-10-30 13:08:56 +01:00
Zdenek Kabelac
699696b0a6 vdo: reader checks there is enough data
Validate enough of data was read from disk to parse vdo header.
TODO: there should be a loop for buffer reading.
2024-10-30 12:59:08 +01:00
Zdenek Kabelac
8095a6c14c metadata: pahole logical_volume
Shuffle some variables to remove 'extra' alignment holes
within the structure thus making it smaller.
2024-10-30 12:59:08 +01:00
Zdenek Kabelac
9e8bd57e15 metadata: lv_set_name use uniq_insert
With presence of uniq_insert, use this function also
here for extra protection and check for duplicate lv_name
when inserting a new name into radix_tree.
2024-10-30 12:59:08 +01:00
Zdenek Kabelac
b66b72b115 get_alloc_string: compare only enum
Instead of possibly checking for cling_by_tags string twice,
just compare resulting alloc number from search loop.
2024-10-30 12:57:34 +01:00
Zdenek Kabelac
30adf7e91c toolcontext: use the striped string first 2024-10-30 12:57:34 +01:00
Zdenek Kabelac
e2a5715a60 cache_manip: reset sigint handler
After processing interrupt, reset the interrupt counter,
so further code is not mislead and continues processing
in 'locked' section as expected.
2024-10-30 12:57:34 +01:00
Zdenek Kabelac
0e64d49642 tests: use longer tag
Avoid config 'grep' with actual 'randomly' generated path name
which may eventually contain 'cc' as part the path and
causing a mismatch of the grep test.
2024-10-30 12:57:34 +01:00
Zdenek Kabelac
608418e4f2 debug: missing stacktrace 2024-10-28 20:07:37 +01:00
Zdenek Kabelac
16241b2dc7 lv_manip: init major minor in alloc_lv
Move initialization of major and minor to alloc_lv().
2024-10-28 20:07:37 +01:00