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

18302 Commits

Author SHA1 Message Date
Zdenek Kabelac
b6b1c19365 vdo: fix reader error path
Nothing to be closed on this error path.
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
9ce55a43d0 lvchange: handle unrecognized writecache setting
It was being ignored.
2022-12-08 15:48:30 -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
David Teigland
55b29c1c3d lvmlockd: fix missing closedir
in get_local_nodeid from recent lock purge feature:
  lvmlockd: purge the lock resources left in previous lockspace
2022-12-01 09:55:11 -06:00
Tony Asleson
e63b0c7262 lvmdbusd: Add command_log_selection to command line
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145114
2022-11-29 12:56:55 -06:00
Tony Asleson
8f60c49451 lvmdbusd: Move get_error_msg to utils
Moving this so we can re-use outside of lvm_shell_proxy.
2022-11-29 12:56:55 -06:00
Tony Asleson
61917fbac2 lvmdbustest: Add test to ensure error collection
Recreates https://bugzilla.redhat.com/show_bug.cgi?id=2145114
2022-11-29 12:56:55 -06:00
Zdenek Kabelac
a02268e938 man: dmsetup concise format consitency
Use <name> consistenly.
2022-11-25 16:41:53 +01:00
Zdenek Kabelac
a5042375de dmsetup: fix udev event handling for create
With newer kernels (>5.13)  DM_CREATE no longer generates
uevent for DM devices without table.
There are even no sysfs block device entries in such case,
although device has asigned major:minor and it is being listed
by 'dmsetup info'.

So this patch calculates amount of 'table' lines and in case
no table line comes from cmdline or stdin - waiting on cookie
is avoided generically instead of disabling just case with
option --notable - which then also skipped handling of an
option --addnodeoncreate (which is however historical and
should be avoided)

As a result there should be no leaking udev cookies and endlessly
waiting commands like this:

dmsetup create mytestdev  </dev/null
2022-11-25 16:41:53 +01:00
Zdenek Kabelac
ae916f77c9 configure: update 2022-11-25 15:55:56 +01:00
Sam James
fdd8feb60e lvmpolld: fix strerror_r check for musl
We can't assume that strerror_r returns char* just because _GNU_SOURCE is
defined. We already call the appropriate autoconf test, so let's use its
result (STRERROR_R_CHAR_P).

Note that in configure, _GNU_SOURCE is always set, but we add a defined
guard just in case for futureproofing.

Bug: https://bugs.gentoo.org/869404
2022-11-25 15:55:23 +01:00
David Seifert
3dee7b7266 configure: allow for overriding of readelf
This allows users to use e.g. `llvm-readelf`
on systems with binutils as default.

Bug: https://bugs.gentoo.org/840628
2022-11-25 15:54:57 +01:00
David Teigland
2da4ca7ce1 tests: devicesfile-vpd-ids add nvme wwid 2022-11-21 10:57:30 -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
corubba
779fc3c045 report: adjust lv_active_remotely for shared VGs
Add a note to the manpage that lvmlockd is unable to determine
accurately and without side-effects whether a LV is remotely active.
Also change the value of the lv_active_remotely option from false to
undefined for shared VGs to distinctly communicate that inability to
users. Only for local VGs it can be definitely stated that they are not
remotely active.

Signed-off-by: corubba <corubba@gmx.de>
2022-11-11 12:08:59 -06:00
Marian Csontos
c77384785d post-release 2022-11-10 14:21:57 +01:00
Marian Csontos
f8127c45c5 pre-release 2022-11-10 14:11:32 +01:00
Marian Csontos
6b96bf7bc2 make: generate 2022-11-10 13:58:09 +01:00
Zdenek Kabelac
403779333b vdo: improve validation message
Rephrase.
2022-11-08 12:40:21 +01:00
Zdenek Kabelac
b9f35e07db lvcreate: fix error path return values
Return failing error code for return path, as 'return 0' in this
case was returning success.
2022-11-08 12:39:25 +01:00
Zdenek Kabelac
0fed9b0971 tests: update test to handle different status
Since now we change deduplication with V4 table line change,
the modification tends to be faster and we can capture for a few ms
also 'status' about opening or closing deduplication index.
Use 'grep -E' to handle both words.
2022-11-08 11:10:21 +01:00
Zdenek Kabelac
8e9410594b vdo: enhance detection of virtual size
Improve detection of VDO virtual size - so it's not reading VDO
metadata when VDO device is already active and instead we reuse
existing table line for knowing existing metadata size.

NOTE: if there is ever going to be added support for reduction
of VDO virtual size - this method will need to be reworked to
allow size difference only within 'extent_size' alignment.
2022-11-08 11:10:21 +01:00
Zdenek Kabelac
218c7d44b5 vdo: replace errors with debug
As we actully use reading of VDO metadata only as extra 'information' source,
and not error command - switch to 'log_debug()' severity with messages
out of parser code.
2022-11-08 11:07:20 +01:00
David Teigland
c98617c593 devices: factor common list functions
which were duplicated in various places
2022-11-07 11:38:46 -06:00
David Teigland
761b922178 device_id: handle duplicate serial numbers
Handle multiple devices using the same serial number as
their device id.  After matching devices to devices file
entries, if there is a discrepency between the ondisk PVID
and the devices file PVID, then rematch devices to
devices file entries using PVID, looking at all disks
on the system with the same serial number.
2022-11-07 08:56:02 -06:00
David Teigland
bdab36cf3f device_id: look for serial number in other locations
Only /sys/dev/block/major:minor/device/serial was read to find
a disk serial number, but a serial number seems to be reported
more often in other locations, so check these also:
/sys/dev/block/major:minor/device/vpd_pg80
/sys/class/block/vda/serial (for virtio disks only)
2022-11-07 08:56:02 -06:00
Zdenek Kabelac
36a923926c device_mapper: vdo V4 avoid messaging
With V4 format build table line with compression and
deduplication and skip sending any messages to set up
these parameters.
2022-11-02 13:59:34 +01:00
Zdenek Kabelac
2e79b005c2 dev_manager: accept misalined vdo pools.
Since lvm2 may create VDO pool virtual size aligned only on extent size
while VDO itself is just 4K aligned - we need to support such misalign.
2022-11-02 13:59:34 +01:00
Zdenek Kabelac
829ab01708 device_mapper: add parser for vdo metadata
Add very simplistic parser of vdo metadata to be able to obtain
logical_blocks stored within vdo metadata - as lvm2 may
submit smaller value due to internal aligment rules.

To avoid creation of mismatching table line - use this number
instead the one provided by lvm2.
2022-11-02 13:59:34 +01:00
Zdenek Kabelac
17baeb65a9 configure: update use_devicesfile in example.conf
Example.conf missed to properly replace default value for
use_devicesfile setting and left there @VAR@.
2022-11-02 13:59:34 +01:00
David Teigland
81f10c1d1e vgchange systemid: use tag or select
The command can do this but the command defs
were missing the annotation to allow it.
2022-10-31 08:54:33 -05:00
David Teigland
f188c9e403 device_id: remove debug trace
for common case where a device id type is not used.
2022-10-24 16:20:28 -05:00
David Teigland
830ece75e8 cmd: save device_id_sysfs_dir
read and save device_id_sysfs_dir to avoid spamming
debug output from find_config_tree_str.
2022-10-24 16:20:28 -05:00
Tony Asleson
94dde57699 lvmdbusd: Handle PV signature copy
If something manually copies a PV signature to a block device we will
miss it.  Handle this case too.
2022-10-20 15:10:35 -05:00
Tony Asleson
736547e7bb lvmdbustest: Add test for copy signature
Add test to ensure we detect when a PV signature is copied to a block
device.
2022-10-20 15:10:35 -05:00
Tony Asleson
8a1c73ddbe lvmdbusd: Always leverage udev
Previously we utilized udev until we got a dbus notification from lvm
command line tools.  This however misses the case where something outside
of lvm clears the signatures on a block device and we fail to refresh the
state of the daemon.  Change the behavior so we always monitor udev events,
but ignore those udev events that pertain to lvm members.

Note: --udev command line option no longer does anything and simply
outputs a message that it's no longer used.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1967171
2022-10-20 15:10:35 -05:00
Tony Asleson
5a6ae2d4d8 lvmdbustest: Add test for wipefs
Ensure that if an external program or user calles wipefs on a PV that we
correctly update the state of the daemon.
2022-10-20 15:10:35 -05:00
Tony Asleson
0f56c1ad12 lvmnotify.c: Check to see if dbus daemon is running
The lvm dbus daemon will auto activate on dbus API calls.  To
prevent the dbus daemon starting when lvm command line tools are
being used we will check to see if the daemon is running first.
If the daemon is not running, we will not notify the daemon.

For this check to work it requires the changes done previously
with commit: 3fdf449348

Reviewed-by: David Teigland <teigland@redhat.com>
2022-10-19 14:22:12 -05:00
David Teigland
04097d9f62 lvreduce: change error message about --fs options 2022-10-12 10:05:14 -05:00
corubba
4f4554164b lvmlockd: Fix sanlock lvmlock lv size calculation
The number of extents for the sanlock lvmlock lv is calculated using
integer division, which rounds towards zero. With a physical extent size
of 129M, instead of the requested 256M the lv is only 129M (1 extent).
With any physical extent size greater than 256M the lv creation fails
because the number of extents is zero.

This is fixed by replacing the integer division with a division macro
that rounds up and thus guarantees that the size of the lv will always
be equal or greater than the requested size. Using the examples above, a
pes of 129M will result in a 258M lv (2 extents), pes of 300M in a 300M
lv (1 extent).

The re-calculation of the lv size in bytes and megabytes is only so the
debug output shows the correct values. The size in mb there is still
not byte-perfect-accurate, but good enough for a human-readable estimate;
and the exact size in bytes and extents is right next to it.

Signed-off-by: corubba <corubba@gmx.de>
2022-10-12 09:19:01 -05:00
Peter Rajnoha
908555459f toollib: do not process just created historical LV
When executing process_each_lv_in_vg, we process live LVs first and
after that, we process any historical LVs. In case we have just removed
an LV, which also means we have just made it "historical" and so it
appears as fresh item in vg->historical_lvs list, we have to skip it
when we get to processing historical LVs inside the same process_each_lv_in_vg
call.

The simplest approach here, without introducing another LV list, is to
simply mark such historical LVs as "fresh" directly in struct
historical_logical_volume when we have just removed the original LV
and created the historical LV for it. Then, we just need to check the
flag when processing historical LVs and skip it if it is "fresh".

When we read historical LVs out of metadata, they are marked as
"not fresh" and so they can be processed as usual.

This was mainly an issue in conjuction with -S|--select use:

	#  lvmconfig --type diff
	metadata {
		record_lvs_history=1
	}

(In this example, a thin pool with lvol1 thin LV and lvol2 and lvol3 snapshots.)

	#  lvs -H vg -o name,pool_lv,full_ancestors,full_descendants
	  LV    Pool FAncestors  FDescendants
	  lvol1 pool             lvol2,lvol3
	  lvol2 pool lvol1       lvol3
	  lvol3 pool lvol2,lvol1
	  pool

	#  lvremove -S 'name=lvol2'
	  Logical volume "lvol2" successfully removed.
	  Historical logical volume "lvol2" successfully removed.

...here, the historical LV lvol2 should not have been removed because
we have just removed its original non-historical lvol2 and the fresh
historical lvol2 must not be included in the same processing spree.
2022-10-12 15:14:59 +02:00
David Teigland
f6f2737015 lvreduce: require active LV when no fs option is used
Without an --fs option set, make lvreduce of an inactive LV
fail and report that the LV must be active.
2022-10-11 12:48:31 -05:00
David Teigland
fc52e87f06 tests: add comments to fsadm-renamed
to explain the what and why of the steps that are
not obvious
2022-10-11 12:48:31 -05:00
David Teigland
657df00c96 lvmlockd: fix warning 2022-10-11 12:35:38 -05:00