1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-23 10:50:34 +03:00

15981 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
3094c423a0 cleanup: avoid unneeded check
Since creation of thin snapshot already makes sure,
the message list is empty, there is no need to check
this again.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
6373a84977 activation: move locking of critical section
Move begining of 'suspending' critical section closer to _lv_suspend_lv()
for better correctness of error paths.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
d4d3ff352f makefiles: document supported var in make help 2020-10-16 17:07:59 +02:00
Zdenek Kabelac
8a0f9537f1 thin: pass through whole code
Instead of early 'return 0' let the whole code finish
in case of an error with syncing.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
3a2ada80cb thin: improve error message
Add more info, explaing why the suspend of thin snapshot origin was omitted.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
22b256a09a thin: enhance lvcreate error paths
Improve error response and reporting, when creating thin snapshots.
If the thin pool kernel metadata already have device with ID lvm2
tries to create, give more meanigful error message and also properly
restore transaction id to the value known to thin-pool in this case.

Before it's been possible to divert by one from kernel TID value,
and lvm2 stacked delete message for such thin device.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
9e8016ffa9 thin: no delete message for device_id 0
Since we always use device_id > 0, we could use
device_id == 0 to actually mark thinLV as an
LV we want to remove without delete message.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
5726b93709 activation: use revert_lv on tree suspend failure
When thetable reload fails during suspend() - we were only calling
plain resume() - and this will reload only those devices,
which were left suspend, but will not try to restore
metadata state according to lvm2 reverted metadata.
So if we were reloading device tree - we have restored
only top-level LV and rest of reverted device manipulation
were left alone and possibly mismatched what is in committed
metadata.

FIXME: There are several cases were such revert will likely not work
properly anyway as some operation are currenly handled in single commit,
while they need multiple commits, but it's step towards better correctness.
At least we catch there errors now earlier.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
05ba12350c tests: use DIRECT io for zeroing whenver we can
Performance with direct I/O here is noticable better,
so use it instead of buffered write whenever we can.
2020-10-16 17:07:59 +02:00