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

7338 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
ab3c690077 dev-cache: change locales just once 2024-03-25 11:05:05 +01:00
Zdenek Kabelac
b47b66ebff dev_manager: pending traces only existing LV
Before adding LV to the dtree, check whether it's already
in dtree.
2024-03-21 22:35:47 +01:00
Zdenek Kabelac
622884d67a dev_manager: open_count not needed
We do not need to check for open_count in these _info calls.
2024-03-21 22:35:47 +01:00
Zdenek Kabelac
363e8888ae dev_manager: implement _cached_dm_tree_node 2024-03-21 22:35:47 +01:00
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
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
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
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
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
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
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
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
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
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
Zdenek Kabelac
7544b9fc10 vdo: refactor vdo_params passing
Introduce vdo_convert_params and use vdo_params from this structure
also with lvcreate_params.

Later we will use this for convertion of thin-pool data volume to VDO.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
4ccedceaa8 thin_pool: introduce --pooldatavdo
Introducing new arg --pooldatavdo y|n
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
c496f80379 pool: code refactoring
Move pool related manipulation code to pool_manip.c.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
a176184b7d thin_pool: code refactoring
Move common code into thin_pool_set_params()
(just like we use  cache_set_params).
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
18d3283157 cov: some stack tracing corrections
Checking some returned values and adding/correcting
some debug tracing.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
2135bbe558 vdo: flip return value to int
Change API to return just 0/1.
2024-01-10 14:02:22 +01:00
Zdenek Kabelac
73967233e4 dev_manager: reuse _setup_task_run 2024-01-10 14:02:22 +01:00
Zdenek Kabelac
b058498404 lv: remove unused declaration 2024-01-10 14:02:22 +01:00
Zdenek Kabelac
b1e8af1c0c activate: use lv_layer
Avoid code duplication.
2024-01-10 14:02:22 +01:00
David Teigland
921ceddebf lvmconfig: uncomment the report section
so settings can be changed without uncommenting the
start/end of the section.
2023-11-17 13:52:49 -06:00
David Teigland
0e4fd4485f lvs: set first attr flag for raid integrity images
The first lv_attr flag is 'i' or 'I' for a raid image.
(i: raid image, I: out of sync raid image)
For integrity raid images (_iorig), the flag was not being set.
2023-11-17 13:26:23 -06:00