]> sourceware.org Git - lvm2.git/log
lvm2.git
5 months agotests: use non inlined copy constructor 1244309461
Zdenek Kabelac [Mon, 8 Apr 2024 12:31:22 +0000 (14:31 +0200)]
tests: use non inlined copy constructor

gcc would like to see code without trying to inline large
copy constructor used for std::vector

5 months agomakefiles: avoid using # with awk
Zdenek Kabelac [Mon, 8 Apr 2024 11:31:24 +0000 (13:31 +0200)]
makefiles: avoid using # with awk

Also awk got annoyed by this \# char sequence which is reported
as incorrect, however older rpm builder were failing without this.
So let's just try other variant.

5 months agomakefiles: use SHOW
Zdenek Kabelac [Mon, 8 Apr 2024 11:10:16 +0000 (13:10 +0200)]
makefiles: use SHOW

5 months agogcc: clear some complains
Zdenek Kabelac [Mon, 8 Apr 2024 12:10:18 +0000 (14:10 +0200)]
gcc: clear some complains

Use dm_strncpy() were possible to get rid of gcc compile warnings.

5 months agoWHATS_NEW: update 1243468645
Zdenek Kabelac [Sun, 7 Apr 2024 12:25:37 +0000 (14:25 +0200)]
WHATS_NEW: update

5 months agotests: add sleep
Zdenek Kabelac [Sun, 7 Apr 2024 17:58:30 +0000 (19:58 +0200)]
tests: add sleep

mdadm may eventually be too slow...

5 months agopools: no checking for lv/vgremove deactivation
Zdenek Kabelac [Sun, 7 Apr 2024 11:01:26 +0000 (13:01 +0200)]
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.

5 months agothin-pool: avoid reactivation on new thin-pool
Zdenek Kabelac [Sun, 7 Apr 2024 10:58:34 +0000 (12:58 +0200)]
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.

5 months agovdo: modprobe dm-vdo for kernels >= 6.9
Zdenek Kabelac [Sun, 7 Apr 2024 10:56:33 +0000 (12:56 +0200)]
vdo: modprobe dm-vdo for kernels >= 6.9

Modprobe "dm-vdo" with new kernels >= 6.9 and go for
'kvdo' with older Linux kernels.

5 months agoWHATS_NEW: update 1241623823
Zdenek Kabelac [Fri, 5 Apr 2024 12:30:25 +0000 (14:30 +0200)]
WHATS_NEW: update

5 months agotests: skip convertions tests for usptream driver
Zdenek Kabelac [Fri, 5 Apr 2024 12:25:27 +0000 (14:25 +0200)]
tests: skip convertions tests for usptream driver

5 months agotests: add correct condition for skip of lvmpolld tests
Zdenek Kabelac [Fri, 5 Apr 2024 11:17:13 +0000 (13:17 +0200)]
tests: add correct condition for skip of lvmpolld tests

Check when flavour want to test  lvmlockd & lvmpolld tests and
in for case ignore SKIP_WITH_LVMPOLLD from test script.

5 months agovdo: use stats msg parser for also segment status
Zdenek Kabelac [Fri, 5 Apr 2024 12:00:11 +0000 (14:00 +0200)]
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.

5 months agovdo: fix status message parsing
Zdenek Kabelac [Fri, 5 Apr 2024 11:09:10 +0000 (13:09 +0200)]
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.

5 months agotests: updated check for dm-vdo module 1240557337
Zdenek Kabelac [Thu, 4 Apr 2024 17:30:38 +0000 (19:30 +0200)]
tests: updated check for dm-vdo module

With new kernels dm-vdo is now correct name,
so use standard loading and just try extra for kvdo.

5 months agotests: inittest fix skipping condition
Zdenek Kabelac [Thu, 4 Apr 2024 14:50:18 +0000 (16:50 +0200)]
tests: inittest fix skipping condition

5 months agodev_manager: improve readability
Zdenek Kabelac [Wed, 3 Apr 2024 23:29:30 +0000 (01:29 +0200)]
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.

5 months agodevice_id: add comment for trim
Zdenek Kabelac [Wed, 3 Apr 2024 22:09:29 +0000 (00:09 +0200)]
device_id: add comment for trim

5 months agolvmlocks: rework dm_strncpy
Zdenek Kabelac [Wed, 3 Apr 2024 19:01:40 +0000 (21:01 +0200)]
lvmlocks: rework dm_strncpy

Fix cutting away 1 character via incorrect usage of dm_strncpy
introduced in last batch of commits and use sizeof(buffer) to
get proper sizes.

In case of use strcpy_name_len() the replacement was invalid,
so we need to restore this case since sanlock uses buffer without
nul ending, so we would strip one more character from the buffer.

Also start to use dm_strncpy() without (void) for unchecked usage.

5 months agorefactor: update dm_strncpy to _dm_strncpy
Zdenek Kabelac [Thu, 4 Apr 2024 16:42:24 +0000 (18:42 +0200)]
refactor: update dm_strncpy to _dm_strncpy

For checked versions of dm_strncpy use inline wrapper _dm_strncpy.

5 months agorefactor: remove (void) from dm_strncpy usage
Zdenek Kabelac [Thu, 4 Apr 2024 15:03:30 +0000 (17:03 +0200)]
refactor: remove (void) from dm_strncpy usage

Start to use dm_strncpy() as unchecked version within source tree.

5 months agoutil: add _dm_strncpy
Zdenek Kabelac [Thu, 4 Apr 2024 16:41:42 +0000 (18:41 +0200)]
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.

5 months agoutil: swap header file load order
Zdenek Kabelac [Thu, 4 Apr 2024 15:54:52 +0000 (17:54 +0200)]
util: swap header file load order

Ensure libdevmapper is included before util.h since
we are going to add function that is using it.
TODO: maybe add include directly here...

5 months agocov: missing initializer
Zdenek Kabelac [Wed, 3 Apr 2024 21:59:21 +0000 (23:59 +0200)]
cov: missing initializer

Ensure there is no code path with uninitialized takes_arg.

5 months agolvmcache: free list of add_cache_devs 1239157642
David Teigland [Wed, 3 Apr 2024 20:59:25 +0000 (15:59 -0500)]
lvmcache: free list of add_cache_devs

5 months agolvmdevices: fix memleak of use_old du 1239064243
David Teigland [Wed, 3 Apr 2024 20:29:17 +0000 (15:29 -0500)]
lvmdevices: fix memleak of use_old du

missed in the the prev done_old commit

5 months agocleanup: remove lvmcache_has_bad_metadata 1233750082
Zdenek Kabelac [Fri, 29 Mar 2024 14:42:38 +0000 (15:42 +0100)]
cleanup: remove lvmcache_has_bad_metadata

5 months agocleanup: drop unused code
Zdenek Kabelac [Fri, 29 Mar 2024 23:08:47 +0000 (00:08 +0100)]
cleanup: drop unused code

5 months agofiltes: remove lvmetad bits from usable filter
Zdenek Kabelac [Fri, 29 Mar 2024 14:58:51 +0000 (15:58 +0100)]
filtes: remove lvmetad bits from usable filter

Eliminate some dead code from usable filter, that is no longer usable
after removal of lvmetad.

5 months agodevice_id: simplier loop control
Zdenek Kabelac [Fri, 29 Mar 2024 21:44:21 +0000 (22:44 +0100)]
device_id: simplier loop control

5 months agodevice_id: use dm_strncpy
Zdenek Kabelac [Fri, 29 Mar 2024 21:43:48 +0000 (22:43 +0100)]
device_id: use dm_strncpy

Simplify code.

5 months agodeviced_id: use zalloc
Zdenek Kabelac [Fri, 29 Mar 2024 21:43:06 +0000 (22:43 +0100)]
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.

5 months agofilter: zero internal structure
Zdenek Kabelac [Fri, 29 Mar 2024 20:27:06 +0000 (21:27 +0100)]
filter: zero internal structure

Valgrind noticed access to unitialized warned_filter.

5 months agolvmdevices: fix memleak of done_old du
Zdenek Kabelac [Fri, 29 Mar 2024 21:44:48 +0000 (22:44 +0100)]
lvmdevices: fix memleak of done_old du

'done_old' list missed released.

5 months agocov: cast to uint32 1233259584
Zdenek Kabelac [Thu, 28 Mar 2024 23:32:37 +0000 (00:32 +0100)]
cov: cast to uint32

5 months agocov: validate count is bigger then 0
Zdenek Kabelac [Thu, 28 Mar 2024 23:07:38 +0000 (00:07 +0100)]
cov: validate count is bigger then 0

To avoid teoretical underflow...

5 months agotests: better constructor
Zdenek Kabelac [Thu, 28 Mar 2024 23:07:13 +0000 (00:07 +0100)]
tests: better constructor

5 months agocov: validate major and minor
Zdenek Kabelac [Thu, 28 Mar 2024 22:37:51 +0000 (23:37 +0100)]
cov: validate major and minor

Check  major and minor is >= 0.

5 months agocov: store 64b flags
Zdenek Kabelac [Thu, 28 Mar 2024 22:21:46 +0000 (23:21 +0100)]
cov: store 64b flags

Alhtough no target is currently using that many bits for their flags,
preserve the size for loaded segment internally.

5 months agocov: validate i before underflow
Zdenek Kabelac [Thu, 28 Mar 2024 22:14:29 +0000 (23:14 +0100)]
cov: validate i before underflow

Although it can't happen in this code, ensure 'i' is not 0
before decrementing it.

5 months agocov: remove unnecessary sanity check
Zdenek Kabelac [Thu, 28 Mar 2024 21:43:16 +0000 (22:43 +0100)]
cov: remove unnecessary sanity check

This sanity check actually confused in some way Coverity
giving it some assumption about array access.

Since these two checks basically validated compiler's capability
to add and then substract the number from char pointer we likely
don't really need them - as if this base math would not work,
compiler would be having far more troubles...

So drop them - and get rid of report:
Event overrun-call: Overrunning callee's array of size 513 by...

5 months agocov: use dm_strncpy
Zdenek Kabelac [Thu, 28 Mar 2024 21:08:41 +0000 (22:08 +0100)]
cov: use dm_strncpy

Use better variant.

5 months agocov: no overwrite of const qualified fields
Zdenek Kabelac [Thu, 28 Mar 2024 20:33:53 +0000 (21:33 +0100)]
cov: no overwrite of const qualified fields

5 months agocov: reset FILE on error path
Zdenek Kabelac [Thu, 28 Mar 2024 20:15:38 +0000 (21:15 +0100)]
cov: reset FILE on error path

Although fclose() fails - we should not be retrying with
already released stucture.

5 months agotests: lvmdbusest.py faster test_z_sigint 1232333565
Tony Asleson [Wed, 27 Mar 2024 17:26:19 +0000 (12:26 -0500)]
tests: lvmdbusest.py faster test_z_sigint

Reduce #lv and intervals.

We are trying to ensure that the daemon stops while it's busy processing
its internal queues.  Decrease the number of LVs and intervals to allow
this test to complete in less time.

5 months agotests: lvmdbustest.py skip if g_tmo != 0
Tony Asleson [Wed, 27 Mar 2024 16:50:24 +0000 (11:50 -0500)]
tests: lvmdbustest.py skip if g_tmo != 0

This test doesn't have any additional value when running when g_tmo != 0.

5 months agolvmdbusd: Exit faster
Tony Asleson [Wed, 27 Mar 2024 16:49:05 +0000 (11:49 -0500)]
lvmdbusd: Exit faster

Add a global timeout value to be used for the threads to end waiting for
whatever it is they are blocked on.  The values varied from 2-5 seconds,
which is way longer than needed.  Value of 0.5 shows no CPU load when
service is running and is idle.

5 months agocleanup: drop unused code
Zdenek Kabelac [Wed, 27 Mar 2024 14:02:25 +0000 (15:02 +0100)]
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.

5 months agodebug: update some structure members
Zdenek Kabelac [Thu, 28 Mar 2024 16:19:44 +0000 (17:19 +0100)]
debug: update some structure members

Makes pahole output look slightly better.

5 months agocommands: reduce command structure size more
Zdenek Kabelac [Thu, 28 Mar 2024 16:04:37 +0000 (17:04 +0100)]
commands: reduce command structure size more

Check for internal limits, if they would ever need to be raised report
error message and fail parsing.

5 months agocov: ensure buffer always ends with nul
Zdenek Kabelac [Thu, 28 Mar 2024 15:36:25 +0000 (16:36 +0100)]
cov: ensure buffer always ends with nul

When we print anything out of buffer, ensure there is \0.

5 months agocov: ensure nul ends string
Zdenek Kabelac [Thu, 28 Mar 2024 15:34:37 +0000 (16:34 +0100)]
cov: ensure nul ends string

5 months agotests: skip some mirror tests for polld and lockd 1228950791
Zdenek Kabelac [Wed, 27 Mar 2024 00:25:45 +0000 (01:25 +0100)]
tests: skip some mirror tests for polld and lockd

Leave just lvconvert-mirror-basic-1 test
for polld and lockd testing.

5 months agogcc: use uint16_t for counters
Zdenek Kabelac [Wed, 27 Mar 2024 00:03:08 +0000 (01:03 +0100)]
gcc: use uint16_t for counters

5 months agogcc: move declaration into ifdef
Zdenek Kabelac [Tue, 26 Mar 2024 23:46:17 +0000 (00:46 +0100)]
gcc: move declaration into ifdef

Prevent unused warning when the ifdef code is not compiled.

5 months agogcc: match signed integers
Zdenek Kabelac [Tue, 26 Mar 2024 23:36:33 +0000 (00:36 +0100)]
gcc: match signed integers

5 months agoconfigure: lcov needs -fprofile-update=atomic
Zdenek Kabelac [Tue, 26 Mar 2024 23:19:52 +0000 (00:19 +0100)]
configure: lcov needs -fprofile-update=atomic

To avoid negative counters.
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080

5 months agodevice_id: use dm_basename
Zdenek Kabelac [Tue, 26 Mar 2024 23:28:14 +0000 (00:28 +0100)]
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>
5 months agodmsetup: refactor getopt_long usage
Zdenek Kabelac [Mon, 25 Mar 2024 18:20:55 +0000 (19:20 +0100)]
dmsetup: refactor getopt_long usage

Shuffle code to avoid using static variable to pass parsed option.
Code is now easier to follow and also number of coverity reports
will go away.
There should be no functional change.

5 months agotests: missed reduction of raid check 1226786187
Zdenek Kabelac [Mon, 25 Mar 2024 16:17:40 +0000 (17:17 +0100)]
tests: missed reduction of raid check

5 months agocov: use proper enum value
Zdenek Kabelac [Mon, 25 Mar 2024 16:17:24 +0000 (17:17 +0100)]
cov: use proper enum value

5 months agocov: ensure namelist is defined
Zdenek Kabelac [Mon, 25 Mar 2024 16:16:00 +0000 (17:16 +0100)]
cov: ensure namelist is defined

Seems coverity doesn't have good model for scandir.
Let's ensure pointer is seen as defined.

5 months agocov: validate return from display_lvname
Zdenek Kabelac [Mon, 25 Mar 2024 15:59:27 +0000 (16:59 +0100)]
cov: validate return from display_lvname

Ensure strdup will not get NULL.

5 months agocov: validate origin pointer
Zdenek Kabelac [Mon, 25 Mar 2024 15:57:53 +0000 (16:57 +0100)]
cov: validate origin pointer

Add internal error for NULL origin here.

5 months agocov: drop some unneeded continue
Zdenek Kabelac [Mon, 25 Mar 2024 15:54:11 +0000 (16:54 +0100)]
cov: drop some unneeded continue

5 months agocov: check for syscall resuls
Zdenek Kabelac [Mon, 25 Mar 2024 15:38:52 +0000 (16:38 +0100)]
cov: check for syscall resuls

5 months agocov: ensure buffer is nul ended
Zdenek Kabelac [Mon, 25 Mar 2024 15:37:04 +0000 (16:37 +0100)]
cov: ensure buffer is nul ended

Use dm_strncpy() to ensure ending nul.

5 months agotests: fix improper merge within last update 1226526725
Zdenek Kabelac [Mon, 25 Mar 2024 14:01:48 +0000 (15:01 +0100)]
tests: fix improper merge within last update

5 months agomakefiles: ignore negative errors for lcov 1226500360
Zdenek Kabelac [Mon, 25 Mar 2024 13:34:39 +0000 (14:34 +0100)]
makefiles: ignore negative errors for lcov

5 months agotests: check for raid shrink support
Zdenek Kabelac [Mon, 25 Mar 2024 12:18:20 +0000 (13:18 +0100)]
tests: check for raid shrink support

Shrink of raid LVs supported from 1.9

5 months agocov: check for to_dlm_mode return value
Zdenek Kabelac [Mon, 25 Mar 2024 13:33:40 +0000 (14:33 +0100)]
cov: check for to_dlm_mode return value

Avoid processing invalid to_dlm_mode in lm_convert_dlm.

5 months agocov: check for strftime result
Zdenek Kabelac [Mon, 25 Mar 2024 12:20:54 +0000 (13:20 +0100)]
cov: check for strftime result

5 months agodevices_id: add some syscall checks
Zdenek Kabelac [Mon, 25 Mar 2024 12:17:42 +0000 (13:17 +0100)]
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.

5 months agogcc: ensure num has always initilized value
Zdenek Kabelac [Mon, 25 Mar 2024 10:44:36 +0000 (11:44 +0100)]
gcc: ensure num has always initilized value

5 months agocov: ensure string ends with \0 1226230192
Zdenek Kabelac [Sun, 24 Mar 2024 23:53:02 +0000 (00:53 +0100)]
cov: ensure string ends with \0

Use dm_strncpy() that ensures \0 termination.

5 months agocov: fix incorrect error check
Zdenek Kabelac [Sun, 24 Mar 2024 23:49:51 +0000 (00:49 +0100)]
cov: fix incorrect error check

Check for NULL pointer.
Fix missing release on error path.
Also dir_fd might be just != -1.

5 months agotests: update lvconvert-raid.sh
Zdenek Kabelac [Sun, 24 Mar 2024 22:06:34 +0000 (23:06 +0100)]
tests: update lvconvert-raid.sh

Handle case of removal of orig leg while it's being synchronized.

5 months agotests: update raid_leg_status check
Zdenek Kabelac [Sun, 24 Mar 2024 21:42:48 +0000 (22:42 +0100)]
tests: update raid_leg_status check

Do not wait for progres (non zero processed amount of blocks),
when the raid status already reported 'resync' or 'recover'.

5 months agotests: aux avoid discarding created loop devices
Zdenek Kabelac [Sun, 24 Mar 2024 18:23:29 +0000 (19:23 +0100)]
tests: aux avoid discarding created loop devices

Usually it's not a big deal, but couple test creates
large devices and here discard operation just excersice
CPU and consumes time.

5 months agotests: reduction needs to ignore fs
Zdenek Kabelac [Sun, 24 Mar 2024 18:22:48 +0000 (19:22 +0100)]
tests: reduction needs to ignore fs

Drop 'should' usage and use  --fs ignore when reducing raid LV.

5 months agotests: update extend of raid
Zdenek Kabelac [Sat, 23 Mar 2024 23:06:32 +0000 (00:06 +0100)]
tests: update extend of raid

Here we actually need to slowdown only $dev2 - since repair operation
is only reading data from this device and compares it with origin $dev1,
and if they match there is no write...

5 months agocommands: refactor memset
Zdenek Kabelac [Sun, 24 Mar 2024 21:44:53 +0000 (22:44 +0100)]
commands: refactor memset

Move memset() to the initialization function define_commands().

There is also not much point in clearing memory on command's exit
so drop zeroing of ~2M of RAM.

5 months agocommands: reduce structure sizes
Zdenek Kabelac [Sun, 24 Mar 2024 21:46:35 +0000 (22:46 +0100)]
commands: reduce structure sizes

Reduce slightly RAM usage of running lvm2 and use smaller fields
to count small numbers.

5 months agocommands: use nul for EOL for compiled-in buffer
Zdenek Kabelac [Sat, 23 Mar 2024 23:06:45 +0000 (00:06 +0100)]
commands: use nul for EOL for compiled-in buffer

Use \0 as EOL in compiled-in syntax description to avoid
unnecessary line copy that just replaced \n with \0.
Also use already splitted lines when possible.

5 months agoreporting: reuse existing _get_field
Zdenek Kabelac [Sun, 24 Mar 2024 13:16:18 +0000 (14:16 +0100)]
reporting: reuse existing _get_field

Use already existing _get_field() function that also
slightly optimizes 'strlen()' usage.

5 months agodev-cache: change locales just once
Zdenek Kabelac [Sat, 23 Mar 2024 23:05:57 +0000 (00:05 +0100)]
dev-cache: change locales just once

5 months agoraid: update dm_get_status_raid
Zdenek Kabelac [Sun, 24 Mar 2024 21:42:16 +0000 (22:42 +0100)]
raid: update dm_get_status_raid

Handle mismatch of reported 'dm raid' status, where the active
raid LV can be actually showing higher numebr of raid leg devices,
that the number of shown status characters.

This can happen if the raid leg is dropped during initial
resynchronization.

5 months agoudev: create /dev/disk/by-label symlinks for DM devs that have crypto as next layer 1226149768
Peter Rajnoha [Mon, 25 Mar 2024 09:16:04 +0000 (10:16 +0100)]
udev: create /dev/disk/by-label symlinks for DM devs that have crypto as next layer

We already create /dev/disk/by-uuid symlinks for DM devices which
contain crypto-type as next layer (as identified by blkid).

Also create /dev/disk/by-label symlinks as the labels can be
defined for crypto-type devices too.

Reported and fix suggested by: Patrick Plenefisch <simonpatp@gmail.com>
See also:
https://lore.kernel.org/lvm-devel/CAOCpoWfYjOVNJNt+cnOVXDHiDq2wRogTqBijcUoa7chqOLRa5Q@mail.gmail.com/

5 months agoWHATS_NEW: update 1226042252
Peter Rajnoha [Mon, 25 Mar 2024 08:14:57 +0000 (09:14 +0100)]
WHATS_NEW: update

Commits 48188d7181f735d816e0dac73a7a121ecc667f9b and eb4f744820832aff3d6da1bba14f12e91a5b3535

5 months agoUpstream db_persist udev rule from dracut 5/head 1226030064
Daan De Meyer [Wed, 29 Nov 2023 08:09:57 +0000 (09:09 +0100)]
Upstream db_persist udev rule from dracut

Setting db_persist is required for dm devices so that their properties
are carried over on switch-root from the initrd to the rootfs. This
logic has always lived in dracut
(https://github.com/dracutdevs/dracut/blob/master/modules.d/90dm/11-dm.rules).
However, this means that other initramfs generators each have to
implement and maintain the same rule which leads to unnecessary
duplication.

Instead, let's make the rule part of the upstream lvm rules, which
will ensure that generated initramfses will just work if they make
sure the lvm udev rules are installed, without having to figure out
that they have to add an extra rule themselves on top.

Identical rule in Arch Linux's lvm2 package: https://gitlab.archlinux.org/archlinux/packaging/packages/lvm2/-/blob/main/11-dm-initramfs.rules?ref_type=heads

5 months agoudev: change action check from ACTION!="add|change" to ACTION=="remove" 10/head 1226019017
Peter Rajnoha [Thu, 7 Mar 2024 08:48:49 +0000 (09:48 +0100)]
udev: change action check from ACTION!="add|change" to ACTION=="remove"

For DM devices, the add/change/remove can appear as action for genuine
udev events.

However, there are more action types (bind, unbind, move, online, offline)
which never appear as actions for genuine DM udev events, but they can
still be synthesized (e.g. by writing "<action>" to "/sys/.../uevent" file
or by calling "udevadm trigger --action=<action>").

Let's also process these extra action types so that the udev-related content
is not lost completely, keeping all the symlinks and udev db entries just like
this was a synthetic udev event with "change" action.

Related to https://gitlab.com/lvmteam/lvm2/-/issues/4.

5 months agoWHATS_NEW: update 1226016238
Peter Rajnoha [Mon, 25 Mar 2024 07:50:37 +0000 (08:50 +0100)]
WHATS_NEW: update

Commits 6f44e1093c4a06214831d439c5db9e885b70f072 .. 038f9254d9554654197b59c160e3f775af27cdb1

5 months ago10-dm.rules: bump DM_UDEV_RULES_VSN to 3 9/head 1226000665
Martin Wilck [Fri, 1 Mar 2024 14:26:59 +0000 (15:26 +0100)]
10-dm.rules: bump DM_UDEV_RULES_VSN to 3

Bump the rules version in order to indicate that upper level rules
should consume DM_UDEV_DISABLE_OTHER_RULES_FLAG rather than DM_NOSCAN
and DM_SUSPENDED.

Also update the comments at the top of the file that describe the
exported properties, and add a note about internal device-mapper
properties.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months agodm udev rules: don't export and save DM_NOSCAN
Martin Wilck [Fri, 1 Mar 2024 22:18:26 +0000 (23:18 +0100)]
dm udev rules: don't export and save DM_NOSCAN

DM_NOSCAN is not an official API any more and doesn't have to be
restored from the udev db. Rename it to .DM_NOSCAN.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months agodm udev rules: don't export and save DM_SUSPENDED
Martin Wilck [Fri, 1 Mar 2024 14:16:33 +0000 (15:16 +0100)]
dm udev rules: don't export and save DM_SUSPENDED

DM_SUSPENDED is a device-mapper internal flag, which is not intended to be
used by other rules, and which is determined by 10-dm.rules from sysfs for
every uevent. Rename it to ".DM_SUSPENDED", so that it won't be saved in the
udev database.

Known consumers of DM_SUSPENDED are 66-kpartx.rules (from multipath-tools) and
99-systemd.rules (from systemd). These will have to be adapted.
11-dm-mpath.rules will be changed to use .DM_SUSPENDED.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months ago11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db
Martin Wilck [Fri, 1 Mar 2024 13:45:32 +0000 (14:45 +0100)]
11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db

DM_UDEV_DISABLE_OTHER_RULES_FLAG is used as the "output" flag of the
device-mapper rules, to be consumed by non-dm rules. It is a logical OR of
several conditions that might make dm devices inaccessible. 10-dm.rules
calculates it for every uevent, whether it's genuine or spurious.

DM_SUBSYSTEM_UDEV_FLAG0 is just another flag that needs to be or'd in. We
don't need to restore the previous state of DM_UDEV_DISABLE_OTHER_RULES_FLAG.
Actually, doing so is wrong if the flag has previously been set because the
device was suspended, and the device isn't suspended anymore.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months ago10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db
Martin Wilck [Fri, 1 Mar 2024 11:43:36 +0000 (12:43 +0100)]
10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db

We use DM_UDEV_DISABLE_OTHER_RULES_FLAG to tell upper non-DM layers
to keep their hands off the device in question, for any reason.
One possible reason is that the device is supended; another is that
the cookie carries the flag of the same name.

DM_SUSPENDED is not restored from the db, but evaluated anew for every
uevent. Therefore DM_UDEV_DISABLE_OTHER_RULES_FLAG shouldn't be
restored, either. Use a new variable DM_COOKIE_DISABLE_OTHER_RULES_FLAG
to save and restore the original value from the cookie.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months ago10-dm.rules: test DISK_RO after importing properties
Martin Wilck [Tue, 5 Mar 2024 11:22:40 +0000 (12:22 +0100)]
10-dm.rules: test DISK_RO after importing properties

DISK_RO is set in the environment of a block-device uevent if and only if
the read-only (ro) attribute of the device just changed (the kernel
function set_disk_ro() was called). It is not synoymous with the "ro" sysfs
attribute; the device could very well be write-protected if DISK_RO is not
set. Device mapper-level probing is possible for DISK_RO events, but it makes
little sense, because the device propreties haven't changed as far as dm is
concerned. But we should import possible previously set device properties
to avoid confusing follow-up rules. We should do this for both DISK_RO=1
and DISK_RO=0 events.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months ago13-dm-disk.rules: import ID_FS_TYPE
Martin Wilck [Fri, 1 Mar 2024 18:41:41 +0000 (19:41 +0100)]
13-dm-disk.rules: import ID_FS_TYPE

ID_FS_TYPE is the most important udev property for most follow-up
rules. It must be imported from the udev db if blkid can't be run.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Peter Rajnoha <prajnoha@redhat.com>
5 months agoWHATS_NEW: update 1223125248
Zdenek Kabelac [Thu, 21 Mar 2024 21:33:30 +0000 (22:33 +0100)]
WHATS_NEW: update

This page took 0.076532 seconds and 5 git commands to generate.