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

7380 Commits

Author SHA1 Message Date
Zdenek Kabelac
7ec0f69cd1 toolcontext: introduce var for run in valgrind 2024-05-01 10:54:34 +02:00
Zdenek Kabelac
9162ae0a0a activation: interruptible sleep when talking to dmeventd 2024-05-01 10:54:34 +02:00
Zdenek Kabelac
d2f953c9db command: use const declaration for arrays 2024-04-29 00:13:43 +02:00
Zdenek Kabelac
ecabdf68cf lvconvert: use cmd_context variable
Do not modify flags field from 'strcut command_name' and
instead control this via cmd_context  get_vgname_from_options.

Flag GET_VGNAME_FROM_OPTIONS is currently used only by lvconvert.
2024-04-29 00:13:43 +02:00
Zdenek Kabelac
3fc34ac7ee vdo: fix setting VDO size when stacked
When VDO is used as data LV for thin-pool, we need
to use correct function to propagate this through
the stack of volumes.
2024-04-26 21:37:51 +02:00
David Teigland
21b683614c lvmcache: stop saving duplicate pvs info between scans
In the past it was common for a single command to run
multiple lvmcache_label_scan, and this code was a way
to make each call select the same duplicate pvs.  Now
commands run a single lvmcache_label_scan, so this is
not needed.
2024-04-26 14:13:46 -05:00
Zdenek Kabelac
c6a37ddca4 toolcontext: check runtime valgrind
When reseting stream buffer - check for being run within valgrind
and only in this case skip this code.
Define VALGRIND_POOL was incorrectly used for this logic.
2024-04-25 21:26:01 +02:00
Zdenek Kabelac
ecb8399005 lvm: use configure proc dir in lvm.conf
Update some code parts to use configurer /proc from lvm.conf
(so i.e. our testing can use some fake values)
2024-04-15 13:38:44 +02:00
Zdenek Kabelac
84b084c9b6 configure.ac: define DEFAULT_PROC_DIR in one place
Let's move proc into include/configure.h so this define can
be easily used across the source base.

Configure defines it - but ATM we do not provide any configure
option to change it - there should be no need to ever change it.
2024-04-15 13:38:44 +02:00
David Teigland
f59ec61fa7 lvmcache: fix memleaks on list removal
Free members released from the list.
2024-04-15 12:58:27 +02:00
Zdenek Kabelac
8d1a946a9b tests: update unit-tests
Fix some memleaks.
Drop call of bcache_clear_fd() when bache was not initialized.
2024-04-10 00:04:54 +02:00
Zdenek Kabelac
c5b4574729 cov: use stream ptr in its original form
Let's stop Coverity thinking here we are using freed FILE*
for anything else then comparing numbers.
For this use the original source of old_stream pointer.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
2a8c195360 cov: use dm_strncpy variant 2024-04-10 00:03:09 +02:00
Zdenek Kabelac
3ce83f923d cov: extra pointer validation
Add few more internal errors to enusure there is no use of NULL pointers
along the code path.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
8545621d39 cov: replace strcpy with memcpy
When we know the size we can avoid using strcpy.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
cd9b2b32aa configure: add --with-default-event-activaion=ON
Add new configurable option for building lvm2 with enable/disable
default autoactivation setting.

Might be useful for building i.e. rpms for systems where
this event_activation is not desired.
2024-04-09 17:47:03 +02:00
Zdenek Kabelac
d490572410 gcc: clear some complains
Use dm_strncpy() were possible to get rid of gcc compile warnings.
2024-04-08 14:52:23 +02:00
Zdenek Kabelac
d6df31fba1 pools: no checking for lv/vgremove deactivation
Thin-pool and cache-pool targets got already quite stable so let's try
to remove checking of pools when using lvremove or vgremove commands.

This skips checking pools when they are going to be removed, but it
also when removing thin volume that was the only user of a thin-pool.
In this case thin-pool will be still there and could be activated
again with another thin volume and thin_check will be executed
in this moment. In this case it can delay discovery of metadata damage.
2024-04-07 20:44:28 +02:00
Zdenek Kabelac
2fdf3b137a thin-pool: avoid reactivation on new thin-pool
Shortens processing of 'lvcreate -L -V -T' command and
avoid deactivation and its activation with thin_check of the empty
created thin-pool that will be used for the new thin volume
made with a single lvcreate command.
2024-04-07 20:38:55 +02:00
Zdenek Kabelac
dbc0105e1a vdo: modprobe dm-vdo for kernels >= 6.9
Modprobe "dm-vdo" with new kernels >= 6.9 and go for
'kvdo' with older Linux kernels.
2024-04-07 20:27:39 +02:00
Zdenek Kabelac
dda859027c vdo: use stats msg parser for also segment status
Shuffle code to parsing VDO message also for lvs segment status
so it can report correctly data usage for VDO LVs.

For this change move code and also change its API to use just mempool.

Fixes usage with upstream 6.9 vdo target driver.
2024-04-05 14:14:50 +02:00
Zdenek Kabelac
203c8b3997 vdo: fix status message parsing
When using message API for parsing VDO stats info, 0 was wrongly
used for fallback for trying the old sysfs API.

Switch to use  ULLONG_MAX for values that could not have been obtained
through the message call.

Fixes lvdisplay info for freshly created VDO volume with 0 used data
blocks.
2024-04-05 13:09:10 +02:00
Zdenek Kabelac
50b188eebd dev_manager: improve readability
Make a seperate function to decode which ID should be user
for cvol meta or data volume - also avoids duplication of code.
As a result it's now also easier to see how the lvid is build.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
41f13b2a3b device_id: add comment for trim 2024-04-04 19:38:21 +02:00
Zdenek Kabelac
f9fefaaabe refactor: update dm_strncpy to _dm_strncpy
For checked versions of dm_strncpy use inline wrapper _dm_strncpy.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
995ff58903 refactor: remove (void) from dm_strncpy usage
Start to use dm_strncpy() as unchecked version within source tree.
2024-04-04 19:38:21 +02:00
Zdenek Kabelac
295e632e81 util: add _dm_strncpy
Add internal inline function wrapper for dm_strncpy().
Use it for calls where we test the result.
Avoids emitting warnings in Coverity for unchecked usage.
2024-04-04 19:37:13 +02:00
David Teigland
c78970c0d0 lvmcache: free list of add_cache_devs 2024-04-03 15:59:25 -05:00
Zdenek Kabelac
fb80ed3143 cleanup: remove lvmcache_has_bad_metadata 2024-03-30 00:17:39 +01:00
Zdenek Kabelac
adfa16c899 cleanup: drop unused code 2024-03-30 00:17:39 +01:00
Zdenek Kabelac
d39b47d665 filtes: remove lvmetad bits from usable filter
Eliminate some dead code from usable filter, that is no longer usable
after removal of lvmetad.
2024-03-30 00:17:39 +01:00
Zdenek Kabelac
46ef562c50 device_id: simplier loop control 2024-03-30 00:17:39 +01:00
Zdenek Kabelac
d65a428f2d device_id: use dm_strncpy
Simplify code.
2024-03-30 00:17:39 +01:00
Zdenek Kabelac
b8d5744c6e deviced_id: use zalloc
While moving to dm_strncpy, in this case since pvid is also
passed to crc calc, make sure whole buffer is always initilized.
2024-03-30 00:17:39 +01:00
Zdenek Kabelac
4151df32c1 filter: zero internal structure
Valgrind noticed access to unitialized warned_filter.
2024-03-30 00:17:39 +01:00
Zdenek Kabelac
960df88621 cov: validate i before underflow
Although it can't happen in this code, ensure 'i' is not 0
before decrementing it.
2024-03-29 01:34:22 +01:00
Zdenek Kabelac
7ec7d8cf54 cov: reset FILE on error path
Although fclose() fails - we should not be retrying with
already released stucture.
2024-03-28 21:15:38 +01:00
Zdenek Kabelac
fc477192e5 cleanup: drop unused code
Code was related to long time obsoleted  vgconvert
for lvm1 to lvm2 conversion.
This code likely was missed to be removed.
2024-03-28 18:18:37 +01:00
Zdenek Kabelac
83b726e5dd gcc: move declaration into ifdef
Prevent unused warning when the ifdef code is not compiled.
2024-03-27 01:11:00 +01:00
Zdenek Kabelac
0dbd90d74e gcc: match signed integers 2024-03-27 01:11:00 +01:00
Zdenek Kabelac
f98d2ffe87 device_id: use dm_basename
Avoid problems for other libc like muslc and use dm_basename.

Prototype for basename has been removed from string.h from latest musl [1]
compilers e.g. clang-18 flags the absense of prototype as error. therefore
include libgen.h for providing it.

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Reported-by: Khem Raj <raj.khem@gmail.com>
2024-03-27 00:30:58 +01:00
Zdenek Kabelac
421afd287a cov: ensure namelist is defined
Seems coverity doesn't have good model for scandir.
Let's ensure pointer is seen as defined.
2024-03-25 17:16:00 +01:00
Zdenek Kabelac
ac90ab7736 cov: drop some unneeded continue 2024-03-25 16:54:11 +01:00
Zdenek Kabelac
ae7b59f509 cov: check for syscall resuls 2024-03-25 16:38:52 +01:00
Zdenek Kabelac
b84702349f cov: ensure buffer is nul ended
Use dm_strncpy() to ensure ending nul.
2024-03-25 16:37:04 +01:00
Zdenek Kabelac
46e013988f cov: check for strftime result 2024-03-25 14:45:09 +01:00
Zdenek Kabelac
3b47ce0a37 devices_id: add some syscall checks
Add debug tracing for syscall failures.
Also switch some log_error to log_warn when command does not exit
with 'error' result and only warns user.
Easier error path handling.
Initialize some vars at declaration time.
2024-03-25 14:43:33 +01:00
Zdenek Kabelac
1ba2d40473 gcc: ensure num has always initilized value 2024-03-25 11:44:36 +01:00
Zdenek Kabelac
bca6f58848 cov: ensure string ends with \0
Use dm_strncpy() that ensures \0 termination.
2024-03-25 11:18:29 +01:00
Zdenek Kabelac
835e8f9d7a cov: fix incorrect error check
Check for NULL pointer.
Fix missing release on error path.
Also dir_fd might be just != -1.
2024-03-25 11:18:29 +01:00