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

7224 Commits

Author SHA1 Message Date
Zdenek Kabelac
cb2d32bdc4 debug: fix sscanf type
Last commit c38b668fc3 was pushed
with type 'scanf' instead of 'sscanf' needed for buffer reading.
Interestingly this caused scanning from 'stdin' descriptor and
thus failures in lvm shell usage.
2023-07-13 21:31:18 +02:00
Zdenek Kabelac
4d70e7bf78 debug: use display_lvname 2023-07-12 15:18:38 +02:00
Zdenek Kabelac
c38b668fc3 debug: fix parsing of /proc/self/stat
The code in init_log_file relies on the process name (COMM) to not
contain whitespaces. This change fixes it by looking up the right-most
parenthesis to safely jump past COMM.

For more context see:
https://www.openwall.com/lists/oss-security/2022/12/21/6

Code is only used with testing, so it should have no impact on regular
users.

Reported-by: Hugues Evrard <hevrard@google.com>

mm
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
491ee5d106 cov: hide some messages
Living with these...
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
857f5d6e65 lvconvert: correction for thin conversion
Updates for 39457234db.
Off-by-one for option array - need 20 fields.
Missed to clear lock_args for cachepool.
2023-07-12 15:18:38 +02:00
Zdenek Kabelac
00b5d7b037 lv: followup seg_monitor reporting
With 3596558861 it's been introduced
a more fine grained description.
However 'disabled' might be actually more confusing then empty field,
so keep only the info about 'not enabled'aka dmevend is not allowed
to monitor LV which otherwise could be monitored.
2023-07-10 17:13:33 +02:00
Zdenek Kabelac
39457234db lvconvert: support conversion to thin volume
Update pool conversion function to handle also conversion of
thick LV to thin LV by moving thick LV into thin pool data LV
and creating fully provissioned thin LV on top of this volume.

Reworking existing conversion to use insert_layer_for_lv co
the uuid is now kept with thin-pool - this should however not
really matter as we are doing full deactivation & activation cycle.

With conversion to thin LV user can use same set of arguments
to set chunk-size.

TODO: add some smart code to decide best values for chunks sizes.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
f35fa8c178 cleanup: typos 2023-07-10 17:13:32 +02:00
Zdenek Kabelac
96123b9059 cleanup: use spelling synchronize
Use single spelling form for synchronize.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
077b46e014 lv_manip: fix move_lv_segments moved bits
For proper functionality of insert_layer_for_lv we need to
move more bits to layerd LV.

Add some missing new types and correct usage of caller,
so the new LV type is set after the movement.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
e022805f1d pool: do not pass empty string in callback
When preparing cmdline to executing dmpd tool, avoid adding
empty string ("") on such line.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
e36028b7d2 cache: update validation rules
Validate cache origin in front of the prompt.
Also add some rules to command description file.

TODO:
more validation needed also for lvcreate,
more complex rules with "OR" seems to be needed.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
9bbbc1b265 cachepool: skip wipe for nonzeroeable segments
Avoid activation when going to skip zeroing of 'error' segtype
(so it's not erroring out).
Also skip zeroing for 'zero' segtype LV (already being zero).
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
558890ad0e pool: support passing data_lv for recalculation
Support data_lv to be passed as parameter when it's not yet
attached to the pool.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
d43a79eec9 segtype: add missing macros for error and zero segment
Add macros for checking error and zero segment as we do
with other segtypes.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
5154054af4 snapshot: no error when extending above max size
When lvm2 calculates the maximal usable COW size and crops the user
requested size to this value, don't return the error result from
the 'lvextend' operation.

We already apply the same logic when resizing thin-pool beyond
the supported maximal size.

FIXME: The return code error logic here is somewhat fuzzy.
2023-07-10 17:13:32 +02:00
Zdenek Kabelac
e84b00964f pool: avoid using artificial name internally 2023-06-29 13:55:27 +02:00
Zdenek Kabelac
3596558861 lv: more details about monitoring lvs
Show "not supported" when LV does not support dmeventd monitoring.
Show "disabled" for LV with disabled dmeventd monitoring.
(lvdisplay -m)
2023-06-29 13:10:42 +02:00
Zdenek Kabelac
e48c9826e3 vdo: indent for lvdisplay 2023-06-29 13:10:42 +02:00
Zdenek Kabelac
6ff65e6755 vdo: check_point_frequence is unused option
This vdo parameter existed in the early stage of integration of vdo into lvm2,
but later it's been removed from vdoformat tool - so actually if
there would be any non-zero value it would cause error on lvcreate.
Option was not stored on disk in lvm2 metadata.

Remove this vdo parameter from lvm2 sources.

(Although this vdo parameter will be still accepted on cmdline through
 --vdosettings option, but it will be ignored.)
2023-06-29 13:10:42 +02:00
Zdenek Kabelac
46fe47b8e0 debug: add backtraces 2023-06-23 18:08:03 +02:00
Zdenek Kabelac
fec3087eef thin: add cfg support for thin_restore and cache_restore
Add configurable paths for thin_restore and cache_restore.
2023-06-23 18:06:22 +02:00
David Teigland
7c3eca833f lvresize: fix multiple mounts
which was mistaken as a mounted LV that had been renamed.
2023-06-16 12:11:51 -05:00
David Teigland
228a8e8c1f device_id: ignore leading and trailing spaces for sys_wwid and sys_serial
Leading and trailing underscores are also ignored to handle device ids
written by previous versions which replaced all spaces with underscores.
2023-06-15 15:17:14 -05:00
Zdenek Kabelac
fcf2057b38 cmd_enum: correct inclusion
Ensure we use generated header file for this build from -Iinclude.

Reported-by: Anton Lundin <glance@ac2.se>
2023-06-09 18:01:16 +02:00
David Teigland
74feebdab7 device_id: fix handling of non-PV with duplicate serial number
Fix in the code that matches devices to system.devices entries when
the devices have the same serial number.  A non-PV device in
system.devices has no pvid value, and the code was segfaulting
when checking the null pvid value.
2023-06-08 12:24:05 -05:00
David Teigland
0591131a53 lvreduce: simplify _lvseg_get_stripes integrity check
Simplify unnecessary loop to avoid coverity complaint.
2023-05-25 12:09:41 -05:00
David Teigland
4cdb178968 device_id: ignore trailing underscores in t10 wwid from devices file
In previous lvm versions, trailing spaces at the end of a t10 wwid would
be replaced with underscores, so the IDNAME string in system.devices
would look something like "t10.123_".  Current versions of lvm ignore
trailing spaces in a t10 wwid, so the IDNAME string used would be
"t10.123".  The different values would cause lvm to not recognize a
device in system.devices with the trailing _.  Fix this by ignoring
trailing underscores in the IDNAME string from system.devices.
2023-05-19 14:05:10 -05:00
David Teigland
24e4b6df11 tests: integrity-caching: ensure raid redundancy
The recent fix 05c2b10c5d ensures that raid LV images are not
using the same devices.  This was happening in the lvextend commands
used by this test, so fix the test to use more devices to ensue
redundancy.
2023-05-17 14:15:25 -05:00
David Teigland
fd6e113bba raidintegrity: allow snapshots 2023-05-11 11:02:52 -05:00
heinzm
05c2b10c5d Fix "multisegment RAID1, allocator uses one disk for both legs"
In case of e.g. 3 PVs, creating or extending a RaidLV causes SubLV
collocation thus putting segments of diffent rimage (and potentially
larger rmeta) SubLVs onto the same PV.  For redundant RaidLVs this'll
compromise redundancy.  Fix by detecting such bogus allocation on
lvcreate/lvextend and reject the request.
2023-05-10 18:35:21 +02:00
Zdenek Kabelac
cc7c41abbd cov: remove unneeded header file inclusion 2023-05-10 15:27:48 +02:00
Zdenek Kabelac
7b52a663a6 cov: validate dev_get_primary_dev result
Make sure primary_dev is defined when using it.
2023-05-10 15:27:48 +02:00
Zdenek Kabelac
534269d0fb vdo: document feature option 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
f038fc3b17 cov: remove unused but set variables 2023-05-06 20:38:57 +02:00
Zdenek Kabelac
c451d7925d cleanup: correcting some log_print
Correcting to log_print_unless_silent(),
so -qq can do some work.
2023-05-06 20:38:49 +02:00
Zdenek Kabelac
39b2bd06b8 cov: some initializers 2023-05-06 19:22:05 +02:00
Zdenek Kabelac
4fd2f433ad cov: hide problem with 64bit time_t 2023-05-06 19:22:05 +02:00
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