1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-21 02:50:41 +03:00

15990 Commits

Author SHA1 Message Date
Zdenek Kabelac
5ad30c57b3 debug: update messages 2020-10-18 21:28:13 +02:00
Zdenek Kabelac
b8454b59e1 wipe_lv: use BLKZEROOUT when possible
Since BLKZEROOUT ioctl should be supposedly fastest
way how to clear block device start using this ioctl
for zeroing a device. Commonly we do zero typically
small portion of a device (8KiB) - however since we now
also started to zero metadata devices, in the case
of i.e. thin-pool metadata this can go upto ~16GiB
and here the performance starts to be noticable.
2020-10-18 21:28:13 +02:00
Zdenek Kabelac
ac5cf1544e configure: check for BLKZEROOUT support 2020-10-18 21:28:13 +02:00
Zdenek Kabelac
e9241860a8 wipe_lv: interruptible wiping
Since we now block signals and wiping may take unexpectedly long
time - support breaking command while wipe is in progress.
2020-10-18 21:28:13 +02:00
David Teigland
e94e0cd020 label: cleanup set_byte error exit 2020-10-18 21:28:13 +02:00
Zdenek Kabelac
35104f7ba5 wipe: dev_set_bytes resolves zeroing
Since dev_write_zeros() is just subset of dev_set_bytes()
use it directly and simplify code.
2020-10-18 21:28:13 +02:00
Zdenek Kabelac
0559ce6be0 configure: fix python paths
Stable branch supports also python2.
2020-10-18 21:28:13 +02:00
Zdenek Kabelac
789fc2a081 configure: editline updates
Update configure file.
2020-10-18 21:28:13 +02:00
Bastian Germann
f0a2b6737a lvm: add readline alternative editline
LVM2 is distributed under GPLv2 only. The readline library changed its
license long ago to GPLv3. Given that those licenses are incompatible
and you follow the FSF in their interpretation that dynamically linking
creates a derivative work, distributing LVM2 linked against a current
readline version might be legally problematic.

Add support for the BSD licensed editline library as an alternative for
readline.

Link: https://thrysoee.dk/editline
2020-10-18 21:28:13 +02:00
Zdenek Kabelac
cc5eb1d70f tests: check pool metadata are zeroed 2020-10-18 21:28:13 +02:00
Zdenek Kabelac
a46fdf5426 tests: failure of zeroing fails command 2020-10-18 21:28:13 +02:00
Zdenek Kabelac
e5010662a1 lvconvert: more support for yes conversion
When converting volume to pool LV use also wiping of other signatures.
For pool conversion support --yet and --force
to bypass prompting for signature wiping.

Note: currently we have lvconvert doing convertion and prompting
for confirmation of conversion - and then again wipe_lv() prompts
for removing i.e. filesystem signature - we should unify this
prompting into 1 message  - althought the 'filesystem' discovery
needs active volume - while the 1st. conversion prompt can
work without active converted volume.
2020-10-18 21:27:51 +02:00
Zdenek Kabelac
9c746f153e wipe_lv: always zero at least 4K
When zero_sectors passed value like 1 - we could zero only 1 sector.
Reinstantiate we always zero at least 4K block.
2020-10-18 21:27:51 +02:00
Zdenek Kabelac
8ee2479dd0 pool: zero metadata
To avoid polution of metadata with some 'garbage' content or eventualy
some leak of stale data in case user want to upload metadata somewhere,
ensure upon allocation the metadata device is fully zeroed.

Behaviour may slow down allocation of thin-pool or cache-pool a bit
so the old behaviour can be restored with lvm.conf setting:
allocation/zero_metadata=0

TODO: add zeroing for extension of metadata volume.
2020-10-18 21:27:51 +02:00
Zdenek Kabelac
7a06bc2400 wipe_lv: make error a fatal event
Failure in wiping/zeroing stop the command.
If user wants to avoid command abortion he should use -Zn or -Wn
to avoid wiping.

Note: there is no easy way to distinguish which kind of failure has
happend - so it's safe to not proceed any futher.
2020-10-18 21:27:51 +02:00
Zdenek Kabelac
84f03e2b63 gcc: calc size in compile time 2020-10-18 21:27:51 +02:00
Zdenek Kabelac
0c8f160fb2 label: deduplicate dev_set_bytes
As dev_write_zeros() is same as dev_set_bytes() reused the code
directly.
2020-10-18 21:27:51 +02:00
Zdenek Kabelac
1998825e12 label: code deduplication 2020-10-18 21:27:51 +02:00
Zdenek Kabelac
ba7740df50 label: use open_rw
Add missing declaration for label_scan_open_rw()
which has been already introduced without declaration
and use it for wiping LV.
2020-10-18 21:26:38 +02:00
Zdenek Kabelac
8792d417f3 libdm: validate thin-pool before sending messages
Alhtough lvm2 does validation on its side, ensure DM code
is not sending messages to failed thin pool.
2020-10-18 00:28:17 +02:00
Zdenek Kabelac
afffab0921 libdm: enhance error message 2020-10-18 00:28:17 +02:00
Zdenek Kabelac
d143ee13c7 libdm: split code for sending message
Move message sending from _thin_pool_node_message to
new _node_message for possible better code sharing.
2020-10-18 00:28:17 +02:00
Zdenek Kabelac
ba69c433c1 wipe: convert zero_value to uint8_t
We always write this value as byte.
2020-10-16 23:14:45 +02:00
Zdenek Kabelac
9bddffd7ad WHATS_NEWS: update 2020-10-16 23:14:12 +02:00
Zdenek Kabelac
ef5cddc208 dm: remove created devices on error path
DM tree keeps track of created device while preloading a device tree.
When fail occures during such preload, it will now try to remove
all created and preloaded device. This makes it easier to maintain
stacking of device, since we do not need to check in-depth for
existance of all possible created devices during the failure.
2020-10-16 21:10:04 +02:00
Zdenek Kabelac
7c262bfc85 rpm: bare words are no longer supported
Update for new rpm requirement and use "..." words.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
7d3e7266c7 tests: missed char in list
'=' also doesn't belong to property name.
2020-10-16 18:09:55 +02:00
Marian Csontos
d1db024e16 tests: fix unbound variable
Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
6b3d0166ee tests: aux setup
Avoid endless loop if there was no 'remove' progress.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
4d8d8856f1 tests: aux hides zero and error device
When ERR_DEV and ZERO_DEV are used, they are automatically
taken down when the last user no longer needs them,
so hide them from 'forgotten' device check.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
bd860802d4 tests: rename shown debug trace
As there could be few invokes of stacktrace, avoid
repeatedly display logs from commands.
So after first display rename  debug.log* -> debug_log
so the file still can remain for reading in test dir.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
1d7d3db571 tests: add small delay
Prevent there is no i.e. udev trying to open our device.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
2de99760f7 tests: check some common errors
Collect some cases users are hitting when working
with thin-pools which has mismatching kernel metadata content with
lvm2 metadata.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
c380d4e9e2 tests: also add thick snap of thin volume 2020-10-16 18:09:55 +02:00
Zdenek Kabelac
e05c882ab5 tests: a bit bigger mirrors
Seems even with throttling we occasinally need slightly more.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
d76b5f4308 tests: use aux wrapper and add more notes
This test seems to be hitting some corner case in handling
out-of-metadata space condintion in thin-pool.

Add few more aid notes and functionality.

Also add missing '|| true' with now direct-IO dd command.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
de1b894337 tests: move function to aux for reuse 2020-10-16 18:09:55 +02:00
Zdenek Kabelac
c68380746a debug: no backtrace
As the path already printed verbose message drop backtrace.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
b97440290c debug: show actually reason for taking this code path
Instead of not so useful backtrace, report what was the reason.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
03bddd7d41 debug: remove stacktrace on regular path
Here _insert is expected to also fail, so just regular 'return 0'.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
e8df503885 bcache: use flexible arrays
Cleanup, allocate whole struct with a single malloc call.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
479f0822ad bcache: support interrupts when waiting on IO
Since lvm2 normally block signals during protected
phase where it does not want to be interrupted.
Support interruptible processing when allowed
in section between sigint_allow() ... sigint_restore())
and let the 'io_getenvents()'  finish with EINTR.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
5e64aa222b bcache: fix busy loop with too many errors
When bcache tries to write data to a faulty device,
it may get out of caching blocks and then just busy-loops
on a CPU - so this check protects this by checking
if there is already max_io (~64) errored blocks.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
d32ee355c7 bcache: fix waiting problem for completed IO
Call _wait_all() which does check whether there is still
some pending IO before sleep. Otherwise it may happen
our submitted IO operations have been already dispatched
and this call then endlessly waits for IO which are all done.
This can be reproduced when device returns quickly errors
on write requests.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
1ed9cfad09 configure: use our ordered list of python names
Since it seems it's prefered now to use python3 in path name,
prefer this name as first in the list.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
305e80fe85 configure: update with latest AM_PATH_PYTHON
World has moved towards python3.9.
Although we still don't like path ordering.
2020-10-16 18:09:55 +02:00
Zdenek Kabelac
3b5d51e821 configure: update help
Help shows new defaults.
2020-10-16 18:09:54 +02:00
Zdenek Kabelac
7d6dfe9019 active: fix compilation without devmapper
Better support for compilation without device-mapper.
2020-10-16 18:09:54 +02:00
Zdenek Kabelac
0a82573416 thin: use lv_status_thin and lv_status_thin_pool
Introduce structures lv_status_thin_pool and
lv_status_thin  (pair to lv_status_cache, lv_status_vdo)

Convert lv_thin_percent() -> lv_thin_status()
and  lv_thin_pool_percent() + lv_thin_pool_transaction_id() ->
lv_thin_pool_status().

This way a function user can see not only percentages, but also
other important status info about thin-pool.

TODO:
This patch tries to not change too many other things,
but pool_below_threshold() now uses new thin-pool info to return
failure if thin-pool cannot be actually modified.
This should be handle separately in a better way.
2020-10-16 18:09:54 +02:00
Zdenek Kabelac
45121aafe9 thin: remove unneeded code test
Since we detect already transaction if before starting
to build dm tree - this extra check is a duplicate
that would only capture very tiny 'race' and we later
validate transaction_id with suspended snapshot origin.
2020-10-16 17:07:59 +02:00