1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-30 01:47:56 +03:00

15793 Commits

Author SHA1 Message Date
Zdenek Kabelac
1727df7c98 tests: check mirror with clvmd and dmeventd 2019-06-19 13:38:57 +02:00
Zdenek Kabelac
29ae8b8ca5 tests: fix ra checking
Since with some installed package like 'tuned' the value of 'RA' on
PV origin device can be different, adapting tests to count with this.
2019-06-19 13:37:11 +02:00
Zdenek Kabelac
e80ca65d30 tests: replaces grep -q usage
Since we use 'set -euE -o pipefail' for shell execution,
any failure of any command in the 'piped' shell can result
in failure of whole executed chain - resulting in typically
unsually test skip, that was left unnoticed.

Since checked command have usually short output, the simplest
fix seems to be to let grep parse whole output instead
of quiting after first match.
2019-06-19 13:36:58 +02:00
Zdenek Kabelac
d6bce03615 mirror: fix monitoring change
Commit a8921be641afe865c177e11b8859f4b937f76995 was supposedly a fix
for unwanted table reload - however before final commit, the tiny
change has been made that was believed to be an enhancment
of original prepared patch. Unfortunatelly the function
locking_is_clustered is not meant to be an equivalent test
of original function.  Drop this change and using
original patch.
2019-06-19 13:33:53 +02:00
David Teigland
8623e33651 lvconvert: disable linear to mirror of active LV in cluster VG
Avoid bug 1711427 in which an exclusively active linear LV in a
clustered VG, when upconverted to a mirror, will mistakenly use
a userspace/cmirror log in _add_log() beause laopts.exclusive is
not set.
2019-06-14 10:26:21 -05:00
David Teigland
c31e6b0aca lvmcache: remove unused_duplicate_devs list from cmd
Save the previous duplicate PVs in a global list instead
of a list on the cmd struct.  dmeventd reuses the cmd struct
for multiple commands, and the list entries between commands
were being freed (apparently), causing a segfault in dmeventd
when it tried to use items in cmd->unused_duplicate_devs
that had been saved there by the previous command.
2019-06-06 14:12:19 -05:00
Zdenek Kabelac
cb7766bc14 tests: check no_discard_passdown
Check reporting works
2019-06-05 15:54:59 +02:00
Zdenek Kabelac
1308572a87 tests: automatically set scan_lvs when using extend_filter
When using 'aux extend_filter' we always want to use LV as PV.
2019-06-05 15:54:59 +02:00
Zdenek Kabelac
adf9bf80a3 cache: support no_discard_passdown
Recent kernel version from kernel commit:
de7180ff908b2bc0342e832dbdaa9a5f1ecaa33a
started to report in cache status line new flag:
no_discard_passdown

Whenever lvm spots unknown status it reports:
Unknown feature in status:

So add reconginzing this feature flag and also report this with

'lvs -o+kernel_discards'

When no_discard_passdown is found in status 'nopassdown' gets reported
for this field  (roughly matching what we report for thin-pools).
2019-06-05 15:54:58 +02:00
Zdenek Kabelac
f633d68c54 tests: update cache test
Since migration_threshold is now protected to not be smaller
then 8*chunk_size - update tests to count with this modification.

(cherry picked from commit 2cac4bfc150ea1e5459580e3bac4907446ea7f3a)
2019-06-05 11:23:25 +02:00
David Teigland
c733e96445 man: updates to lvmlockd
- remove references to adopting locks which is not used
- move some sanlock-specific info out of a general section
- remove info about doing automatic lockstart by the system
  since this was never used (the resource agent does it)
2019-05-21 15:14:24 -05:00
David Teigland
3669c33af4 lvmlockd: do not allow mirror LV to be activated shared
This reverts 518a8e8cfbb672c2bf5e3455f1fe7cd8d94eb5b0
  "lvmlockd: activate mirror LVs in shared mode with cmirrord"

because while activating a mirror LV with cmirrord worked,
changes to the active cmirror did not work.
2019-05-21 15:06:37 -05:00
Marian Csontos
e2ae1f2d71 post-release 2019-05-13 09:57:57 +02:00
Marian Csontos
3aeff09bd7 pre-release v2_02_185 2019-05-13 09:51:28 +02:00
Zdenek Kabelac
d5a5792b30 tests: check accepting out-of-range creation_time 2019-05-10 15:07:25 +02:00
Zdenek Kabelac
a397b69ce3 metadata: allow reading metadata with invalid creation_time
lvm2 till version 2.02.169 (commit 78d004efa8a1809cea68283e6204edfa9d7c1091)
was printing invalid creation_time argument into metadata on 32bit arch.

However with commit ba9820b14223b731125c83dbc9709aa44fdcdbf1 we started
to properly validate all input numbers and thus we refused to accept
invalid metadata with 'garbage' string - but this results in the
situation where metadata produced on older lvm2 on 32 bit architecture
will become unreadable after upgrade.

To fix this case - extend libdm parser in a way, that whenever we
find error integer value, we also check if the parsed value is not for
creation_time node and in this case we let the metadata pass through
with made-up date 2018-05-24 (release date of 2.02.169).
2019-05-10 15:07:15 +02:00
Zdenek Kabelac
a8921be641 monitoring: fix monitoring change for cluster
Fix bug in table reload for clustered VG.
Function used in lv/vgchange --monitor y|n is using 'somewhat' hackish
shortcut and accesses activation function monitor_dev_for_events()
directly rather through full device refresh to avoid table reload
in case user want to only change monitoring state of device.
However since with old 'mirrors' there is table change dropping
handle_error there was in some cases needed table update.

This was put into monitor_dev_for_events() with assumption
vg_write_lock_held() could be used to decide if the actual monitoring
change comes from read-only lock-holding commands lvchange/vgchange.
However the clustered locking part (clvmd) actually doesn't differentiate
about this concept of having VG openned in read-only or write mode.
So it caused unwanted reloads of mirror tables even in commands like lvconvert.

Thus for clustered locking there is full table reload put into the code and
shortcut applies only for non-clustered locking.

Also the patch tries to avoid calling repeated LV refresh in case the
lv/vgchange uses  --refresh & --monitor.
2019-05-06 15:57:52 +02:00
Zdenek Kabelac
9d7afaaab8 tests: update parm for new kernel 2019-04-30 13:16:31 +02:00
Zdenek Kabelac
71b9cb8e0f tests: extend 2019-04-30 13:16:19 +02:00
Zdenek Kabelac
057d866889 tests: rounding for pools changed to power of 2
Even with 64K chunk support, lvm2 will target power-of-2 chunks.
2019-04-30 13:14:27 +02:00
Zdenek Kabelac
e79e092f8b lv_manip: better work with PERCENT_VG modifier
When using 'lvcreate -l100%VG' and there is big disproportion between
real available space and requested setting - automatically fallback
to 100%FREE.

Difference can be seen when VG is big and already most space was
allocated, so the requestion 100%VG can end (and by spec for % modifier
it's correct) as LV with size of 1%VG.  Usually this is not a big
problem - buit in some cases - like cache-pool allocation, this
can result a big difference for chunksize selection.

With this patch it's more closely match common-sense logic without
the need of reitteration of too big changes in lvm2 core ATM.

TODO: in the future there should be allocator solving all allocations
in a single call.
2019-04-30 12:24:53 +02:00
Zdenek Kabelac
4729b4af0b thin: select chunk size as power of 2
Whenever thin-pool chunk size is unspecified and left for lvm calculation
try to select the size as nearest highest power-of-2 instead of
just being a multiple of 64KiB. When multiple is bigger then 1MiB,
keep using 1MiB multiple.
2019-04-30 12:11:50 +02:00
Zdenek Kabelac
f3be66c002 lv_manip: insert remove layer skips pools
Fixing renaming of subLVs when removing and inserting layers - this
got visible when using stacked VDO pools.
2019-04-30 12:08:36 +02:00
Zdenek Kabelac
2047d405af activation: synchronize before removing devices
Udev is running udev-rule action upon 'resume'.

However lvm2 in special case is doing replacement of
'soon-to-be-removed' device with 'error' target for resuming
and then follows actual removal - the sequence is usually quick,
so when udev start action - it can result in 'strange' error
message in kernel log like:

Process '/usr/sbin/dmsetup info -j 253 -m 17 -c --nameprefixes --noheadings --rows -o name,uuid,suspended' failed with exit code 1.

To avoid this - we need to ensure there is synchronization wait for udev
between 'resume'  and 'remove' part of this process.

However existing code put strict requirement to avoid synchronizing with
udev inside critical section - but this originally came from requirement
to not do anything special while there could be devices in
suspend-state. Now we are able to see differnce between critical section
with or without suspended devices.  For udev synchronization only
suspended devices are prohibited to be there - so slightly relax
condition and allow calling and using 'fs_sync()' even inside critical
section - but there must not be any suspended device.
2019-04-30 12:07:42 +02:00
Zdenek Kabelac
1370277ea7 tests: check auto-growth of thin-pool meta 2019-04-30 12:06:08 +02:00
Zdenek Kabelac
f38cfd09c4 thin: fix maintenance of _pmspare
When metadata grows lvm2 may need to extend also _pmspare volume.
2019-04-30 12:02:49 +02:00
Zdenek Kabelac
515867bbad thin: resize metadata with data
When data are growing, adapt also size of metadata.
As we get way too many reports from users doing huge growths of
data portion while keep metadata small and avoiding using monitoring.

So to enhance the user-experience in case user requests grown of
thin-pool (without passing PV list for growth) - lvm2 will automaticaly
grown also the metadata part of thin-pool (if possible).
2019-04-30 12:02:49 +02:00
Zdenek Kabelac
bcf1aa99e6 thin: introduce estimate_thin_pool_metadata_size
Add function for estimation of thin-pool metadata size for given size of
data. Function is using already existing internal API so it can
be reused for resize of thin-pool data.
2019-04-30 12:02:49 +02:00
Zdenek Kabelac
b41b112a4b libdaemon: ensure threads are reaped before checking shutdown
Since we are checking _shutdown_requested - we expect all threads
are finished - that is currently checked only by checking ->next ptr
being NULL - so this can be NULL only when _reap() function clears
out all already finished threads.

I'm finding this design quite problematic in its core - but as a
'trivial hotfix' - lets _reap() linked list before check for signal.

There is likely a large potentical for few races - but the windows is
very very small - since lvmetad has been already purged from upstream,
lets go with this hotfix.
2019-04-29 13:49:33 +02:00
David Teigland
559cf0cd1e devices: drop open error message
This open error is being printed in more common,
non-error circumstances than expected.  After a
number of complaints make it only a debug message.
2019-04-23 09:42:25 -05:00
Zdenek Kabelac
228e331e27 cleanup: missed string specifier 2019-04-17 11:29:35 +02:00
Zdenek Kabelac
3ead62e24b tests: check vgsplit works with cache 2019-04-16 12:57:18 +02:00
Zdenek Kabelac
fa025cdd9a cache: support vgsplit
Enable vgsplit to work with VG containing cached LVs.
2019-04-16 12:57:18 +02:00
Marian Csontos
f5d1f4f086 Wiping require exclusive actvation
The master branch uses activate_lv only, but on the stable branch
activate_lv_excl_local was used. This patch restores the constraints.

Fix regression from bad cherry pick: 9b04851fc574ce9cffd30a51d2b750955239f316
2019-04-16 08:26:34 +02:00
Heinz Mauelshagen
699bf86090 lvconvert: can't create cachepool with RAID1 metadata SubLV
Trying to convert an exiting RAID1 LV to cache metadata SubLV
fails because of missing exclusive activation during wiping.

Solve by activating the RAID1 metadata SubLV exclusively.

Resolves: rhbz1698866
2019-04-12 21:38:04 +02:00
Peter Rajnoha
03d6cfdd99 systemd: put back DefaultDependencies=no for lvmpolld and lvmetad socket unit
Previous commit 0a726a7e268b31856615491809af73bda5d4d6f9 removed this
by mistake - we have to keep the DefaultDependencies=no - the
sockets.target is after sysinit.target.
2019-04-11 12:25:45 +02:00
Zdenek Kabelac
6064b9f1b2 gcc: cleanup const warning 2019-04-10 13:30:34 +02:00
Zdenek Kabelac
6d4f36c2c7 libdaemon: use pselect to avoid condition checking race
To avoid tiny race on checking arrival of signal and entering select
(that can latter remain stuck as signal was already delivered) switch
to use  pselect().

If it would needed, we can eventually add extra code for older systems
without pselect(), but there are probably no such ancient systems in
use.
2019-04-10 13:28:45 +02:00
Zdenek Kabelac
63289b54c7 configure: check for pselect 2019-04-10 13:24:41 +02:00
Peter Rajnoha
0a726a7e26 systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.

Reported here: https://github.com/lvmteam/lvm2/issues/17
2019-04-09 12:40:55 +02:00
Marian Csontos
b79f1e176f bcache: Fix memory leak 2019-04-04 10:19:15 +02:00
Marian Csontos
81d954df4e post-release 2019-03-22 11:13:08 +01:00
Marian Csontos
7cbee7e9cf pre_release v2_02_184 2019-03-22 11:04:15 +01:00
Marian Csontos
717957ddc5 build: make generate 2019-03-22 11:01:04 +01:00
Heinz Mauelshagen
9b04851fc5 raid: fix (de)activation of RaidLVs with visible SubLVs
There's a small window during creation of a new RaidLV when
rmeta SubLVs are made visible to wipe them in order to prevent
erroneous discovery of stale RAID metadata.  In case a crash
prevents the SubLVs from being committed hidden after such
wiping, the RaidLV can still be activated with the SubLVs visible.
During deactivation though, a deadlock occurs because the visible
SubLVs are deactivated before the RaidLV.

The patch adds _check_raid_sublvs to the raid validation in merge.c,
an activation check to activate.c (paranoid, because the merge.c check
will prevent activation in case of visible SubLVs) and shares the
existing wiping function _clear_lvs in raid_manip.c moved to lv_manip.c
and renamed to activate_and_wipe_lvlist to remove code duplication.
Whilst on it, introduce activate_and_wipe_lv to share with
(lvconvert|lvchange).c.

Resolves: rhbz1633167
(cherry picked from commit dd5716ddf258c4a44819fa90d3356833ccf767b4)

Conflicts:
	WHATS_NEW
	lib/activate/activate.c
	lib/metadata/lv_manip.c
	lib/metadata/raid_manip.c
	tools/lvchange.c
	tools/lvconvert.c
2019-03-21 08:05:23 +01:00
David Teigland
dcf8f3111a pvscan: lvmetad init should set updating before scanning
When pvscan needs to initialize lvmetad (e.g. lvmetad has just
started and is empty), it should set the lvmetad state to "updating"
before it scans any devices.  Otherwise, many parallel pvscans
will try to initialize lvmetad, and in some cases earlier pvscans
with fewer devices information may replace newer pvscans with
more recent information.
2019-03-07 11:07:27 -06:00
David Teigland
ece0b131e5 config: improve scan_lvs description 2019-03-06 13:38:33 -06:00
Alasdair G Kergon
519f4453a5 dmsetup: Fix multi-line concise table parsing
Use the correct loop variable within the loop, instead of reusing the
initial value.  Table lines after the first don't get terminated in
the right place.

Signed-off-by: Kurt Garloff <kurt@garloff.de>
(cherry picked from commit ccfbd505fea2f259f7c89dc23b020b838363a611)
2019-03-05 13:01:40 +01:00
Zdenek Kabelac
bc6ae7030a dm: migration_threshold for old linked tools
Just like with precending  lvm2 device_mapper patch, ensure
that old users of libdm will also get fixed migration threshold
for caches.

(cherry picked from commit 74ae1c5bc1150005ae6e82c90415c433f4a24cbd)

Conflicts:
	WHATS_NEW_DM
2019-03-05 13:01:19 +01:00
Zdenek Kabelac
167aa34926 stats: initilize regions to NULL
Commit 3750b0cff5ab1c41076afdf8275e3fa20aa756d0 used bad: error
path in more occasions thus it now needs regions defined as NULL.

(cherry picked from commit 83c6f7e7e6e76199d836bf694266c78e3cbc12f1)
2019-03-05 12:57:50 +01:00