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

7268 Commits

Author SHA1 Message Date
Zdenek Kabelac
6afaaca2e5 cov: enusure pointer to idname exists 2023-10-14 23:12:57 +02:00
Zdenek Kabelac
9668d40d5a resize: reduce without prompt for no-fs case
Apply the same logic for 'lvreduce' which exists for newer
systems (compiled with HAVE_BLKID_SUBLKS_FSINFO)
also for older systems for one very common practical case where
the active LV does not have any blkid known signature/filesystem.

New variant recognized this situation and allowed to proceed
without requesting a prompt, while the older variant always
requested confirmation prompt.

With this patch command now works equily for both variants
for 'active LV' without signature and allows to reduce LV
without prompting.
2023-10-14 23:10:21 +02:00
Zdenek Kabelac
46eeb62b04 pool: fix recalculate of pool chunk_size
Before checking seg_type of the first area, check there is
some existing area.
Since we now support error and zero segtypes, these do not have
any PV area present.
2023-10-14 01:04:10 +02:00
David Teigland
63b469c160 device_id: fix hints with device ids
Fix some interactions between device IDs and hints.  Hints
may limit the scanned devices which should not always trigger
a search for the PVs that were intentionally not scanned.
Hints should also be invalidated if they contain a device
that's become excluded by an internal filter such as the
device_id filter.
2023-10-10 11:47:29 -05:00
David Teigland
f20be398a1 device_id: refresh devname idnames if any are not found
Search for a PV on other devices if it's a devname entry
and the name doesn't exist on the system.  This restores
code that should not have been removed in commit 1901a47df
"device_id: fix conditions for device_ids_refresh"
2023-10-10 11:46:21 -05:00
David Teigland
25a87ea16a device_id: fix lvmdevices update segfault
From commit 1901a47df1
"device_id: fix conditions for device_ids_refresh"
2023-10-06 12:24:34 -05:00
Zdenek Kabelac
44f86d38f9 debug: fix message severity levels
Add some missing WARNS and correct some severity levels.
2023-10-06 10:50:26 +02:00
David Teigland
1901a47df1 device_id: fix conditions for device_ids_refresh
Fix commit 847f1dd99c
"device_id: rewrite validation of devname entries"

which began calling device_ids_refresh() in cases where it
was unnecessary, leading to extra PV searches and warnings.
Specifically, a command like "lvs <vg>" would use the hints
file to scan only devices for the named VG.  This means that
scanning other PVs would be skipped, and device IDs of those
PVs could not be validated because there are no PVID values
to verify.  This missing info would cause messages about
the missing info, and would cause device_ids_refresh to
search for the PVs that had been intentionally skipped.
2023-10-05 15:33:55 -05:00
Zdenek Kabelac
4edaa9fdf5 filters: leave device_id_sysfs_dir only for device_id
Do not use filters for sysfs with device_id.
2023-10-04 22:03:56 +02:00
Zdenek Kabelac
cf46f4baee filters: sysfs use device_id_sysfs_dir
This is mainly useful in internal testing - but keep sysfs dir also
passed to filter.
Also drop use of static variable within sysfs filter and base whole
config at creation time.
2023-10-03 21:30:22 +02:00
David Teigland
88aa285a79 devices: refresh device ids if the system changes
If the system changes, locate PVs that appear on different devices,
and update the device IDs in the devices file.  A system change is
detected by saving the DMI product_uuid or hostname in the devices
file, and comparing it to the current system value.  If a root PV
is restored or copied to a new system with different devices, then
the product_uuid or hostname should change, and trigger lvm to
locate PVIDs from system.devices on new devices.
2023-09-27 15:22:11 -05:00
Zdenek Kabelac
d54deae0ad debug: correcting check for error
Correct trace for erroring case of close.
2023-09-26 01:23:00 +02:00
Mikulas Patocka
ab73ad4e5f gcc: fix warnings for x32 architecture
Warning from x32 ABI compilation.
2023-09-12 14:41:22 +02:00
David Teigland
fa49651301 lvresize: fix 32 bit overflow in size calculation 2023-09-11 12:18:12 -05:00
Zdenek Kabelac
d34d1f0173 debug: trace result failure 2023-09-03 22:03:33 +02:00
Zdenek Kabelac
670d982568 debug: drop stack from regular path 2023-09-03 22:03:33 +02:00
Zdenek Kabelac
97770d5aeb debug: check for syscalls
Add some debug checks for possibly failing syscalls.
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
a48847269a clang: ensure all variables intialized
Just in case of some wierd kernel bug, which would forget
to report these values...
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
6a0e54f84f clang: ensure status is initilized
Initialize status before handling error path.
2023-09-03 22:03:33 +02:00
Zdenek Kabelac
cb61d2294a filesystem: move stat after open check
To avoid time-of-check-time-of-use clash, take the stat()
after successful open with fstat().
Also add some debugs for failing sys calls.
2023-09-03 22:03:33 +02:00
Peter Rajnoha
14d0a9eef6
report: support printing full column names in report headings
Reuse existing report/headings config setting to make it possible to
change the type of headings to display:
  0 - no headings
  1 - column name abbreviations (default and original functionality)
  2 - full column names (column names are equal to exact names that
      -o|--options also accepts to set report output)

Also, add '--headings none|abbrev|full|0|1|2' command line option
so we are able to select the heading type for each LVM reporting
command directly.
2023-08-28 15:44:57 +02:00
Zdenek Kabelac
71ff21f57c gcc: initialize variables 2023-08-23 15:10:40 +02:00
Zdenek Kabelac
8698f9dce6 pool: use predefined name for metadata LV
While create new LV for pool volume, use name from 'pool_metadata%d' naming
sequence. This LV is later on renamed to  pool_t/cmeta, but if there
is any error in the middle, we may evenutally leave some 'volume',
With this name it can be slightly more obvious how it got there,
but also when we handle _pmspare name - we get slightly more predictible
name used there for it.

However for a standard usage this commit shall no visible impact as the
name is used temporarily just for cleaning LV.
2023-08-17 20:10:21 +02:00
David Teigland
696ee52ffd lvmlockd: let lockd_init_lv_args set lock_args
Set the lock_args string in addition to doing initialization.
lvconvert calls lockd_init_lv_args() directly, skipping
the normal lockd_init_lv() which usually sets lock_args.
2023-08-16 15:29:20 -05:00
David Teigland
096196281e lvmlockd: fix thick to thin lv conversion 2023-08-16 15:29:19 -05:00
Zdenek Kabelac
728617d25d gcc: cleanup warnings
Correcting signess comparation.
Also use standalone /* fall through */ comment as that's
the only one supported by gcc to quiet warning.
2023-08-16 15:13:25 +02:00
Zdenek Kabelac
b764665f4d debug: add missing log_error
Report error with failure.
2023-08-14 17:02:11 +02:00
Zdenek Kabelac
2f3d8659b1 commands: add lv_is_writable 2023-08-14 17:02:11 +02:00
David Teigland
847f1dd99c device_id: rewrite validation of devname entries
The old approach was too complicated and didn't work correctly
in some cases.
2023-08-04 11:45:40 -05:00
Peter Rajnoha
0e9fe272bc
report: fix pv_major and pv_minor report field type
We incorrectly marked pv_major and pv_minor fields as being of string
type, even though the values were already correctly handled as integers
internally. This confused -S|--select that tried to compare string
values instead of integers.

Reported here: https://github.com/lvmteam/lvm2/issues/122
2023-07-31 13:44:09 +02:00
Paul van Genderen-Tjie A Loi
e3cc3e55c8 vgmknodes: skipping thin pool is not an error 2023-07-24 12:03:06 -05:00
Zdenek Kabelac
96b2c20991 debug: add backtrace 2023-07-17 12:44:37 +02:00
Zdenek Kabelac
469bcc28ac cleanup: remove duplicated code
Commit cac4a9743a moved setting
if layer structed to the function front, but the old code
was still left in original place.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
d040b68aee lvconvert: use public LVs for recovery
Replace the use of internal /dev/mapper names with the use of
public LV names /dev/vg/lv for use with repair tools.
For this make the activation of _pmspare LV to be handled as
a component activation with public name.
Metadata is already atomatically activated this way (as readonly).

So if there is any 'error' happening, we leave public LVs in
system.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
409a79621a vdo: refactor code
Shuffle code to use prepare_exec_args().
Simplify generation of options string within a single char buffer.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
4d2311655b lvm-exec: refactor code
Add prepare_exec_args() for reading option list for
thin/cache_repair, thin/cache_check.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
f78b02477b lv_manip: refactor code
Simplify initialization of exec buffer.
Check for misconfigured 'fsadm' executable path.
2023-07-17 12:44:23 +02:00
Zdenek Kabelac
c5e4326337 active: device name limit is NAME_LEN
Use existing NAME_LEN instead of 257 value.
Add missing backtrace.
2023-07-17 12:43:39 +02:00
Zdenek Kabelac
81ef1fd0cc debug: print WARNING:
Add WARNING: in front of log_warn() messages.
2023-07-15 11:05:35 +02:00
Zdenek Kabelac
fdf2571679 mm: add libzstd to ignore list
No need to lock-in-RAM libzstd (linked from systemd).
2023-07-15 11:05:06 +02:00
Zdenek Kabelac
75b28ab49d lvmlockd: query the simplest check first
Check for visibility of the LV first.

TODO:

Short check list and test only for those that can't be locked,
but they are visible LVs.
2023-07-14 16:52:51 +02:00
Zdenek Kabelac
bdcfd2d730 lvconvert: no metadata for test mode
Avoid trying to build real metadata in --test mode.
2023-07-14 16:20:30 +02:00
Zdenek Kabelac
97fc0ca49b debug: missed properly modify pointer type 2023-07-13 21:52:20 +02:00
Zdenek Kabelac
5ce236a691 gcc: correct signess comparation
Compare int to int and unsigned to unsigned...
2023-07-13 21:31:18 +02:00
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