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

7186 Commits

Author SHA1 Message Date
Zdenek Kabelac
242bf56413 cov: validata top_lv
Add explicit pointer check is never NULL.
2023-05-06 19:22:05 +02:00
Zdenek Kabelac
662020c221 cov: simplier code
Avoid coverity to contruct some abstract scenarions of 'cft'
modification and simplify the code at the same time.
2023-05-06 19:22:05 +02:00
heinzm
d7e922480e Fix "lvconvert -m 0 will always take rimage_0 even if it is out-of-sync"
Bail out in case first rimage is out-of-sync.
Refresh first, i.e. "lvchange --resync $RaidLV",
then retry downgrade to linear after resynchronization.
2023-05-05 20:51:58 +02:00
David Teigland
368381fd40 lvreduce: make _lvseg_get_stripes handle integrity layer
lvreduce uses _lvseg_get_stripes() which was unable to get raid stripe
info with an integrity layer present.  This caused lvreduce on a
raid+integrity LV to fail prematurely when checking stripe parameters.
An unhelpful error message about stripe size would be printed.
2023-05-03 11:34:59 -05:00
David Teigland
6d262eaf64 lvmcache: fix valgrind error when dropping md duplicate
When lvmcache info is dropped because it's an md component,
then the lvmcache vginfo can also be dropped, but the list
iterator was still using the list head in vginfo, so break
from the loop earlier to avoid it.
2023-04-25 14:46:36 -05:00
Zdenek Kabelac
8947964f10 wipe_lv: use zeroing ioctl only for large sizes
There is no easy way to detect, whether device supports zeroing,
and kernel also zeroes device when it's not directly supported,
but with extra message:

operation not supported error, dev X, sector Y op 0x9:(WRITE_ZEROES)...

So to avoid generating such message with every 'lvcreate', use for
zeroing of upto 8K just standard write of zeroed page.
(maybe we can go with even larger sizes).
2023-04-25 00:12:31 +02:00
David Teigland
31cfcf7ce9 fix dev_name use in add_areas_line
This function was relying on dev_name() returning NULL
to indicate no device, but dev_name never returns NULL.
2023-04-24 15:49:00 -05:00
David Teigland
317071ec53 cache: fix snapshot of cache with cachevol
Creating a snapshot of a cache LV with a cachevol would fail
because cache_check was not being skipped.
2023-04-10 12:44:22 -05:00
David Teigland
8458ff9ad1 remove extra change from support 16KB page size 2023-04-07 15:57:28 -05:00
David Teigland
b443eac6ef support 16KB page size 2023-04-07 14:26:09 -05:00
Zdenek Kabelac
e8e6347ba3 vdo: use fixed size vdopool wrapper
Instead of using size of 'empty header' in vdopool use fixed size 4K
for a 'wrappeing' vdo-pool device.

This fixes the issue when user tried to activate vdo-pool after
a conversion from vdo managed device with 'vgchange -ay' - where
this command activated all LVs with 'vdo-pool' wrapping device as well,
but this converted pool uses  0-length header.

This 4k size should usually prevent other tools like 'blkid' recognize
such device as anything - so it shouldn't cause any problems with
duplicate indentification of devices.
2023-04-06 11:06:04 +02:00
Zdenek Kabelac
334117ee00 cleanup: rename function
Rename _thin_lv_has_device_id and use common function naming
with _lv_has_thin_device_id().
2023-04-06 11:06:04 +02:00
Zdenek Kabelac
1fb3e08033 cleanup: simplify 2023-04-06 11:06:04 +02:00
Zdenek Kabelac
51117b5793 integrity: hide creation of internal LVs
Creation of 'hidden' local LVs should be visible only in
verbose mode (-v) when creating a raid LV with integrity.
2023-04-06 11:06:04 +02:00
David Teigland
390ff5be2f raidintegrity: allow writecache and cache
Allow writecache|cache over raid+integrity LV.
2023-04-05 14:24:07 -05:00
David Teigland
69ea2e3f94 vg_read: keep MISSING_PV when device with no mda reappears
Remove old code that became incorrect at some point.
It's probably a fragment of an old condition that was left
behind because it wasn't understood.  We don't want to drop
the MISSING_PV flag just because the PV has no mda in use.
The device that was missing may have stale data, so the user
needs to decide if the device should be removed or restored.
2023-03-08 16:31:28 -06:00
David Teigland
1857eb9fe0 lvresize: fix check for mounted and renamed LV to handle spaces
Replace spaces with \040 in directory paths from getmntent (mtab).

The recent commit 5374a44c57 compares mount point directory paths
from /etc/mtab and /proc/mounts, in order to detect when a mounted
LV has been renamed.  The directory path comparison does not work
correctly when the path contains spaces because getmntent uses
ascii space chars and proc replaces spaces with \040.
2023-02-23 16:55:36 -06:00
Zdenek Kabelac
7bc5c8ac3d cov: avoid using strcpy
Coverity is complaining about unchecked strcpy here, which is
irelevant as we preallocate buffer to fit in copied string,
however we could actually reuse these size and use just memcpy().
So lets make some simple conversions.
2023-02-17 00:00:04 +01:00
David Teigland
bd05318ba2 pvscan: filter does not need to be checked for symlink names
With the recent use of DEVLINKS, there is no longer any real
point in checking the filter for symlink names.  Removing
this check should not change behavior with or without symlinks
in the filter.
2023-02-15 10:19:57 -06:00
Zdenek Kabelac
cf0dc9a13c filesystem: use PATH_MAX for linux paths 2023-02-12 23:56:29 +01:00
Zdenek Kabelac
631762d6db metadata-exported.h: correcting definition
Fixing minor mismatch between definition and declaration of
update_thin_pool_params().
2023-02-10 17:50:27 +01:00
Zdenek Kabelac
e3534d0f68 lvm: fix typos
Patch aec5e573af was fixing some
of typos only in generated file, but they need to be fixed in
the source files.
2023-02-10 17:50:27 +01:00
David Teigland
dc99f0def1 device_id: ignore quotes in device id
A t10 wwid string was found containing a " character
which breaks vg metadata parsing.  Ignore any quotation
marks in device id strings.
2023-02-06 12:24:18 -06:00
David Teigland
57ad78d436 vg_read: remove unused code for md components
This code was no longer used after ommit
87ee401eea
2023-02-02 16:15:13 -06:00
Zdenek Kabelac
f89c369a01 archive: update message
Better suggesting message as suggested by RHBZ 2123151.
2023-02-01 11:47:30 +01:00
David Teigland
6d14144d31 pvscan: recognize "pci" as a common symlink component in filters
In case the filter strings don't include "/dev/disk", and only
include "pci".
2023-01-31 15:30:35 -06:00
David Teigland
c9fdc828ff vgchange autoactivation: skip regex filter containing symlinks
"vgchange -aay --autoactivation event" is called by our udev rule.
When the udev rule runs, symlinks for devices may not all be created
yet.  If the regex filter contains symlinks, it won't work correctly.
This command uses devices that already passed through pvscan.  Since
pvscan applies the regex filter correctly, this command inherits the
filtering from pvscan and can skip the regex filter itself.

See the previous commit
"pvscan: use alternate device names from DEVLINKS to check filter"
2023-01-31 15:30:35 -06:00
David Teigland
17a3585cbb pvscan: use alternate device names from DEVLINKS to check filter
pvscan --cache <dev> is called by our udev rule at a time when all
the symlinks for <dev> may not be created yet (by other udev rules.)
The regex filter in lvm.conf may refer to <dev> using a symlink name
that hasn't yet been created, which would cause <dev> to not match
the filter regex.  The DEVLINKS env var, set by udev, contains all
the symlink names for <dev> that have been or will be created.
So, we add all these symlink names to dev->aliases, as if we had
found them in /dev.  This allows <dev> to be recognized by a regex
filter containing a symlink for <dev>.
2023-01-31 15:30:35 -06:00
David Teigland
d9f8acb65a lvresize: fail early if crypt device is missing
If extending an LV with crypto_LUKS on it, and the crypt device
is missing, then fail the command before extending the LV.
2023-01-30 17:12:11 -06:00
David Teigland
5374a44c57 lvresize: fail early if mounted LV was renamed
If a mounted LV is renamed, then fs resizing utilities will fail,
so detect this condition and fail the command before any changes
are made.
2023-01-26 14:02:20 -06:00
David Teigland
8adfcddc35 Revert "lvresize: enable crypt resizing with --force"
It looks like force was not being used to enable crypt resize,
but rather to force an inconsistency between LV and crypt
sizes, so this is either not needed or force in this case
should have some other meaning.

This reverts commit ed808a9b54.
2023-01-25 10:10:57 -06:00
David Teigland
ed808a9b54 lvresize: enable crypt resizing with --force
Update previous commit
  "lvresize: only resize crypt when fs resize is enabled"
to enable crypt resizing when --force is set and --resizefs
is not set.  This is because it's been allowed in the past
and people have used it, but it's not a good idea.
2023-01-20 12:04:55 -06:00
David Teigland
3bb5576528 lvresize: only resize crypt when fs resize is enabled
There were a couple of cases where lvresize, without --fs resize,
was resizing the crypt layer above the LV.  Resizing the crypt
layer should only be done when fs resizing is enabled (even if the
fs is already small enough due to being independently reduced.)

Also, check the size of the crypt device to see if it's already
been reduced independently, and skip the cryptsetup resize if
it's not needed.
2023-01-19 11:52:14 -06:00
Zdenek Kabelac
c20f01a0cb vdo: resize requires active vdopool volume
ATM kernel VDO target does not handle resize of inactive VDO LVs
so prevent users corrupting such LVs and require active such LVs.
2023-01-16 12:37:40 +01:00
Zdenek Kabelac
2451bc568f vdo: fix and enhance vdo constain checking
Enhance checking vdo constains so it also handles changes of active VDO LVs
where only added difference is considered now.

For this also the reported informational message about used memory
was improved to only list consuming RAM blocks.
2023-01-16 12:37:40 +01:00
Zdenek Kabelac
1bed2cafe8 vdo: read live vdo size configuration
Introduce struct vdo_pool_size_config usable to calculate necessary
memory size for active VDO volume.

Function lv_vdo_pool_size_config() is able to read out this
configuration out of runtime DM table line.
2023-01-16 12:37:40 +01:00
Zdenek Kabelac
773b88e028 vdo: check memory only in non critical section
When we are actually resizing VDO device - we need to check size only in
non-critical section - otherwise we are checking
2023-01-16 12:37:38 +01:00
Zdenek Kabelac
f486eb60d5 lvresize: use standard extent conversion function
We need to validate whether the requested resizing size can be
expressed with given extent_size.
2023-01-16 12:35:00 +01:00
lilinjie
bb34ebd4e4 fix typo
Signed-off-by: lilinjie <lilinjie@uniontech.com>
(cherry picked from commit 81b1f5bc3bac0e2e9099b67162da7d1a4995c5f4)
2023-01-11 13:52:12 +01:00
Marian Csontos
2ab81a3513 lvmlockd: Fix syntax error in previous commit 2023-01-11 13:34:38 +01:00
David Teigland
7c9c3ba5d5 lvmlockd: fix report of lv_active_exclusively for special lv types
Cover a case missed by the recent commit e0ea0706d
"report: query lvmlockd for lv_active_exclusively"

Fix the lv_active_exclusively value reported for thin LVs.
It's the thin pool that is locked in lvmlockd, and the thin
LV state was mistakenly being queried and not found.

Certain LV types like thin can only be activated exclusively, so
always report lv_active_exclusively true for these when active.
2023-01-10 15:37:15 -06:00
Zdenek Kabelac
44a2f2df92 cov: remove unused header files 2022-12-20 15:04:36 +01:00
David Teigland
4baef0f93f lvextend: fix overprovisioning check for thin lvs
18722dfdf4 lvresize: restructure code
mistakenly changed the overprovisioning check from applying
to all lv_is_thin_type lvs to only lv_is_thin_pool lvs, so
it no longer applied when extending thin lvs.  The result
was missing warning messages when extending thin lvs.
2022-12-15 10:00:17 -06:00
David Teigland
fa7fe5cbbe writecache: support settings metadata_only and pause_writeback
Two new settings for tuning dm-writecache.
2022-12-08 16:53:36 -06:00
David Teigland
6613a61d3b device_id: fix segfault verifying serial for non-pv
The recent change that verifies sys_serial system.devices entries
using the PVID did not exclude non-PV devices from being checked.
The verification code would attempt to use du->pvid which was null
for the non-PVs causing a segfault.
2022-12-02 12:25:10 -06:00
David Teigland
a74468116e device_id: check return value of label_read_pvid
for covscan
2022-12-01 11:49:51 -06:00
David Teigland
e71b434663 device_id: _get_devs_with_serial_numbers add missing free
on malloc failure path
2022-12-01 11:43:24 -06:00
David Teigland
7552ed9010 device_id: add null id->name null check
for covscan
2022-12-01 10:38:48 -06:00
David Teigland
f80273a107 lvmcache: fix strncpy len for wwid 2022-12-01 10:03:06 -06:00
corubba
e0ea0706dc report: query lvmlockd for lv_active_exclusively
Query LV lock state in lvmlockd to report lv_active_exclusively
for active LVs in a shared VGs.  As with all lvmlockd state,
it is from the perspective of the local node.

Signed-off-by: corubba <corubba@gmx.de>
2022-11-11 13:30:25 -06:00