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

18833 Commits

Author SHA1 Message Date
Zdenek Kabelac
c6efab0111 cov: avoid resoure leaks on error path 2023-10-14 23:12:57 +02:00
Zdenek Kabelac
e8e5e6ee3c cov: check next_get token exists 2023-10-14 23:12:57 +02:00
Zdenek Kabelac
6afaaca2e5 cov: enusure pointer to idname exists 2023-10-14 23:12:57 +02:00
Zdenek Kabelac
9668d40d5a resize: reduce without prompt for no-fs case
Apply the same logic for 'lvreduce' which exists for newer
systems (compiled with HAVE_BLKID_SUBLKS_FSINFO)
also for older systems for one very common practical case where
the active LV does not have any blkid known signature/filesystem.

New variant recognized this situation and allowed to proceed
without requesting a prompt, while the older variant always
requested confirmation prompt.

With this patch command now works equily for both variants
for 'active LV' without signature and allows to reduce LV
without prompting.
2023-10-14 23:10:21 +02:00
Zdenek Kabelac
43020cc474 WHATS_NEW{_DM}: update 2023-10-14 01:04:10 +02:00
Zdenek Kabelac
0627716f8a configure: update 2023-10-14 01:04:10 +02:00
Zdenek Kabelac
dd7663d2ae configure.ac: enhancemetns
Simplify configuration with enabling options:
- For --enable-dmeventd automatically --enable-cmdlib.
- For --enable-dbus-service auto --enable-notify-dbus.

Fix check linux/fiemap.h for dmfilemapd.
2023-10-14 01:04:10 +02:00
Zdenek Kabelac
afe1b2bef7 debug: initialize empty string 2023-10-14 01:04:10 +02:00
Zdenek Kabelac
46eeb62b04 pool: fix recalculate of pool chunk_size
Before checking seg_type of the first area, check there is
some existing area.
Since we now support error and zero segtypes, these do not have
any PV area present.
2023-10-14 01:04:10 +02:00
Zdenek Kabelac
85c7629345 libdm: versionion symbol for enhanced dm_task_run
When new app links with current dm_task_run() that propagates ioctl()
errno - ensure it will not be usable with older version without this
supported feature.
2023-10-14 01:04:10 +02:00
Zdenek Kabelac
b162475391 makefiles: fix missing libs
Recent commit  dc8837f079
became actually to strict - we always want to build lib.a files.
2023-10-13 16:34:48 +02:00
Zdenek Kabelac
0bbbe08343 dmfilemapd: ensure program_id is initialized
Assing program_id before return 1,
and also stay C99 compatible with size_t declaration.
2023-10-13 16:04:25 +02:00
Zdenek Kabelac
0b11b08b6e tests: handle empty table better 2023-10-13 15:00:55 +02:00
Zdenek Kabelac
8b8b8ac1f8 configure: update 2023-10-13 14:33:56 +02:00
Zdenek Kabelac
9fa364414c tests: skip for missing mkfs.xfs 2023-10-13 14:33:56 +02:00
Zdenek Kabelac
1605d39b93 tests: comment about version checking to aux.sh
If there would be futher version checking needed,
make a notice there are now two -V formats.
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
be2b3d5ab8 tests: increase delay 2023-10-13 14:25:02 +02:00
Zdenek Kabelac
061c008e15 tests: some minor enhancement of udev test
Reduce pgrep usage.
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
53da646495 tests: fail tests when machine have suspended devs
If the machine has suspended devices present in the DM table,
it's better to fail the test.
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
627535f33e tests: use function to restart dmeventd
Move restart to single function.
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
f117d47ffa configure.ac: version checking for new dmpd tools
New rust version of thin_check returns now also binary name in version,
so adapt the version checking to handle this variant.
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
48fd9fbd02 configure.ac: support for static linking
Introduce couple configure options:

--without-blkid
--without-systemd
--without-udev

These can be useful for build with --disable-shared
where those libraries are often distibuted without
their static libraries.

However such compiled static binaries then have limitted usage.
2023-10-13 14:25:02 +02:00
Adam Joseph
dc8837f079 configure.ac: handle --disable-shared flag
Since LVM 2.02 it appears that compiling LVM on a platform which
lacks a shared library linker/loader will fail to produce any
binaries (dmsetup, lvm2, etc).

Adds support for the standard --disable-shared flag, and
use it to disable attempts at building shared libraries.

Modified-by: zkabelac
2023-10-13 14:25:02 +02:00
Zdenek Kabelac
fb124f0839 device_mapper: pair with libdm _create_and_load_v4
Apply same enhancement also for internal device mapper library
from the commit: 25ef7a7b1a.
2023-10-13 14:24:49 +02:00
Bryn M. Reeves
0ff027ae2c dmstats: only generate aux data separator if group tag is defined
Fix a bug in _stats_set_aux() that causes bogus data to appear
in the 'userdata' field of stats reports when previously grouped
regions are ungrouped:

/var/tmp/File With Spaces: Created new group with 1 region(s) as group ID 0.

Removed group ID 0 on fedora-root

Name             GrpID RgID ObjType RgStart RgSize  #Areas ArSize  ProgID  UserData
fedora-root          -    0 region    6.39g 100.00m      1 100.00m dmstats #-
                                                                           ^^
This is the aux_data separator character followed by empty user data.
The _stats_set_aux() function should only emit the separator if
there is a valid group descriptor for the region.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
995c7b503b Add more dmstats integration tests
Add new tests for filemap, group/ungroup, histograms, precise timestamps
and userdata.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
9aa47f9768 Quote path value in --filemap debug messages
Improves readability of debugging output when file paths contain
whitespace.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
7d8981dd3f dmstats: support group aliases with embedded whitespace
Creating a group with a name that contains whitespace causes an error in
the @stats_set_aux message:

device-mapper: message ioctl on  (253:0) failed: Invalid argument
Could not create regions from file /var/tmp/File With Spaces.

Fix this by quoting the group alias and backslash escaping any
embedded space characters.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
33931431c3 Refactor _stats_parse_list_region()
Refactor the function that parses regions from @stats_list data to
separate the parsing of variable string data from the fixed parts
of the @stats_list response.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
ac41deeeac Rename _stats_set_aux() argument
The aux_data argument of _stats_set_aux() is the user-defined data
to be stored with the stats region. Rename the argument to better
reflect this.
2023-10-12 11:31:14 +00:00
Bryn M. Reeves
f0fd03b122 dmstats: use correct value for precise in _stats_create_file() 2023-10-12 11:31:14 +00:00
Bryn M. Reeves
eda99fc383 Clean up group struct in _stats_create_group() error path
Fix a double free in the error path from _stats_create_group() by
clearing the group struct embedded in the dm_stats handle before
returning:

    device-mapper: message ioctl on  (253:0) failed: Invalid argument
    Could not create regions from file /var/tmp/File With Spaces.
    free(): double free detected in tcache 2
    Aborted (core dumped)
2023-10-12 11:31:14 +00:00
Lennart Poettering
25ef7a7b1a _create_and_load_v4: propagate ioctl errors back to caller
When setting up dm-verity devices with signed root hashes it is very
useful to have a recognizable error code when a key is not present in
the kernel keyring. Turns out the kernel actually returns ENOKEY in that
case, but this gets lost in libdevmapper.

This fixes this: in _create_and_load_v4() it copies the error code from
the ioctl from the sub-tasks back to the main task field on failure.

This is not enough to make libcryptsetup actually propagate the ENOKEY
correctly, that also needs a patch to libcryptsetup, but this is part of
the puzzle.
2023-10-11 15:35:33 +02:00
David Teigland
63b469c160 device_id: fix hints with device ids
Fix some interactions between device IDs and hints.  Hints
may limit the scanned devices which should not always trigger
a search for the PVs that were intentionally not scanned.
Hints should also be invalidated if they contain a device
that's become excluded by an internal filter such as the
device_id filter.
2023-10-10 11:47:29 -05:00
David Teigland
f20be398a1 device_id: refresh devname idnames if any are not found
Search for a PV on other devices if it's a devname entry
and the name doesn't exist on the system.  This restores
code that should not have been removed in commit 1901a47df
"device_id: fix conditions for device_ids_refresh"
2023-10-10 11:46:21 -05:00
David Teigland
25a87ea16a device_id: fix lvmdevices update segfault
From commit 1901a47df1
"device_id: fix conditions for device_ids_refresh"
2023-10-06 12:24:34 -05:00
Zdenek Kabelac
f960fe0578 tests: delay_dev to slowdown pvmove
throtling mirror device is becoming useless with faster CPUS,
as way to many data can be transferred before throttling steps-in.
So prefer using  dm-delay for test and keep throttling as fallback.
2023-10-06 10:51:15 +02:00
Zdenek Kabelac
2c3742039c tests: skip test if the memory cannot be allocated in kernel 2023-10-06 10:51:15 +02:00
Zdenek Kabelac
f5512315d2 tests: ignore failure from stop 2023-10-06 10:51:15 +02:00
Zdenek Kabelac
37329e4184 tests: add delay to let dmevent initalize
There is short time period needed to fully initilize dmeventd and
handle 'kill' signal.
2023-10-06 10:51:15 +02:00
Zdenek Kabelac
44f86d38f9 debug: fix message severity levels
Add some missing WARNS and correct some severity levels.
2023-10-06 10:50:26 +02:00
David Teigland
1901a47df1 device_id: fix conditions for device_ids_refresh
Fix commit 847f1dd99c
"device_id: rewrite validation of devname entries"

which began calling device_ids_refresh() in cases where it
was unnecessary, leading to extra PV searches and warnings.
Specifically, a command like "lvs <vg>" would use the hints
file to scan only devices for the named VG.  This means that
scanning other PVs would be skipped, and device IDs of those
PVs could not be validated because there are no PVID values
to verify.  This missing info would cause messages about
the missing info, and would cause device_ids_refresh to
search for the PVs that had been intentionally skipped.
2023-10-05 15:33:55 -05:00
Zdenek Kabelac
bccfd92f4a tests: previous patch wrongly replaced tab
Tab overwrote first char instead of insert.
Actually it should be a single function.
2023-10-05 01:11:54 +02:00
Zdenek Kabelac
ede63b5029 tests: more complex check for resize of reiserfs
Detection of how the command is supposed to behave actually depends on
the configure.h compilation and whether binary is compiled with
HAVE_BLKID_SUBLKS_FSINFO.

This makes it somewhat complicated in a way how to recognize which
behavior is expected.

Currently we can eventually recognize by checking error output
of some 'random' lvresize command and see if the --fs checksize is
actually recognized and rejected.  If this changes - test needs
to be updated.
2023-10-05 00:03:30 +02:00
Zdenek Kabelac
b80404f2c6 tests: utils use read without slash mangling
Do not use backslash as escape character for path.
2023-10-04 23:58:54 +02:00
Zdenek Kabelac
470f1058a8 tests: better coredump lookup
Some bash version may have problem with contruct:
done < <(

Replace it with array reading.
2023-10-04 23:58:54 +02:00
Zdenek Kabelac
e3adccb528 tests: retry removal
After umout we may race with system udevd rule - so
just retry once again after 1s sleep - that should be
enough - otherwise we would need some loop here...
2023-10-04 22:05:22 +02:00
Zdenek Kabelac
e72e130e9d tests: convert to heredoc string
Multi-line echo command are problemat across variety of bash version
and may have produce shorter results.
Convert to stable heredoc string with 'tab' skipping <<- for better
formating.
2023-10-04 22:05:22 +02:00
Zdenek Kabelac
4edaa9fdf5 filters: leave device_id_sysfs_dir only for device_id
Do not use filters for sysfs with device_id.
2023-10-04 22:03:56 +02:00
Zdenek Kabelac
8f61a127b5 tests: fix reader for runner
Since we now push more data into journal, parser reading this file
for --continue mode need to be adapted.
Also properly align batch mode with '.' for max test length name.
2023-10-03 21:32:12 +02:00