1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-27 01:57:55 +03:00

15900 Commits

Author SHA1 Message Date
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
Marian Csontos
7ea50a47d1 build: make generate 2020-05-19 11:38:23 +02:00
Zdenek Kabelac
bac7d5951d WHATS_NEWS: update 2020-04-08 15:36:01 +02:00
Zdenek Kabelac
70d2ff38c0 test: repair of thin-pool used by foreign apps 2020-04-08 15:31:17 +02:00
Zdenek Kabelac
1316cafbe9 lvconvert: no validation for thin-pools not used by lvm2
lvm2 supports thin-pool to be later used by other tools doing
virtual volumes themself (i.e. docker) - in this case we
shall not validate transaction Id - is this is used by
other tools and lvm2 keeps value 0 - so the transationId
validation need to be skipped in this case.
2020-04-08 15:31:17 +02:00
Zdenek Kabelac
5f766b32cf container_of: use offsetof from stddef
Use standardized offsetof() macro from stddef.
Helps to build valid code with latest gcc10 with -O2.
2020-04-08 15:22:54 +02:00
Zdenek Kabelac
5d93892d4a dmeventd: enhance time waiting loop
dmeventd is 'scanning' statuses in loop (most usually in 10sec
intervals) - and meanwhile it sleeps within:
pthread_cond_timedwait()

However this function call tends to wakeup sometimes a short amount of
time sooner - and our code still believe the 'right time' has not yet
arrived and basically for a moment 'busy-looped' on calling this
function - so for systems with 'clock_gettime()' present we obtain
time and we go 10ms to the future second - this avoids unneeded
repeated invocation of our time scheduling loop.

TODO: monitoring during 1 hour 'time-change'...
2020-04-08 15:22:54 +02:00
Zdenek Kabelac
8f3d2d5e11 libdm: fix dm_list pointer arithmentic for new gcc 10 optimization 2020-04-08 15:22:54 +02:00
Marian Csontos
2e3791b421 post-release 2020-03-24 19:22:53 +01:00
Marian Csontos
84c239c4e5 pre-release v2_02_187 2020-03-24 19:21:50 +01:00
David Teigland
20d61a2553 pvs: fix locking_type 4
Fix for commit 79c4971210a6337563ffa2fca08fb636423d93d4.
This bug leads lvm to attempt a bogus recovery of the
orphan VG whenever the orphan VG is read.
No recovery code exists for the orphan VG, but lvm still
attempts it when the "consistent" variable is not set to 1.

When lvm attempts the bogus/no-op orphan recovery, it tries
to get a write lock.  Usually the write lock succeeds, and
"recovery" does nothing, so fairly harmless.  But, with
locking_type=4, the write lock fails, which bubbles up to
cause the whole command failure.
2020-03-06 09:06:10 -06:00
Marian Csontos
deaf304ee6 bcache: Fix memory leak in error path 2020-03-04 13:22:10 +01:00
David Teigland
44c460954b Fix rounding writes up to sector size
Do this at two levels, although one would be enough to
fix the problem seen recently:

- Ignore any reported sector size other than 512 of 4096.
  If either sector size (physical or logical) is reported
  as 512, then use 512.  If neither are reported as 512,
  and one or the other is reported as 4096, then use 4096.
  If neither is reported as either 512 or 4096, then use 512.

- When rounding up a limited write in bcache to be a multiple
  of the sector size, check that the resulting write size is
  not larger than the bcache block itself.  (This shouldn't
  happen if the sector size is 512 or 4096.)

(cherry picked from commit 7550665ba49ac7d497d5b212e14b69298ef01361)

Conflicts:
	lib/device/dev-io.c
2020-03-04 13:20:36 +01:00
Zdenek Kabelac
253d10f840 raid: better place for blocking reshapes
Still the place can be better to block only particular reshape
operations which ATM cause kernel problems.

We check if the new number of images is higher - and prevent to take
conversion if the volume is in use (i.e. thin-pool's data LV).

(cherry picked from commit 96985b1373d58b411a80c2985f348466e78cbe6e)
2020-02-10 15:44:46 +01:00
wangjufeng
bcf9556b8f lvmetad: fix heap memory leak
error could be reproduced by calling pvs periodically:
    #!/bin/bash
    while :
    do
        pvs
        sleep 1
    done

use top command to watch RES memory of lvmetad. After a few minutes,
its RES memory will grow for a few KB. Then stop calling pvs, while
its RES will not decrease.

This is because, when lvmetad make reponse for clent request, it
will malloc new chunk for s->vgid_to_metadata, while actually the
new chunk should be added to the reponse dm_config_tree, or it will
make the chunk list of s->vgid_to_metadata keep growing.

Signed-off-by: wangjufeng <wangjufeng@huawei.com>
Reviewed-by: liuzhiqiang <liuzhiqiang26@huawei.com>
Reviewed-by: guiyao <guiyao@huawei.com>
2020-02-05 15:30:17 -06:00
Zdenek Kabelac
a1f06e2fae tests: partial revert of test change of b6e6ea2d65785f03f3cee7938be635bcb8ad4944
With the update with commit b6e6ea2d65785f03f3cee7938be635bcb8ad4944
the test file has been updated - however stable branch still has
clvmd & lvmetad so we want to omit runnig unit tests for these runs.
2020-01-21 17:07:20 +01:00