1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-11 09:18:25 +03:00
Commit Graph

15948 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
688c72411e tests: use zero backend
Since we are not reading read - just use zero device as backend for
test, so we do not eat real disk space.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
cd681efd9f tests: inittest supports SKIP_WITH_LOW_SPACE
Test can set individually a higher value for required free space on
storage.

Note: it is not fully reliable since when 'brd' (ramdisk) device is used
this free space value is rather meanigul, but it might help
in case where a real filesystem is doing back-end for test devices.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
3f06b5c39c tests: utils better handle ouf of disk space
When the test exhausts all the available free space on storage device,
then during the fail we cannot write anything as well - yet
the teardown needs to finish it's work - otherwise we leave
basicaly overfilled filesystem for all remaining tests.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
276e22e263 tests: aux better handle invalid table
In cases where internal functions like zero_dev, delay_dev pass-in
invalid parameter so resulting table can't work, resume at least
previous table line before failing out - so the cleaning process
later on is not stuck waiting on a suspended device.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
f9327d040c tests: smaller delay and lowered version
See if this will still work. Some boxes are delayed too much.
Also try to check for raid extend progress from version 1.13.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
238da8ddd9 lvcreate: add extra synchronization at error path
Put explict udev synchronization before we try to deactive devices.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
b490cddfbc tests: switch for checking version of installed tools
It looks like older tools were compacting metadata more.
2020-10-16 17:07:59 +02:00
Wu Guanghao
844037ecdf pvmove: check return value of top_level_lv_name()
The return value of top_level_lv_name() may be NULL, so we should
check return value of top_level_lv_name before calling
strcmp(lv->name, top_level_lv_name(vg, lv_name)).

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-10-16 17:07:59 +02:00
Zhao Heming
5b579fa796 gitignore: ignore all cscope generated files
When using cscope to read code, it will generate below 3 files for speedup
cross-refer: cscope.files, cscope.in.out, cscope.po.out

The .gitignore only contains "/cscope.out". It a little bit messy when
executing 'git status', and other git commands.
This patch add all cscope generated files in .gitignore.

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2020-10-16 17:07:59 +02:00
David Teigland
9345b9cb26 devices: simplify md superblock checking code 2020-10-16 17:07:59 +02:00
David Teigland
57ddaaa47d devices: detect md ddf and imsm superblocks 2020-10-16 17:07:59 +02:00
Zhao Heming
db7aef215a dev-cache: dev->bcache_fd default from 0 to -1
This fix can avoid bcache_fd will mistakenly open/close in later.

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2020-10-16 17:07:59 +02:00
David Teigland
667cfeeacf vgrename: fix error value when name exists 2020-10-16 17:07:59 +02:00
Zdenek Kabelac
d1f7c531eb tests: improve cache abort test
Use bigger volume and slowdown writing to cache device.
This allows more simple to reach 'dirty' state.
Also document exactly 1 SIGINT has to fire aborting of flushing.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
4ebc8875d3 tests: check in_sync prints also dm status
It's more useful to see how the progress of status checking is moving.
2020-10-16 17:07:59 +02:00
Zdenek Kabelac
0881ba9e9f cache: simplier signal handling
Use just single sigint_allow()/restore() within flushing loop
and void one extra signal manipulation.
2020-10-16 17:07:59 +02:00
Marian Csontos
de17c273de README: update 2020-10-16 17:07:58 +02:00
Zdenek Kabelac
ff75d40298 cov: drop checking for EWOULDBLOCK
Reduce cov warning and remove this really ancient define
as lvm2 was never compilable on such platform.
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
92ee7e4c1f cov: drop model for origin_from_cow 2020-10-16 17:07:58 +02:00
Wu Guanghao
9c6089b2d0 lvconvert_poll: ensure LV has snapshot type
LV may not be a snapshot type, the return value of find_snapshot(lv) may be NULL.
Here, we will call stack if LV is not a snapshot type.

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
a83e153670 lvconvert: check if LV has cow type
Cow may not be a COW type, the return value of origin_from_cow(cow) may be NULL.

Reported-by: Wu Guanghao <wuguanghao3@huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
d7131ab439 tests: check for boundary allocation sizes 2020-10-16 17:07:58 +02:00
Zdenek Kabelac
81538e6e50 tests: have_cache function checks for cache-pool
Check for cache-pool segment as plain cache can match writecache.
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
c563af0476 tests: aux collects stack trace when stuck is assumed
Automatically collect traces in this case.
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
57585ebacd tests: disable dbustest with valgrind testing 2020-10-16 17:07:58 +02:00
Zdenek Kabelac
8ad7c344cd tests: use delayzero_dev
Speed-up a bit the first synchronization with just 50ms write delay,
but later set also delay on read to slowdown lvextend.

FIXME: there are still things to look at:

0 229376 raid raid1 2 AA 229376/229376 idle 0 0
0 229376 raid raid1 2 AA 0/229376 frozen 0 0 -
0 262144 raid raid1 2 AA 229376/262144 repair 0 0 -
0 262144 raid raid1 2 AA 229376/262144 repair 0 0 -
0 262144 raid raid1 2 AA 245888/262144 repair 0 0 -
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
5ac48c0655 tests: add aux delayzero_dev support
Just like we have 'writeerror_dev' supporting creation of device
which 'readable' segment and segments where write will fail we
have now support for delay zero mappings.

This is useful if we want to 'fake' large writing areas where we do
not really care about the actual 'disk' content - since we test
operation logic and it doesn't matter we read and write zeroes.
With combination with 'delay' target we can create specific mappings
and avoid using large memory areas of ramdisk.
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
8744d97c7b alloc: improve estimation of sufficient_pes_free
Metadata size was calculated correctly only for raids.

Fixes problem for crash during lvcreate when thin-pool was created
on a VG where remaining free space had the size to only fit a single
metadata LV and not also its _pmspare.

Lvcreate crashed with this assert message:

lvcreate: metadata/pv_map.c:198: consume_pv_area: Assertion `to_go <= pva->count' failed.
Aborted (core dumped)

TODO: there is probably to large overload of several alloc_handle
variables.

Reported-by: Wu Guanghao<wuguanghao3@huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
6b1f67da06 thin: compensate metadata size by extra percent
When using --use-policy for automatic extension of thin-pool,
the extension of thin-pool's metadata itself can actually take
some extra space.
Since I'm not aware of exact compensation formula, add just
1% extra to calculated amount and hope it fits.

Wanted target is to always have usable thin-pool that fits
bellow pool_metadata_min_threshold().
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
e5066339a5 cleanup: comment typo 2020-10-16 17:07:58 +02:00
Zdenek Kabelac
5190e16c30 lvextend: improve percentage estimation
Correcting rounding rules for percentage evaluation.

Validate supported range of percentage.
(although ranges are already validated earlier on code path)
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
68f94a2dd3 man: correctly use configured directories 2020-10-16 17:07:58 +02:00
Zdenek Kabelac
6d2fc49e99 lv_manip: add synchronization points 2020-10-16 17:07:58 +02:00