1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-25 01:34:38 +03:00
Commit Graph

15808 Commits

Author SHA1 Message Date
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
Heinz Mauelshagen
9e438b4bc6 dmeventd: avoid bail out preventing repair in raid plugin
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 and let lvconvert carry out its
pre-repair checks and optionally carry out a repair attempt.

Resolves: 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-08-16 18:08:22 +02:00
Heinz Mauelshagen
fdb014f02f pvmove_poll: instrument 2019-08-14 21:40:26 +02:00
Zdenek Kabelac
4a3e1ac740 exported_symbols: comment old symbols
Fix versioning for updated symbols dm_stats_create_region
and dm_stats_create_region.

Only the latest symbol should have global entry.

Since I'm not sure what is currenlty the best option for
old symbols - we added support for easy commenting of them
(so we do not lose information when the symbol appeared
for the first time.)

Note: some old already deleted symbols should have been
restored as comments.
2019-08-07 15:28:55 +02:00
Zdenek Kabelac
f39141ebc1 make: support comments in exported symbols
Now the lines starting with '#' in exported symbols files are treated as
comments (ignored).
2019-08-07 15:27:25 +02:00
David Teigland
5ddd1ead2d vgchange: don't fail monitor command if vg is exported
When monitoring, skip exported VGs without causing a command
failure.

The lvm2-monitor service runs 'vgchange --monitor y', so
any exported VG on the system would cause the service to
fail.
2019-07-31 13:18:58 -05:00
David Teigland
b387d026bd WHATS_NEW: fix large physical block size 2019-07-30 16:14:46 -05:00
David Teigland
a178ad0858 tests: large-physical-sector-size 2019-07-30 16:12:45 -05:00
David Teigland
7550665ba4 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.)
2019-07-25 17:06:43 -05:00
David Teigland
3d980172b0 vgrename: use global lock
Should fix a reported problem of pvs seeing bad orphan
info while vgrename was running.
2019-07-22 12:22:12 -05:00
Heinz Mauelshagen
e3c8cebd87 lvconvert: allow --stripes/--stripesize in 'mirror' conversions
This allows the creation of a striped mirror leg(s) during upconvert
by adding lvconvert command line options --stripes/--stripesize
for 'mirror' to tools/command-lines.in.

In case multiple mirror legs are being added, all will have the
same requested striped layout.

Resolves: rhbz1720705
2019-07-08 19:14:11 +02:00
Zdenek Kabelac
2f846697fc tests: add settle wait before issue remove
Some older BB with older cryptsetup tool do not 'retry' on remove
and when  remove is issued right after 'fsck'  - it might be
rejected with:

Device @PREFIX@-tcrypt2 is busy.

Try to use udevadm settle.
2019-07-06 01:24:28 +02:00
David Teigland
cff9bff0af tests: fsadm-crypt.sh update mkfs parameter
mkfs.xfs was rejecting previously working value
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
143aca25da tests: split args
Here we want args to be splited into individual strings.
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
1e9c409a3e tests: use luks1 for test
Since we do not need anywhere luks2 - pick older format
which does not require password for resize to keep
the rest of test unmodified.
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
e1cc409ae6 tests: raise minsize of xfs
mkfs.xfs now needs at least ~1600...
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
721a172edf cov: avoid recursive self-inclusion
Include: toolcontext.h -> dev-type.h -> label.h -> toolcontext.h
Replace with struct predeclaration.
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
23478d9d21 cov: release iterator on error path
Another missed release on error path.
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
b0e1019add gcc: clean uninitialized var warning
Some older gcc versions shows this (FP) warning:
label/label.c:360: warning: â€sector’ may be used uninitialized in this function
2019-07-06 01:24:28 +02:00
Zdenek Kabelac
9aedf68c32 gcc: cleanup warning of shawhing a global dclr
misc/lvm-globals.c:76: warning: declaration of â€use_aio’ shadows a global declaration
misc/lvm-globals.h:63: warning: shadowed declaration is here
2019-07-06 01:24:28 +02:00
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