1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-09 12:58:41 +03:00

15937 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
d063ea27b4 lvconvert: flip return value of _raid_split_image_conversion
Use '0' for error and '1' as success.
Also drop INTERNAL_ERROR from path - as this error
is ATM used for invalid devices.
(i.e. test lvconvert-raid1-split-trackchanges.sh)
2020-10-16 17:07:58 +02:00
Zdenek Kabelac
0bd9eb80c9 cleanup: better expressing passing key arg to _hash 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
f0c281f9a9 cleanup: add spaces between literals 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
736691ee6c cleanup: user force_t enums instead of ints 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
8e778995de cleanup: matching declaration order
Cosmetic
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
7c80bf4daa cov: explicitely ignore function result 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
29436d6da9 gcc: keep using unsigned type 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
d53456be24 gcc: zero-sized array to fexlible array C99
Switch remaining zero sized struct to flexible arrays to be C99
complient.

These simple rules should apply:

- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.

Although some of the code pieces should be still improved.
2020-10-16 16:02:06 +02:00
Zhao Heming
87769c5713 gcc: change zero-sized array to fexlible array
this patch makes gcc happy with compiling option: [-Wstringop-overflow=]

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
1ac22fb00b dmsetup: initilize winsize struct
Ensure winsize struct is always defined.
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
6b97921ee8 WHATS_NEW: update 2020-10-16 16:02:06 +02:00