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

18962 Commits

Author SHA1 Message Date
Zdenek Kabelac
a985d5c63d dev_manager: fix table for cache with cachevol
When using cached LV with cachevols (so not with cachepool),
the loaded table could have been using more then one mapping line
for sub devices - resulting into data corruption in some cases
when i.e. taking snapshot of such cached LV with and instead of
single line - 2 lines were generated into DM table as the code
skipped protection again repeated addition.

vg-fast_cvol-cdata: 0 16384 linear 253:2 16384
vg-fast_cvol-cdata: 16384 16384 linear 253:2 16384

New code is also refactoring to use _add_new_cvol_subdev_to_dtree
(similar _add_cvol_subdev.. ) and also the addition of subdev has
been moved after check for already processed node.
Also the cachevol sub devices are now added with the insertion
of cachevol with cached LV.
2024-03-21 22:35:47 +01:00
Zdenek Kabelac
ad582da3ca dev_manager: relocate code
Use better place to search for cvol subdev mappings.
Add them with cachevol that is used for cache LV.
2024-03-21 22:35:47 +01:00
Zdenek Kabelac
abc1b44d8d dev_manager: refactor
Use struct initilizer to setup lvid.
2024-03-21 22:35:47 +01:00
Zdenek Kabelac
9718fd2496 debug: print names of tracked LVs
Debug was printing passed in LV name, but it's more usable to see
names of LVs 'tracked' for removal.
2024-03-21 22:35:47 +01:00
David Teigland
1658776aaf man: lvm.conf mention missing array brackets 2024-03-21 09:16:41 -05:00
David Teigland
2fc66d2835 lvconvert: fix displayed lv name in convert to snapshot 2024-03-20 09:13:31 -05:00
Zdenek Kabelac
4efe8e83cf tests: add more sleep time
Give some more waiting time to testing loop.
2024-03-20 11:19:26 +01:00
Zdenek Kabelac
4b1664236b cmdline: some simple optimization
Some cheap parser init speedups cutting away some cpu cycles...
Use cheaper tests in if ( && )
Avoid unnecessary strchr calls.
2024-03-20 11:18:04 +01:00
Zdenek Kabelac
f93446486e makefiles: add missing cleanup targer 2024-03-19 20:08:01 +01:00
Zdenek Kabelac
d0c83d4680 WHATS_NEW: update 2024-03-17 13:31:57 +01:00
Zdenek Kabelac
7084b17c95 make: generate 2024-03-17 13:31:57 +01:00
Zdenek Kabelac
9c9c37aa11 tests: external origin chaining
Add tests for stacked usage of external origins.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
901becc748 man: lvmthin update for external origin usage
Document usage of chaining external origins as it is now possibly to
create thinA LV in poolA which use thinB LV in poolB as it external
origin and user could create chain of such LV.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
68fdae1184 debug: enhace device_mapper debug log for dm tree 2024-03-17 13:17:53 +01:00
Zdenek Kabelac
8c7400121e debug: trace when ignoring origin_only suspend
Add log debug message when origin_only suspend would be ignored.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
3b9787d4ee lvconvert: enhance external origin conversion 2024-03-17 13:17:53 +01:00
Zdenek Kabelac
7ae9662b4e lv: swap more lv properties
When using swap_lv_identifiers() we were basiclly exchanging 'names'
and only according to the caller some more data were 'transfered'.

However in most cases we should swap properties like 'hostname' as
the creation information should be preserved.

So let's do the function more universal.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
457bd1392a thin: support chaining of external origins
Improve support for building DM tree when there is a chain
of external origins used for LV.

For this we cannot use track_external_lv_deps as this works
only for LV with just one external origin in its device tree.

Instead add directly 'dev' to the instead of add whole LV.
This avoid possibly recurive endless loop, however we may eventally
have some problems with undiscovered/missing devices in DM tree.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
a0776fe409 thin: remove stack external origins
Ensure external origin is deactivated during removal.
Only unused external origins can be deactivated.
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
3bd9f936da thin: delayed resume for LV conversion
When we have some existing LV and this LV is being converted to
external origin - during the DM table manipulation there is a short
moment when the LV is being 'resumed' as 'read-only' volume
while still being live as 'rw' volume i.e. we could have had
a single thin LV active twice.

To avoid such weird scenarios of dual access to a same volume, we
just postpone a resume until a moment, where the existing volume
is already suspended thus no I/O can be in flight to such device.

Note: however there is slight catch - that we now have basically
a different 'risk' case where a resume of such i.e. new external
origin LV might fail and we are already in suspend tree state -
resolving error path in this situation is untrivial as well...
2024-03-17 13:17:53 +01:00
Zdenek Kabelac
386f0bfb4f thin: lock fs when converting to external origin
Ensure suspend is locking fs, when converting LV to external origin.
2024-03-17 13:16:35 +01:00
Zdenek Kabelac
edc91caffb thin: external origins across thin-pool
Fix/support creation and usage of the external origin
across thin-pools - so thin LV can use thin LV from
some other thin-pool as external origin (read-only).
2024-03-16 10:40:54 +01:00
Zdenek Kabelac
27bdd038a8 thin: validate usable volume for external origin
When creating external origin via 'lvcreate --type thin'
add the validation for LV being usable as external origin
since certain LVs cannot be really used this way.
Also call this function early during lvcreate cmdline arg
validation se we do not need to do unecesary operation.
2024-03-16 10:40:54 +01:00
Zdenek Kabelac
9e2870cc9f activation: reduce table preloading
Over the time the code for preloading detached LVs got unnecessarily
complicate. But actually we need to preload only LVs that
were previously non-toplevel (invisible) LVs and became visible
toplevel LVs in the precommitted metadata.

If there would be needed some other rule, it would likely be a bug in
conversion code forgetting to set visibility flag on detached LV.

This reduces number of unnecessary repeated DM tree preloading.
2024-03-16 10:34:31 +01:00
Zdenek Kabelac
d356561465 makefiles: correct install srcdir
When building in other dir, ensure srcdir is used to find helper
script (via vpath) through  $< usage.

Add also missing [INSTALL] prints for some installed files.
2024-03-16 10:31:31 +01:00
Zdenek Kabelac
9d145c17c3 snapshots: avoid monitoring of inactive origins
External origins for thin volumes can be also used at the same time
as old(thick) snapshot origins. However in this case it's possible
the LV is only active as being 'external' origin, but old snapshot LVs
are not active. For this case before handling these
LVs for un/monitoring check the active state of origin LV.

This should prevent warnings of monitoring failures.
2024-03-16 10:23:55 +01:00
David Teigland
d1aacae0f7 lvm.conf: update scan_lvs description
to better reflect the devices file existence, and
to mention layered autoactivation in lvm udev rules.
2024-02-21 11:08:02 -06:00
Zdenek Kabelac
e53703b88a make: generate 2024-02-19 14:26:40 +01:00
Zdenek Kabelac
66be32fbc1 cleanup: remove unused code 2024-02-19 14:20:39 +01:00
Zdenek Kabelac
4f936f2312 devices: refactor recursive dir create
Make recursive directory path creation reusable via
dir_create_recursive.

While we already have dm_create_dir() - it's not taking mode arg,
so let's make lvm's internal file helper function.
2024-02-19 14:20:39 +01:00
Zdenek Kabelac
c534cf3bca label: simplify code 2024-02-19 14:20:39 +01:00
Zdenek Kabelac
d486b379d0 bcache: remove duplicate _wait_all call
Since the  bcache_flush() is supposed to already use _wait_all()
remove duplicated invoce of this function.
2024-02-19 14:20:39 +01:00
Zdenek Kabelac
d19235993e cache: check module in modules builtin
Instead of parsing the whole /proc/kallsyms use faster variant
of using modprobe tool logic.

lvm2 here wants to know whether the particular DM cache policy is
present in the kernel - however since the cache policy does not have
any kernel module parameters and it can be built-in to a kernel
there is no /sys/modules directory in such case and we would need to call
modprobe everytime we want detect such case.

The old solution tried to look for particular kernel symbol
(and like not the right way, as smq_exit might be actually ommitted).

New version checks MODULES_PATH/`uname -r`/modules.builtin for
whether is present cache policy module instead of CPU expensive parsing
of kallsyms.
2024-02-19 14:20:39 +01:00
Zdenek Kabelac
1453ccd5b8 configure: add --with-modulesdir
Add configurable path for directory with kernel modules.
Following patch will use this directory to lookup:
/lib/modules/`uname -r`/modules.builtin
2024-02-19 14:20:39 +01:00
Zdenek Kabelac
55937f9c8e vdo: read VDO stats via dm message
As the sysfs interface is seen somewhat obsolete, swith code
to prefer using DM 'stats' message to get our currently needed
info for VDO pool target.
2024-02-19 14:20:39 +01:00
David Teigland
4f9215e70f devices file: rename unused system.devices
If lvm.conf has use_devicesfile=0 and /etc/lvm/device/system.devices
exists, then rename it to system.devices-unused.YYYYMMDD.HHMMSS.
This prevents an old, incorrect system.devices from being used in
the future if lvm.conf is changed to use_devicesfile=1.
2024-02-15 11:40:37 -06:00
David Teigland
e59027e4f7 devices file: back up each version
Create backup copies of system.devices in /etc/lvm/devices/backup
named system.devices-YYYYMMDD.HHMMSS.NNNN.  NNNN is the version
counter from the file.

Each time that an lvm command writes a new system.devices file,
it also writes the same file in the backup directory.

A new comment line is added to system.devices with HASH=<num>
where <num> is a crc calculated from the uncommented lines in
system.devices.  This lets lvm detect if the file has been
modified outside of lvm itself.

If system.devices is edited directly, the next time a command
reads the file, the crc will not match the HASH value.  The
command will then rewrite system.devices with the correct HASH
value, and create a backup reflecting the edits.

A default limit of 50 backup files is kept, configurable by
lvm.conf devicesfile_backup_limit (set to 0 to disable backups.)
2024-02-15 11:40:37 -06:00
David Teigland
ee73875ff0 udev: ignore LVs containing PVs
If LVM LVs happen to contain PVs, they are passed to the lvm udev
rule for processing, where they should be ignored.  PVs on LVs
most likely belong to VM images, and don't belong to the host
which sees the LV.  It's unsafe for the host to use these PVs.
Without this change, the LV would be processed by pvscan which
would generally ignore it, either because of the devices file,
or because of the default lvm policy to not consider LVs as
potential PVs.  This change makes the udev rule consistent
with that policy and avoids the unnecessary system messages
produced when pvscan ignores the LV.
2024-02-08 14:51:46 -06:00
Andre Klärner
fe822f7043 system_id: explain the reason for choosing appmachineid over machineid
Since understanding the reason for choosing the appmachineid over the
direct use of machineid is not easily found, I extended to help text to
clarify this a bit.
2024-02-05 14:01:22 -06:00
David Teigland
82f187ce88 man: fix typo in -A description 2024-02-05 12:13:44 -06:00
Ranjith ML
1c3ae2b678 archiving: Fix doubled filename in vgcfgrestore 2024-01-24 14:11:19 +01:00
Zdenek Kabelac
5533f034e2 thin_pool: correct refactoring chunk_size
Function to recalc chunk_size according to dev hints needs to be
used after chunk_size is being set to thin pool segment - correct
this ordering mistake introduced in previous refactoring commit.
2024-01-17 17:31:19 +01:00
Zdenek Kabelac
9d9e43b87f vdo: correct vdo header size
Previous patch that introduced support for thinpool with vdo
not correctly handled header size - as this part is not fully usable
yet.  We are going to try to use the 0, but current state of code is not
yet compliant to this logic so keep vdo_header_size during conversion
and alos correctly pass through virtual_extents to vdo formating.
2024-01-17 17:30:10 +01:00
Zdenek Kabelac
c81e204fd0 WHATS_NEW: update 2024-01-10 14:08:19 +01:00
Zdenek Kabelac
cdeb491498 make generate 2024-01-10 14:08:19 +01:00
Zdenek Kabelac
c8f9dd2368 tests: testing creation of compressed thin-pool 2024-01-10 14:02:22 +01:00
Zdenek Kabelac
4ad98540bc lvmcmdline: support --pooldatavdo
Extend definitions for lvcreate & lvconvert to support
new option  --pooldatavdo y|n  with thinpools.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
cd3275ce73 man: document creation of VDO thin-pool
Show some examples how to create and convert thin-pools
with VDO volume for thin-pool data.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
db0de73d6e vdo: support creation of compressed thin-pools
Add code to handle creation of  thin-pool with VDO data backend
which can be seen as compressed deduplicated thin-pool.

To avoid need of changing to many internal APIs, pass the conversion
parameters for create thin-pool data volume via cmd_context.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
6ec2f1f44b vdo: refactor conversion to vdo lv
Introduce struct vdo_convert_params {} to pass-in all the parameters
needed for the conversion of an LV to a vdopool + vdo LV.

Function convert_vdo_lv() is also able to create a new LV and swap
segments, so the passed in LV can be later on use for futher
conversion so this refactoring makes it ready for more enhanced
usage.
2024-01-10 14:02:22 +01:00