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

19421 Commits

Author SHA1 Message Date
David Teigland
4dc009c872 lvmlockd: allow forced vgchange locktype from none
vgchange --locktype sanlock|dlm --lockopt force <vgname>
can be used to change the lock type without lvmlockd or
the lock manager involved.
2024-06-27 13:29:03 -05:00
David Teigland
bf60cb4da2 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.
2024-06-27 13:29:03 -05:00
Marian Csontos
1b9bf5007b scripts: Install services for devices file init
Services introduced in commit c609dedc2f
need installing.
2024-06-27 15:16:26 +02:00
Marian Csontos
ab93e1c38d pages: Fix typos 2024-06-27 15:16:26 +02:00
Marian Csontos
82ea579ba2 pages: Fix macro 2024-06-27 15:16:26 +02:00
Zdenek Kabelac
21b215ee63 udev: disable suffix handling
The idea in the patch 6e6d4c62b for handling -suffix as
indication of private device needs to be disabled.

Some problematic cases are currently not resolvable and some
more thinking is needed.

Once fixed, we can revert this patch.
2024-06-25 23:18:07 +02:00
Zdenek Kabelac
336cb32884 device_mapper: empty string for missing uuid
Constify name & uuid within dm_active_device.
Set uuid to "" for case the DM device has no uuid.
Do not store "empty" device uuid in radix tree.
2024-06-21 14:51:25 +02:00
Zdenek Kabelac
57e6e94a83 WHATS_NEW: update 2024-06-21 11:28:54 +02:00
Zdenek Kabelac
88fb07b669 label: use dev iterator directly
Avoid preparing 'extra' dm_list with devices, and just
use the iterator result directly.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
cc344c3e69 dev_cache: replace dm_hash with radix_tree
For large device sets our dm_hash can produce larger amounf of mapping
collision and we would need to further increase our has size.

So instead use the radix_tree code which is immune agains growing size
of devices and uses memory more effiecently to store all the paths.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
e0537559c6 dev-cache: replace btree with radix_tree usage
Instead of less efficient 'btree' switch dev_cache to use
radix_tree, that is generating more efficient tree mapping.

Some direct use of btree iteration replace with our dev_iter code.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
4b126fd953 filter-persistent: convert to use radix_tree
Convert the persisten filter to use more memory compact radix_tree as
dm_hash is bound to preallocated number of slots and stores whole
key together with value.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
ed440367b9 dev_manager: check if uuid isn't already in cache
When DM uuid cache is available, we can possibly avoid unnecessary
status ioctl() when we check the device for 'usable' uuid.

If this test passes the existing code will got through the full check.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
e30bc9b179 device_mapper: refactor code to lvm library
Move the code around caching active dm device devno, name and uuid
from device_mapper/libdm-iface to dev_cache file - as libdm layer
cares about 'decoding' ioctl data from kernel and caching for use by
lvm stays within lvm.

Introduce:
dev_cache_update_dm_devs
dev_cache_get_dm_dev_by_devno
dev_cache_get_dm_dev_by_uuid

Use radix_tree for searching.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
14f782c5a7 dev_manager: no layer suffix for component
Do not attach layer suffix to the UUID when activating component LV.

In this case we want to see allow this LV to be public, thus
such LV should not be using -layer suffix in its UUID.

This also requires that our 'cached' access will check for
both UUID (with & without suffix) which was unnoticed issue before.

This change is now necesssary since our udev rule automatically expects
any LV with -layer suffix is private and will prevent generaring
any systemd unit even when there are no 'DM' flags bits passed via
cookie mechanism while creating such LV.
2024-06-21 11:25:33 +02:00
Zdenek Kabelac
b1d80a0ffd gcc: pipe error path
Close opened descriptors on failed fork path.
2024-06-19 14:28:02 +02:00
Zdenek Kabelac
64ccbc4b52 gcc: check cv pointer when needed
As 'cv' was already dereferenced, check for NULL with do {} while();
loop.
2024-06-19 14:28:02 +02:00
Zdenek Kabelac
a98beb8ee3 gcc: ensure all fmt struct element are initialized 2024-06-19 14:28:02 +02:00
Zdenek Kabelac
f8907b8f3c gcc: ensure reset of fd on error path 2024-06-19 14:28:02 +02:00
Heinz Mauelshagen
d01e5ec126 raid_manip: prevent reshape with freed component SubLVs
In order to free SubLVs after a stripe removing reshape, lvconvert has
to be run without layout changes.   Prevent a layout changing request
in case any such freed SubLVs exist and inform the user about the fact
requesting to release them first.
2024-06-18 14:14:24 +02:00
Heinz Mauelshagen
cc6ddf978a tests: adjust lvconvert-raid-reshape-size.sh delays/timeouts 2024-06-18 14:13:20 +02:00
Heinz Mauelshagen
2468b66b30 tests: add reshape size consistency tests script lvconvert-raid-reshape-size.sh
Calculates expected size before/after reshapes adding/removing stripes
to/from RaidLVs with levels 4/5/6/10 and compares it with the actual
one the block layer shows.  Stripes reshaped to are listed in the
tst_stripes variable.  mkfs/fsck/resize2fs the respective RaidLVs
to confirm ext4 can be resized accordingly without issues.
2024-06-11 15:44:36 +02:00
Peter Rajnoha
6e6d4c62b3 udev: ignore private LVM devs in udev and systemd
We automatically ignore these devs, when lvm2 create devs,
whoever when lvm2 database is dropped or someone just
created these devs with such formated UUID, there is no
other informantion then to check DM UUID.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
fe68fb0525 tests: fix wrong pos with CONFIG_PRINTK_CALLER
SUSE kernels distribution enables CONFIG_PRINTK_CALLER by default.

One line of cat /dev/kmsg is like:

6,904,9506214456,-,caller=T24012;loop8: detected capacity change from 0
to 354304

If CONFIG_PRINTK_CALLER is off:

6,721,53563833,-;loop0: detected capacity change from 0 to 354304

',caller=T24012' is the redundant part needed to be handled.
Otherwise pos will be lager than buf size causing sz underflowed.
Then constructor of std::string will throw a exception to break
tests:
$ make  check_local  T=shell/000-basic.sh
VERBOSE=0 ./lib/runner \
        --testdir . --outdir results \
        --flavours ndev-vanilla --only shell/000-basic.sh --skip @

running 1 tests
running: [ndev-vanilla] shell/000-basic.sh
            0:00.000Exception: basic_string::_M_create
make[1]: *** [Makefile:148: check_local] Error 1
make[1]: Leaving directory '/root/lvm2/test'
make: *** [Makefile:89: check_local] Error 2

Fix it with strchr for ';' as delimiter to get pos.

Reported-by: Su Yue <glass.su@suse.com>
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
3a9689652d radix_tree: add radix_tree_values
To more easily adopt radix_tree over existing code base, add
abstraction over 'radix_tree_iterate' which basically builds
an array of all traversed values, and then it's just easy to
go over all array elements.

TODO: code should be converted to use  radix_tree_iterate()
directly as it's more efficient.

Note: it can be possibly to rewrite recursive _iterate() usage
to linear travesal, not sure whether it's worth the effort
as conversion to 'radix_itree_iterator' is relatively simple.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
1813d0d186 radix_tree: add radix_tree_lookup/insert_ptr
Add simple 'wrapper' inline functions to insert or return ptr lookup value.
(So the user doesn't need to deal with 'union radix_value' locally and
also it makes easier to translage some lvm2 functions to use radix_tree).

Note: If the stored 'value' would NULL, it cannot be recognized
from a case of 'not found'. So usable only when 'values' stored with
tree are not NULL.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
b77edc337a radix_tree: constify _iterate
Use nodes as const.
Swap order of arguments.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
1e2a3445d9 radix_tree: debug updates
Some updates to _dump()  debugging function so the printed result
can be more easily examined by human.

Also print 'prefix' as string when all chars are printable.

Add 'simple' variant of _dump also to 'simple' version of radix tree
(which is however normally not compiled).
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
88681f05f1 radix_tree: api change
Instead of using 'key state & key end' uint8_t* switch to use
void* key, & size_t keylen.  This allows easier adaptation with
lvm code base with way too much casting with every use of function.

Also correctly mark const buffers to avoid compiled warnings and
casting.

Adapt the only bcache user ATM for API change.

Adapt unit test to match changed API.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
5731d06bc5 radix_tree: indent
Some minor indent changes to more easily read code.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
76ca20a9af gcc: drop const specifier from allocated string
Use nornal (char*) for pointers we should free().
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
524df486b3 cov: annotate already validated lv name 2024-06-03 15:30:05 +02:00
Zdenek Kabelac
896410b393 cleanup: use _ for static var
Add missing '_' for some static vars.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
cd0f5ee36c cleanup: remove unneded headers
As the common code was refactored to toollib, this header file
no longer needs to be included here.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
13e0222ba2 device_id: more use of device_get_uuid
Use function that is caching UUID if kernel provides functionality
from a single ioctl() call.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
fffff2c2a2 dev-mpath: check uuid with device_get_uuid 2024-06-03 15:30:05 +02:00
Zdenek Kabelac
915dd18361 typo: fix typos
Typo and indent.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
85e0636623 cleanup: some more MAJOR MINOR unsigned
Finish remaing missing cases where MAJOR/MINOR was casted to (int)
while we can now use it directly as 'unsigned'.
2024-06-03 15:30:05 +02:00
Zdenek Kabelac
91502446ac lvremove: reuse existing dm_build_dm_uuid
Use existing dm_build_dm_uuid() to generate LV's DM UUID.
2024-06-03 15:30:05 +02:00
David Teigland
a8b8e1f074 vgimportdevices: skip global lockd locking
Fix commit b65a2c3f3a "vgimportdevices: skip lvmlockd locking"
which intended to disable lvmlockd locking, but the lockd_gl_disable
flag was mistakenly set after lock_global() so it wasn't effective.
This caused vgimportdevices to fail unless locking was started.
2024-05-30 14:53:46 -05:00
David Teigland
ace25d5eeb README: remove old branch names 2024-05-29 09:30:41 -05:00
Zdenek Kabelac
9ee6a9b982 make: generate 2024-05-28 14:55:53 +02:00
Zdenek Kabelac
c14e0282ec tests: accept new vdoformat output
There is slight change in the printed size number.
2024-05-28 14:55:53 +02:00
Zdenek Kabelac
2c8ff67470 args: generate configurable path 2024-05-28 14:55:53 +02:00
Zdenek Kabelac
f10de12ade tests: quoted DM_DEV_DIR 2024-05-27 21:34:25 +02:00
Zdenek Kabelac
7e59c3aa58 tests: use single aux lvmconf
Reduce log size as lvmconf can process multiple settings at once.
2024-05-27 21:34:25 +02:00
Zdenek Kabelac
9207bae33b device_id: use faster dm_strncpy 2024-05-27 21:34:25 +02:00
Zdenek Kabelac
fbdd26a4a3 device_mapper: solve no devices path
Malloc needs to use sane value when names would be NULL.
Also for devices without 'uuid' return empty string instead of NULL.
2024-05-27 21:33:59 +02:00
Zdenek Kabelac
533a87d0ea lvremove: initilize struct list 2024-05-27 18:23:26 +02:00
Zdenek Kabelac
80fa3511be lvremove: check for handle
Get lvremove_params from non NULL handle.
Introduced in commit 47f8bda05.
TODO: any more thing needed ?
2024-05-27 17:03:37 +02:00