1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

16065 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
6de0f5eab9 tests: check we detect lvm.conf read failure
No coredumps with unreadable lvm.conf.
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
2dc1981a5a config: drop reading file with mmap
While normally the 'mmap' file reading is better utilizing resources,
it has also its odd side with handling errors - so while we normally
use the mmap only for reading regular files from root filesystem
(i.e. lvm.conf) we can't prevent error to happen during the read
of these file - and such error unfortunately ends with SIGBUS error.
Maintaing signal handler would be compilated - so switch to slightly
less effiecient but more error resistant read() functinality.
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
2839912d12 tools: move struct element before variable lenght list
Move prio field before 'variable' struct array field.
Interesting why this has not been catched yet.

TODO: think about test case
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
86056c56f4 gcc: drop bogus ; 2020-10-16 16:02:06 +02:00
Zdenek Kabelac
f7b4b127e9 gcc: do not use return with void function
Follow C norm and do not use 'return' in void function to call other
functions.
2020-10-16 16:02:06 +02:00
Zdenek Kabelac
55a8b1bd37 gcc: use apropriate type for reading and printing values 2020-10-16 16:02:05 +02:00
Zdenek Kabelac
d48266b7fb gcc: avoid stack alloc arithmetic 2020-10-16 16:02:05 +02:00
Zdenek Kabelac
90a9a7785e gcc: keep unsigned arithmetic
Avoid conversion to int.
2020-10-16 16:02:05 +02:00
Zdenek Kabelac
94b5aa0aad lv_manip: get_default_region_size return uint32_t 2020-10-16 16:02:05 +02:00
Zdenek Kabelac
9ffe17d2a8 lvmcache: use uint32_t for seqno caching 2020-10-16 16:02:05 +02:00
Zdenek Kabelac
950a9bbde9 container_of: drop needless const converion 2020-10-16 16:02:05 +02:00
Zdenek Kabelac
c4202bf458 raid: no wiping when zeroing raid metadata device
Currently lvm2 is not wiping signatures when creating 'metadata' volumes
and raid _rmeta was the only exception - so make the behavior consistent
with other metadata devices and drop wiping ATM.
Drop also some extra debug since they are now more explanatory in
wipe_lv() function.
Also note - although lvm2 now does not wipe signatures - the error
from such wipping used to be actually 'ignored' before wipe_lv()
started to return error (with recent commit) and raid creation
continued with 'unzeroed' metadata device.

TODO: Several issues to resolve:

1. We may want to flip to wipping with all LVs (in that case we need to
support passing --yet & --force).

2. Also we may want to clear whole metadata device - however current
function is also used for wipping i.e. snapshot COW device which
is likely not a good candidate for full device zeroing.
We may also need to think about better logic when extent size is
enforcing very large LVs, when only a small portion of LV is ever
being used.

3. Using TRIM instead of zeroing metadata device might be worth to
implement.

mm
2020-10-16 16:02:05 +02:00
Zdenek Kabelac
e397423c41 bcache: support longer writes
When initiated larger write request, it may have happened, bcache
got out of free chunks - fix the loop, that is supposed to wait
until next free chunk becomes avain available.
2020-10-16 16:02:05 +02:00
Zdenek Kabelac
3388779570 tests: add wait on udev processing
Trying to avoid collision with udev watch rule preventing to
succeed 'dmsetup remove' because it keeps device open.
2020-10-16 16:02:05 +02:00
Zdenek Kabelac
3b995b8018 cov: check strdup for NULL 2020-10-16 16:02:05 +02:00
Heinz Mauelshagen
7e2ceba2fb Revert "lvconvert: display warning if raid1 LV image count does not change"
This reverts commit 7f41d49f497e2b886f197121551db585dff29b6e as
_lv_raid_change_image_count() already checks for non-changed image count.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1872130
2020-09-28 17:17:26 +02:00
Heinz Mauelshagen
7f41d49f49 lvconvert: display warning if raid1 LV image count does not change
Fix "lvconvert -mN $RaidLV" to display a warning in
case the same number of images is being requested.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1774696
2020-07-20 15:43:31 +02:00
Heinz Mauelshagen
61e831aa5e lvconvert: preset raid1 in case of striped conversions
Fixed invoking "lvconvert -m+1 $StripedLV" to cause errors
(preset raid conversion implied by '-m').

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1781406
2020-07-13 19:16:47 +02:00
Heinz Mauelshagen
7ebe1bc901 lvconvert: fix conversion to 'mirrored' mirror log with larger regionsize
merge.c:_check_lv_segment() was checking regionsize vs. mirrored LV size on
any 'mirror/raid1/raid10' segment type including type 'mirrored' mirror logs.

Avoid the check only for 'mirrored' mirror logs to allow conversion from log
type 'disk' with regionsize > mirror log SubLV size.

As we disabled support for 'mirrored' mirror logs with
commit e82303fd6abc3ae43168f8032806c7c17d181a3e which still conditionally
allows to enable it via global/support_mirrored_mirror_logs=1,
patch is mandatory for all distributions.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1712983
2020-07-09 14:43:23 +02:00
Heinz Mauelshagen
e7e2288ff4 lv{resize,extend,reduce}: also check for 2-legged raid4
Users can also convert 2-legged raid1 to raid4 thus causing 'Bus error'
on resize requests.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1784351
2020-06-24 14:04:36 +02:00
Heinz Mauelshagen
d17780c6b8 lv{resize,extend,reduce}: reject size change on 2-legged raid5*
Reject size changing request in to avoid 'Bus error' and
display hint to convert to more stripes.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1784351
2020-06-24 13:57:13 +02:00
David Teigland
1fb7a9d9e5 scanning: optimize by checking text offset and checksum
stable backport of 0c1316cda876849d5d1375d40e8cdc08db37c2b5
which includes a number of extra supporting functions.

In stable, the optimization is only applied to reporting
and display commands, so this change applies only to those
cases.

After the VG lock is taken for vg_read, reread the mda_header
from disk and compare the metadata text offset and checksum
to what was seen during label scan.  If it is unchanged, then
the metadata has not changed since the label scan, and the
metadata does not need to be reread under the lock for command
processing. If it is changed, then reread the metadata from disk.

This fixes a problem with the original optimization where lvm
reuses cached data from the label_scan phase for vg_read. This
works if the mda_header and metadata text are both read from
cache, or both read from disk, but in some cases the mda_header
could have been dropped from the cache and read from disk, while
the metadata blocks remained in the cache and were not read from
disk. If in addition to this, another concurrent command happened
to update the metadata between the label_scan and vg_read, then
the new mda_header from disk would refer to cached blocks that did
not contain the new metadata text. This would cause the lvm command
report an error about invalid metadata.
2020-06-23 11:32:32 -05:00