1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

7433 Commits

Author SHA1 Message Date
Marian Csontos
1b8075a549 Fix previous commit 2024-12-18 17:09:35 +01:00
Zdenek Kabelac
d8acbaf1c6 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 cb87e184bc)
2024-12-18 15:45:56 +01:00
David Teigland
f36ddaf72b 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 d952358636)
2024-12-18 15:43:24 +01:00
Zdenek Kabelac
e4890763b6 device_id: close only opened dir
After more of opendir, make sure 'dir' is closed
only when it's been opened.

(cherry picked from commit edfa4955d8)
2024-12-18 15:43:10 +01:00
Zdenek Kabelac
d6229041a5 devicesfile: move opendir after fclose
Call opendir() after new file is stored within dir,
otherwise this new file would not accounted.

(cherry picked from commit 2c5bf25187)
2024-12-18 15:42:49 +01:00
Peter Rajnoha
2371383de6 device_id: fix segfault if devices file has PVID=.
(cherry picked from commit 8e3db44036)
2024-12-18 15:42:22 +01:00
Zdenek Kabelac
497d9406ee cleanup: use single array for idtype string
Share string array for de/coding idtype.

(cherry picked from commit caa0e08738)
2024-12-18 15:41:44 +01:00
Heinz Mauelshagen
a5672ff088 lv_manip: avoid unreleased memory pool(s) message on RAID extend
In case of different PV sizes in a VG, the lvm2 allocator falls short
to define extended segments resiliently asked for 100%FREE RaidLV extension
and a RAID distinct allocation check fails.  Fix is to release a memory pool
on the resulting error path.

Until the lvm2 allocator gets enhanced (WIP) to do such complex (and other)
allocations proper, a workaround is to extend a RaidLV to any free space on
its already allocated PVs by defining those PVs on the lvextend command line
then iteratively run further such lvextend commands to extend it to its
final intended size.  Mind, this may be a non-trivial extension interation.

(cherry picked from commit 557b2850ce)
2024-08-07 16:59:27 +02:00
David Teigland
0bb9ae53db lvmlockd: avoid lockd_vg for local VGs
Previously, a command would call lockd_vg() for a local VG,
which would go to lvmlockd, which would send back ENOLS,
and the command would not care when it saw the VG was local.
The pointless back-and-forth to lvmlockd for local VGs can
be avoided by checking the VG lock_type in lvmcache (which
label_scan now saves there; this wasn't the case back when
the original lockd_vg logic was added.)  If the lock_type
saved during label_scan indicates a local VG, then the
lockd_vg step is skipped.

(cherry picked from commit bf60cb4da2)
2024-07-09 19:33:03 +02:00
David Teigland
16af82a5af Allow system.devices to be automatically created on first boot
An OS installer can create system.devices for the system and
disks, but an OS image cannot create the system-specific
system.devices.  The OS image can instead configure the
image so that lvm will create system.devices on first boot.

Image preparation steps to enable auto creation of system.devices:
- create empty file /etc/lvm/devices/auto-import-rootvg
- remove any existing /etc/lvm/devices/system.devices
- enable lvm-devices-import.path
- enable lvm-devices-import.service

On first boot of the prepared image:
- udev triggers vgchange -aay --autoactivation event <rootvg>
- vgchange activates LVs in the root VG
- vgchange finds the file /etc/lvm/devices/auto-import-rootvg,
  and no /etc/lvm/devices/system.devices, so it creates
  /run/lvm/lvm-devices-import
- lvm-devices-import.path is run when /run/lvm/lvm-devices-import
  appears, and triggers lvm-devices-import.service
- lvm-devices-import.service runs vgimportdevices --rootvg --auto
- vgimportdevices finds /etc/lvm/devices/auto-import-rootvg,
  and no system.devices, so it creates system.devices containing
  PVs in the root VG, and removes /etc/lvm/devices/auto-import-rootvg
  and /run/lvm/lvm-devices-import

Run directly, vgimportdevices --rootvg (without --auto), will create
a new system.devices for the root VG, or will add devices for the
root VG to an existing system.devices.

(cherry picked from commit c609dedc2f)
(cherry picked from commit 3321a669d8)
2024-07-09 19:28:56 +02:00
Zdenek Kabelac
e59c84ca3a gcc: clean cast with -Wbad-function-cast
Makes gcc happier.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
e3dff2cba2 gcc: same signess 2024-05-14 17:59:26 +02:00
Zdenek Kabelac
915267c900 activation: log_debug_activation
Correcting debug class.
2024-05-14 17:59:16 +02:00
Zdenek Kabelac
026344e8cc cleanup: local const arrays
No need for relocation entries for locally used arrays.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
ffdceeb982 cleanup: some missed public symbols static 2024-05-13 12:58:19 +02:00
Zdenek Kabelac
74e487f3a9 label: make scan_bcache local
Seems there are no users of scan_bcache, so make it local.
TODO: such variable should be ideally in cmd_context.
2024-05-13 02:21:37 +02:00
Zdenek Kabelac
8da0ab6fc1 cleanup: drop unused declared struct 2024-05-13 02:21:37 +02:00
Zdenek Kabelac
8168b5e71d clenaup: update local static with _ 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
09f70dbb87 cov: avoid TOCTOU
Use just opendir() call and produce error message from errno state.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
5f1c799e6a cov: enum mapping cache format
Cleanly map cache metadata format enumeration.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
5818fbfbcf cov: enum matching type 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
3e91823b3e cov: enum correct prototype
Cleanup enum usage.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
3f41b4af55 cov: check for overlow math
Add some extre protection to avoid integer overflow type of problems.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
5c7d6083a9 cov: annotate to silent some coverity warning 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
bbf352892d cov: use literal for printf
Use literal for printf and just empty string if needed.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
d7c2fe9723 cov: use literal for printf format
Prepare suffix ahead and use literal for printf().
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
9f4dc4170b cov: sanitize string for file path 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
db40a2e33c cov: replace strcat with safe snprintf 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
04b407674c cov: use sscanf buffer size limits
String parsing with buffer size limit.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
61a11f25a3 cov: check for valid raid0 LV segment
Add internal error to quiet Coverity fear of NULL pointer deref.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
099a4e2146 raid: easier prompt message
Use  printf capability of 'prompt()' funtions so use literal
when building this message.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
7f25e58f66 const: array for _vdo_split 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
8bbd00162b const: log level string 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
eae0314b55 const: suffixes list
dm_tree_set_optional_uuid_suffixes() is safe to use with overcasted
array to (const char**)
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
0e5250c475 const: _reserved 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
e6f46fafe7 const: use arrays of strings 2
Next set of changes.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
0bcf2c6514 const: use arrays of strings
Such string is stored directly in '.rodata' section.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
efe2005022 const: drop static keyword
We don't need relocatable space to store 'const' number.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
abf7c40185 const: static array
Such array can be stored  in   .rodata   section.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
acabc995c0 const: config items 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
9f506eb89e const: raid takover arrays 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
6430a6ca63 const: _fns poll_function 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
ff699eab24 const: _ops text_vg_version 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
41ffa8c74d const: _ops labeler _text_ops 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
64cb8b5940 const: _ops segtype handler 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
effafa8fc8 const: _ops text handler
Making sure these structures ends in '.data.rel.ro' section.
(instead of plain '.data' section).
2024-05-04 01:01:42 +02:00
Zdenek Kabelac
a6f4aed3c0 vdo: enhance error path
When the conversion to VDO fails, try to restore previous VG state
and also remove orphan DM node from table.
2024-05-04 00:57:14 +02:00
Zdenek Kabelac
6f8abdc978 cleanup: tab indent and typo 2024-05-02 11:58:26 +02:00
Zdenek Kabelac
db6bb6e90b cleanup: unlink passes with ENOENT 2024-05-01 10:55:17 +02:00
Zdenek Kabelac
061fa7b690 cleanup: remove unused code 2024-05-01 10:55:17 +02:00