1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-21 02:50:41 +03:00

15717 Commits

Author SHA1 Message Date
Zdenek Kabelac
ea036ecfd3 libdm: implement search for device names for older kernels
Kernels <2.6.27 don't have /sys/dev dir - add code for looking
out device name via longre seach in /sys/block

This makes commands like 'dmsetup dep -o blkdevname' working.
2019-07-06 01:24:28 +02:00
Peter Rajnoha
1650c10438 udev: do not overwrite ID_MODEL in 69-dm-lvm-metad.rules
We've been assigning this in 69-dm-lvm-metad.rules:

  ENV{ID_MODEL}="LVM PV $env{ID_FS_UUID_ENC} on /dev/$name"

This was for the description to appear for each systemd device
unit representing this device, for example:

  $systemctl -a | grep "LVM PV"
  dev-block-252:2.device                                                                                         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  dev-disk-by\x2did-lvm\x2dpv\x2duuid\x2dJhxC7B\x2dYTgk\x2d3jIU\x2d5GVo\x2dc4gV\x2dW8t3\x2dUUz06p.device         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  ...

However, there could be an actual ID_MODEL that people are interested in
more than the fact that this is an LVM PV and so we shouldn't overwrite
the value.

Also, we already have a symlink /dev/disk/by-id/lvm-pv-uuid-<PV_UUID>
created which is then reflected as device unit (all device's symlinks
have systemd device unit representation) so we can still reach this
information in systemd unit listings even without setting the ID_MODEL.

Reported here: https://github.com/lvmteam/lvm2/issues/21
2019-07-04 13:06:44 +02:00
David Teigland
b13ebfa4c2 pvremove/vgextend: fix using device aliases with lvmetad
These commands were looking for the requested device alias
before dev_cache_scan had created the list of devs on the
system, so they would fail and report the dev wasn't found.
2019-06-26 16:06:23 -05:00
Zdenek Kabelac
b62c0787de cov: remove unused headers 2019-06-25 17:34:56 +02:00
Zdenek Kabelac
ff2bf11360 cov: ensure cname exists before derefering it
Just make it clear to analyzers  cname can't be NULL.
TODO: maybe exclude NULL at front of the function...
2019-06-25 17:34:18 +02:00
Zdenek Kabelac
7232458b6c cov: validate pagesize is not negative
As _init_free_list() cannot accept negative numbers
2019-06-25 17:33:47 +02:00
Zdenek Kabelac
8bea252a63 cov: clearer condition check
Make the code more obvious.
2019-06-25 17:33:47 +02:00
Zdenek Kabelac
66665f5e42 cov: add stack tracing for error paths
Add missing stack reports on error paths.
2019-06-25 17:33:25 +02:00
Zdenek Kabelac
5cf1c61152 cov: check for socket_path being set
As we check for existince on entering path
let's ensure it's there also on exit path.
2019-06-25 17:33:25 +02:00
Zdenek Kabelac
2cd6cd3439 cov: check lv_info
Use lv_info results only when valid.
2019-06-25 17:32:44 +02:00
Zdenek Kabelac
82e7426028 cov: check result of dev_get_block_size 2019-06-25 17:32:44 +02:00
Zdenek Kabelac
862899cc88 cov: check result of dev_read_bytes 2019-06-25 17:32:44 +02:00
Zdenek Kabelac
09aafb61e3 cov: release iterator on error path 2019-06-25 17:32:44 +02:00
Zdenek Kabelac
3b42cdad0c cov: unlock lvm2 mutex on error path
Add missing unlock call on theretical error path where
we would be missing our configured command.
2019-06-25 17:31:39 +02:00
Zdenek Kabelac
49813abc00 tests: for cluster always use exlusive mirrors
So to check the reason of failure is not influenced by missing cmirrord.
2019-06-21 14:51:17 +02:00
Zdenek Kabelac
788d89c412 tests: accept also value 512
Older kernels provide fixed value 512 instead of 0.
2019-06-20 14:20:35 +02:00
Zdenek Kabelac
e0a176f49a tests: properly enforce v1
Since with smq policy we can still pick format v2 - enforce
format v1 explicitely.
2019-06-20 11:21:59 +02:00
Zdenek Kabelac
24186cd9ce tests: drop unwanted backup 2019-06-20 11:21:59 +02:00
Zdenek Kabelac
2806e6265f tests: for cluster testing we always need exclusive mirrors
Cluster test would fail without exlusively activated mirror.
FIXME: test is still broken, since LV2 is not active after split.
2019-06-20 11:21:59 +02:00
Zdenek Kabelac
02a5921cdb tests: check for installed time command
If the /usr/bin/time command is not installed, skip test
(do not want to use shells' built-in).
2019-06-20 11:21:08 +02:00
Zdenek Kabelac
b61c89b52b tests: update resize value
Since we now properly extend also _pmspare - there was not enough free
space to add 8extents to both volumes.
2019-06-20 10:55:55 +02:00
Zdenek Kabelac
78c937552a tests: simplify some var settings
scan_lvs now automatically comes with extend_filter_LVMTEST
2019-06-20 00:05:46 +02:00
Zdenek Kabelac
a311684c4a aux: fix selecting lvmconf values
For older bashes (i.e. rhel5) code can't use internal bash arrays
and uses old-school greps and sorts to create configuration file.
But the split of value was mismatching names with same prefix
so  i.e.

devices/scan
devices/scan_lvs

was matching always the later one - fix this by expecting
whitespace or '=' after the name.
2019-06-20 00:05:46 +02:00
David Teigland
f3a87a2c2e Revert "lvconvert: disable linear to mirror of active LV in cluster VG"
This reverts commit 8623e336513c6ac6fcb24aa7e2ef10b8a3a36c59.

The problem this was avoiding now seems to be fixed by
commit d6bce036155ae973c869bdce3ca5f824f933f599
  mirror: fix monitoring change
2019-06-19 10:40:37 -05:00
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