1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00
Commit Graph

15836 Commits

Author SHA1 Message Date
Marian Csontos
c65f3fd8df dm: Fix compilation of dmsetup
Fix: 889c88e9da
2019-10-22 10:37:40 +02:00
Marian Csontos
c24fa7b7b7 cov: Clarify the control flow
Return need a clean up but it is not bailing out due to an error.

Fix: 402b41f58d
2019-10-21 15:32:09 +02:00
Zdenek Kabelac
3fe2610cff debug: drop some unneeded backtraces
(cherry picked from commit 88faf5a53b)

Conflicts:
	lib/format_text/export.c
	tools/lvconvert.c
2019-10-21 15:26:11 +02:00
Mikulas Patocka
889c88e9da dm: introduce DM_GET_TARGET_VERSION
Adds support for the DM_GET_TARGET_VERSION to dmsetup.
It introduces a new comman "target-version" that will accept list
of targets and print their version.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
(cherry picked from commit 667b33dd3b)

Conflicts:
	device_mapper/all.h
	device_mapper/ioctl/libdm-iface.c
	device_mapper/misc/dm-ioctl.h
2019-10-21 15:21:29 +02:00
David Teigland
f50af80199 devs: check for no dev when dropping aliases
When scanning fails to find a device path and
looks for device aliases, check if the device
itself still exists to avoid a potential segfault.
2019-10-16 13:32:28 -05:00
Marian Csontos
219c4c2ce2 spec: Fix lvm2-activation-generator man page handling
lvm2-activation-generator is not installed when systemd is not in the
system.

(cherry picked from commit b20b23dfc6)

Conflicts:
	spec/packages.inc
2019-10-04 16:32:52 +02:00
Heinz Mauelshagen
45ee63ede9 WHATS_NEW: new lvextend-raid.sh test 2019-10-02 17:06:22 +02:00
Heinz Mauelshagen
8632aa5fd3 test: increase size of raid10 LV allowing tests to succeed on fast storage
Also add health char check.
2019-10-02 17:03:52 +02:00
Heinz Mauelshagen
a0b30eadd1 test: add RAID lvextend resynchronization test
Due to a dm-raid target flaw fixed in target version 1.15.0,
extents of raid sets don't get resynchronized when new MD bitmp
pages have to be allocated due to the extension.

Introduce lvextend-raid.sh to test this flaw.

Related: rhbz1671964
2019-10-02 17:03:51 +02:00
Heinz Mauelshagen
a087da2f51 test: add checks for not 100% sync ratio after initiation of check/repair
Related: rhbz1640630
2019-10-02 17:03:49 +02:00
Bryn M. Reeves
1f970f590f dmsetup: do not treat no groups as an error in dmstats list --group
Analogous to the case of a device with no regions, it is not an
error to attempt to list the stats groups on a device that has no
configured groups: just return success and continue.
2019-09-30 17:12:21 +01:00
Zdenek Kabelac
61358d92cb lvmetad: fix timeout on shutdown
When lvmetad is going to be shutdown - there were 2 issue:
If there was endless stream of command contacting lvmetad - the process
would never finish - so now when we recieved  SIGTERM - we are no longer
accepting new connections and we just wait till the existing ones are
finished.

2nd. issue is that actually when we are waiting for finish of all client
threads - we basically want an usleep() and check if all threads
are already finished -  proper solution would be to singal from a thread
there is some work to do for master thread - but that would be a bigger
change and since lvmetad is no longer developed - keep the change
minimal and just use pselect() as our '1sec.' sleeping call once
we are in 'shutdown' mode.

Reported-by: wangjufeng@huawei.com
2019-09-30 13:39:44 +02:00
David Teigland
5d6bf1efb2 lvmetad: fix sync cache to lvmetad
error could be reproduced follow those steps:
    #!/bin/bash
    vgcreate vgtest /dev/sdb
    lvcreate -L 100M -n lv1 vgtest
    while :
    do
        service lvm2-lvmetad restart
        vgs &
        pvscan &
        lvcreate -L 100M -n lv2 vgtest &
        lvchange /dev/vgtest/lv1 --addtag xxxxx &
        wait
        if ! lvs|grep lv2;then
            echo "err create"
            break
        fi
        sleep 1
        lvremove -y /dev/vgtest/lv2
        lvchange /dev/vgtest/lv1 --deltag xxxxx
    done

and then fail to create vgtest/lv2, actually lv2 was created, while
the metadata written on disk is replaced by lvchange. It could look
up lv2 by calling dmsetup table, while lvs could not.

This is because, when lvmetad restarted, several lvm commands update
token concurrently, when lvcreate recieve "token_mismatch", it cancle
communicating with lvmetad, which leads to that lvmetad cache is not
sync with the metadata on disk, then lv2 is not committed to lvmetad
cache. The metadata of vgtest which lvchange query from lvmetad is
out of date. After lvchange, it use the old metadata cover the new one.

This patch let lvm process update token synchronously, only one command
update lvmetad token at a time.

lvmetad_pvscan_single send the metadata on a pv by sending "pv_found"
to lvmetad, while the metadata maybe out of date after waiting for the
chance to update lvmetad token. Call label_read to read metadata again.

Token mismatch may lead to problems, increase log level.

Signed-off-by: wangjufeng<wangjufeng@huawei.com>
2019-09-25 14:31:08 -05:00
David Teigland
2327f3997b tests: allow-mixed-block-sizes skip with older losetup
(cherry picked from commit 69b7c00a77)
2019-09-24 14:08:23 +02:00
David Teigland
9fcda0d975 WHATS_NEW: vgcreate/vgextend logical block size
(cherry picked from commit 3a0d493d91)

Conflicts:
	WHATS_NEW
2019-09-24 10:51:50 +02:00
David Teigland
f758d16b30 tests: allow-mixed-block-sizes
(cherry picked from commit cd8a0133fa)
2019-09-24 10:48:39 +02:00
Marian Csontos
444dedea23 build: make generate 2019-09-24 10:38:22 +02:00
Marian Csontos
92f1c888e0 lvmetad: Fix function prototype when not configured
Fixes: 6b129308
2019-09-24 10:34:44 +02:00
David Teigland
a57b92dec3 vgcreate/vgextend: restrict PVs with mixed block sizes
Avoid having PVs with different logical block sizes in the same VG.
This prevents LVs from having mixed block sizes, which can produce
file system errors.

The new config setting devices/allow_mixed_block_sizes (default 0)
can be changed to 1 to return to the unrestricted mode.

(cherry picked from commit 0404539edb)

Conflicts:
	tools/lvmcmdline.c
	tools/toollib.c
2019-09-24 10:14:30 +02:00
Heinz Mauelshagen
8d3e01ff4f dmeventd: avoid bail out preventing repair in raid plugin but keep message
Followup patch mentioned in previous commit 0585754593.

Problem:
  even though dead raid component devices are detected, the
  raid plugin is bailing out thus preventing a repair attempt.

Rational:
  in case of component device errors, the MD resynchronization
  thread runs in parallel with the thrown event being processed
  by the raid plugin.  The plugin retrieves the raid device status
  but that still reflects insync regions as 0 (when it should
  already be total regions) because the MD thread didn't update it yet.

Solution:
  Remove the insync regions check but keep the informal message
  "waiting for resynchronization"  and let lvconvert carry out its
  pre-repair checks and optionally carry out a repair attempt.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1560739
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1468590
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1654860
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1729303
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1741016
2019-09-20 17:52:02 +02:00
Heinz Mauelshagen
0585754593 Revert "dmeventd: avoid bail out preventing repair in raid plugin"
This reverts commit 9e438b4bc6.

The reverted patch also removed the warning which we realized we need
to keep as valuable process information (see related bugzilla below).

In a followup patch, we'll keep the message and avoid bailing out thus
always allowing lvconvert to try repairing if 'allocate' fault policy set.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
2019-09-20 17:48:48 +02:00
Marian Csontos
6cad4eba9b spec: Move blkdeactivate to device-mapper 2019-09-20 10:56:46 +02:00
David Teigland
44b98d77ec tests: add test for pvscan activation of incomplete vg 2019-09-18 13:29:17 -05:00
Zdenek Kabelac
1349b61bb7 pvmove: check if participating LV is already exlcusively active
When running pvmove, we need to decide whether pvmove has to be doing
exlusive or non-exclusive activations for LV.

Whenever LV that requires exlusive activation is present, it makes
pvmove exlusive. But when there is already activate i.e. linear LV
in exclusive mode it also needs to switch pvmove into 'exlusively
activating' pvmove.
2019-09-18 12:46:22 +02:00
Zdenek Kabelac
2e51535b18 thin: activate layer pool aas read-only LV
When lvm2 is activating layered pool LV (to basically keep pool opened,
the other function used to be 'locking' be in sync with DM table)
use this LV in read-only mode - this prevents 'write' access into
data volume content of thin-pool.

Note: since EMPTY/unused thin-pool is created as 'public LV' for generic
use by any user who i.e. wish to maintain thin-pool and thins himself.
At this moment, thin-pool appears as writable LV.  As soon as the 1st.
thinLV is created, layer volume will appear is 'read-only' LV from this moment.
2019-09-17 15:29:11 +02:00
Zdenek Kabelac
2caae8a572 devices: crypto skip
Devices with UUID signature CRYPT-SUBDEV are internal crypto devices.
2019-09-17 15:29:11 +02:00
Zdenek Kabelac
2694f93bb4 tests: pool conversion
Test conversion of cached LV.
2019-09-17 11:33:55 +02:00
Zdenek Kabelac
e147786bac lvconvert: improve validation thin and cache pool conversion
Limit convertible LVs to thin-pool and cache-pools.
Also fix return code on  interal error path to return ECMD_FAILED.
2019-09-17 11:33:53 +02:00
Heinz Mauelshagen
1c07c54829 lvchange: add --resync help/manual text relative to 'R' attribute
Add information that --resync clears the 'R' attribute
on not initially synchronized mirror/RAID LVs.

Related: 1708299
2019-09-06 14:19:32 +02:00
David Teigland
6b12930860 pvscan: fix activation of incomplete VGs
For a long time there has been a bug in the activation
done by the initial pvscan (which scans all devs to
initialize the lvmetad cache.)  It was attempting to
activate all VGs, even those that were not complete.

lvmetad tells pvscan when a VG is complete, and pvscan
needs to use this information to decide which VGs to
activate.

When there are problems that prevent lvmetad from being
used (e.g. lvmetad is disabled or not running), pvscan
activation cannot use lvmetad to determine when a VG
is complete, so it now checks if devices are present
for all PVs in the VG before activating.

(The recent commit "pvscan: avoid redundant activation"
could make this bug more apparent because redundant
activations can cover up the effect of activating an
incomplete VG and missing some LV activations.)
2019-09-03 15:53:07 -05:00
Marian Csontos
402b41f58d cov: Fix memory leak 2019-08-28 14:47:23 +02:00
Marian Csontos
560dd9c552 post-release 2019-08-27 17:21:22 +02:00
Marian Csontos
4e5761487e pre-release 2019-08-27 17:20:17 +02:00
Marian Csontos
3954034b15 build: make generate 2019-08-27 17:10:52 +02:00
Zdenek Kabelac
ad86cda4d7 activation: use cmd pending mem for pending_delete
Since we need to preserve allocated strings across 2 separate
activation calls of '_tree_action()' we need to use other mem
pool them dm->mem - but since cmd->mem is released between
individual lvm2 locking calls, we rather introduce a new separate
mem pool just for pending deletes with easy to see life-span.
(not using 'libmem' as it would basicaly keep allocations over
the whole lifetime of clvmd)

This patch is fixing previous commmit where the memory was
improperly used after pool release.
2019-08-27 15:59:33 +02:00
Marian Csontos
36523a398d cov: Fix a leak 2019-08-27 12:23:13 +02:00
Marian Csontos
e4f72e6655 build: Fix make rpm with releases
- git describe returns just v2_02_182 instead of e.g.
  v2_02_181-44-adf123, so cut needs -s option.

- there is no dash in VERSION_DM so we need to split on space first.
2019-08-27 12:23:13 +02:00
David Teigland
8bcd482cc5 pvscan: avoid redundant activation
Use temp files in /run/lvm/vgs_online/ to keep track of when
a VG has been autoactivated by pvscan.  When pvscan autoactivates
a VG, it creates a temp file with the VG's name.  Before a
subsequent pvscan tries to autoactivate the same VG, it checks
if a temp file exists for the VG name, and if so it skips it.

This can commonly happen when many devices appear on the system
at once, which generates several concurrent pvscans.  In this case
the first pvscan does initialization by scanning all devices and
activating any complete VGs.  The other pvscans would attempt to
activate the same complete VGs again.  This extra work could
create a bottleneck of pvscan commands.

If a VG is deactivated by vgchange, the vg online file is removed.
If PVs are then disconnected/reconnected, pvscan will again
autoactivate the VG.

Also, this patch disables the VG refresh that could be called from
pvscan --cache -aay if lvmetad detects metadata inconsistencies.
The role of pvscan should be limited to basic autoactivation, and
any refresh scenarios are special cases that are not appropriate
for automation.

The warning printed by commands retrying an lvmetad connection
has been reduced to once every 10 seconds.  New output messages
have been added to pvscan to record when pvscan is falling back
to direct activation of all VGs.
2019-08-26 16:25:18 -05:00
Zdenek Kabelac
93de9b59c2 dmsetup: missed trailing newline 2019-08-26 15:38:20 +02:00
Zdenek Kabelac
e03bdd7556 lv_manip: add synchronizations
New udev in rawhide seems to be 'dropping' udev rule operations for devices
that are no longer existing - while this is 'probably' a bug - it's
revealing moments in lvm2 that likely should not run in a single
transaction and we should wait for a cookie before submitting more work.

TODO: it seem more 'error' paths should always include synchronization
before starting deactivating 'just activated' devices.
We should probably figure out some 'automatic' solution for this instead
of placing sync_local_dev_name() all over the place...
2019-08-26 15:36:41 +02:00
Zdenek Kabelac
c4a6b9ded0 cache: improve vgremove loop
Support internal removal of 'cache origin' volume - which we
do not normally expose to a user - however internal processing
loops may hit this condition (depending on order of list LVs).

So when this operation is internally requested - we automatically
try to remove it's 'holding' LV (cache LV) - which will also
remove the origin.
2019-08-26 15:36:41 +02:00
Zdenek Kabelac
4743c4900d snapshot: always activate
Drop the 'cluster-only' optimization so we do resume ALL device
before we try to wait on cookie before 'removal' operation.

It's more correct order of operation - alhtough possibly slightly
less efficient - but until we have correct list of operations
'in-progress' we can't do anything better.
2019-08-26 15:36:41 +02:00
Zdenek Kabelac
c6e079cda3 activation: extend handling of pending_delete
With previous patch 30a98e4d67 we
started to put devices one pending_delete list instead
of directly scheduling their removal.

However we have operations like 'snapshot merge' where we are
resuming device tree in 2 subsequent activation calls - so
1st such call will still have suspened devices and no chance
to push 'remove' ioctl.

Since we curently cannot easily solve this by doing just single
activation call (which would be preferred solution) - we introduce
a preservation of pending_delete via command structure and
then restore it on next activation call.

This way we keep to remove devices later - although it might be
not the best moment - this may need futher tunning.

Also we don't keep the list of operation in 1 trasaction
(unless we do verify udev symlinks) - this could probably
also make it more correct in terms of which 'remove' can
be combined we already running 'resume'.
2019-08-26 15:36:41 +02:00
David Teigland
f55b8e387f devices: put ifdef around BLKPBSZGET
BLKPBSZGET is not defined before kernel version 2.6.32
(e.g. rhel5)
2019-08-20 09:32:26 -05:00
Zdenek Kabelac
53fcd4fd8f dmsetup: debug print
Udev debugging is a bit tricky, so to more easily pair cookie ID,
which is the lowest 16 bit - print cookie as hexa number.
This simplify pairing of processed cookies while the 'higher bit flags'
are changed for the same cookie.
2019-08-20 12:59:05 +02:00
Zdenek Kabelac
ba629ceea1 activation: add synchronization point
Resuming of 'error' table entry followed with it's dirrect removal
is now troublesame with latest udev as it may skip processing of
udev rules for already 'dropped' device nodes.

As we cannot 'synchronize' with udev while we know we have devices
in suspended state - rework 'cleanup' so it collects nodes
for removal into pending_delete list and process the list with
synchronization once we are without any suspended nodes.
2019-08-20 12:59:05 +02:00
Zdenek Kabelac
e5cdb114a6 pvmove: add missing synchronization
Between 'resume' and 'remove' we need to wait for udev to synchronize,
otherwise udev may 'skip' resume event processing if the udev node
is already gone.
2019-08-20 12:59:05 +02:00
Zdenek Kabelac
73d1646a00 pvmove: correcting read_ahead setting
When pvmove is finished, we do a tricky operation since we try to
resume multiple different device that were all joined into 1 big tree.

Currently we use the infromation from existing live DM table,
where we can get list of all holders of pvmove device.
We look for these nodes (by uuid) in new metadata, and we do now a full
regular device add into dm tree structure.  All devices should be
already PRELOAD with correct table before entering suspend state,
however for correctly working readahead we need to put correct info
also into RESUME tree.  Since table are preloaded, the same table
is skip and resume, but correct read ahead is now set.
2019-08-20 12:59:05 +02:00
David Teigland
881f49a767 man lvmthin: remove nonexistent topic 2019-08-19 14:09:43 -05:00
Heinz Mauelshagen
474963573a Revert "pvmove_poll: instrument"
This reverts commit fdb014f02f.

Went in by mistake!
2019-08-19 17:35:52 +02:00