1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

3997 Commits

Author SHA1 Message Date
Zdenek Kabelac
c086dfadc3 activation: split priority from memory locking
When entering any critical section, lvm2 used to lock process memory
and raised task priority to avoid problem with page swapping and minimize
time of having non-resumed devices in table.

With this patch, memory locking which which is expensive is only used when
entering  'suspending' section as only in this section there is risk
lvm could be suspending a device which later can be needed for paging.

Raised priority is still kept for all section entrances as this is
low-cost operation and may accelerate table resumes - although the real
impact can be still considered later.
2017-12-01 12:19:09 +01:00
Zdenek Kabelac
c489dd2e17 pvmove: add missing segment merging
When pvmove is finished and metadata are updated, the code missed
to merge possible mergable segments - so add explicit merging
call after pvmoved volumes are unlocked.

This avoids weird results where i.e. lvs could have been reporting
non-matching segments as lvs upon metadata read is doing silent segment
merging while dm table left after pvmove was still preserving
non-merged segments.
2017-12-01 12:19:09 +01:00
Marian Csontos
94d3878efb Update WHATS_NEW 2017-11-30 13:30:28 +01:00
Alasdair G Kergon
a9812ec9d3 label: Remove unused verify functions.
label_verify has never been used so remove it.
2017-11-28 01:36:55 +00:00
Zdenek Kabelac
efa17cae24 cmdline: avoid overrun on very large numbers.
When large size number (>2^31) is given on command line it could be
misdetected and in certain cases lead to wrongly casted number.

So make sure all cases always do set _MAX number in case the value would
not fit within the supported range instead of getting some random value
within the range.

In most cases this was not a problem to detect, but i.e. stripesize
parameter might have been fooled by certain large numbers.
2017-11-27 10:34:30 +01:00
Zdenek Kabelac
34eb082bbc toollib: improve stripes args reading
Rewrite validation of stripes and stripe_size args into more readable
sequential code.

Extend reading of stripes & stripes_size args so it better knows
defaults for types like striped raid.

TODO: this should really be a value obtained for segtype structure and
all the weird conditions and modification of stripes and stripe_size
around lvm2 code should be dropped.
2017-11-27 10:34:30 +01:00
Zdenek Kabelac
5b5c5cc618 toollib: avoid printing default stripe size
When user is not creating striped LV, do not print
rather confusing info about default stripe size.
2017-11-24 16:09:59 +01:00
Zdenek Kabelac
2a6981a697 activation: automaticaly discover pvmove holders
When pvmove is finished and does 'suspend/resume' on PVMOVE LV,
on resume path committed metadata are already showing 'standalone'
pvmove LV prepared just for removal.

However code should be able to 'resume' preloaded LV there were
participating in pvmove operation.

Previously this was all done in the 'tools' part of lvm2 code.
So the lvconvert upon pvmove finish had to explicitely call 'resume' on every such LV.
Now 'smarted' activation code is able to deduce and combine all information from
the active dm table and committed metadata so single  call resolves
it all in one go.

Internally holders are detected by reading sysfs directory to capture
all needed UUID which are then looked in lvm2 metadata and all such
LVs are automatically collected into dmtree.
2017-11-24 16:09:59 +01:00
Zdenek Kabelac
b5be7420d9 locking: pvmove is locking holding LV
As we do get lock for pvmove LV - it's lockholder ATM.
2017-11-24 16:05:21 +01:00
Zdenek Kabelac
8cf10948bd resume: secure critical section
Only  thin-pool with origin_only suspend is allowed to be not suspending anything.
In such case pairing resume will 'decrement' critical section counter.
2017-11-24 16:05:21 +01:00
Zdenek Kabelac
ae6beda12d suspend: handle start of pvmove
Just like suspend handles preload for pvmove finish,
in similar way handle suspend of starting pvmove.

In this case the  precommited metadata are checked for list of PVMOVEed
LVs and those are suspended in with committed metadata.
2017-11-24 16:05:21 +01:00
Alasdair G Kergon
efb0e7ac6f lvmdiskscan: Remove unnecessary read.
dev_get_size will open the device itself.
2017-11-16 19:13:03 +00:00
Zdenek Kabelac
b978f505ff pvmove: activation changes
Do not use precommitted LV for suspend of pvmoving LVs.
2017-11-15 21:00:26 +01:00
Zdenek Kabelac
a25f9b2106 pvmove: change locking on finish 2017-11-15 14:07:00 +01:00
Zdenek Kabelac
c820b43fc0 activate_lvs: deactivate on uniterate
When activation of LVs fails prior pvmove start, try to deactivate
already activated LVs.

TODO: possibly remember which LVs where already activate and only those
take down - devices which are already in-use will stay active.
2017-11-15 12:11:33 +01:00
Marian Csontos
7c5531b4ca Update WHATS_NEW 2017-11-15 10:01:50 +01:00
Alasdair G Kergon
02e9876665 log: Add io debug class 2017-11-15 01:02:15 +00:00
Alasdair G Kergon
b5f62a143d metadata: Eliminate redundant nested VG metadata
Only lv_committed() now uses vg->vg_committed and it appears redundant
if its contents match the enclosing VG so don't waste cycles creating it
when that's known to be true when no write lock is held so the struct
won't get modified.
2017-11-14 15:38:55 +00:00
Alasdair G Kergon
598fcccf45 persistent filter: Skip import before rescan
The persistent filter should not be imported by any command that doesn't
use it so take addtional note of REQUIRES_FULL_LABEL_SCAN (for vgrename)
and introduce IGNORE_PERSISTENT_FILTER for vgscan and pvscan.
2017-11-13 19:45:16 +00:00
Zdenek Kabelac
56b527a6fb coverity: avoid memleak
When security_level was set, allocated filename was leaking.
2017-11-07 21:26:09 +01:00
Eric Ren
14d0b0bbdd clvmd: supress ENOENT error on testing connection
In HA cluster, we have "clvm" resource agent to manage clvmd daemon.
The agent invokes clvmd like: "clvmd -T90 -d0", which  always prints
a scaring error message:

"""
local socket: connect failed: No such file or directory
"""

When specifed with "-d" option, clvmd tries to check if an instance
of the clvmd daemon is already running through a testing connection.
The connect() will fail with this ENOENT error in such case, so supress
the error message in such case.

TODO: add missing error reaction code - since ofter log_error, program
is not supposed to continue running (log_error() is for reporting
stopping problems).

Signed-off-by: Eric Ren <zren@suse.com>
2017-11-07 21:24:39 +01:00
Zdenek Kabelac
014122256b snapshot: prevent repeated merging
Check and prevent starting another snapshot merge before
exiting merging is finished.

TODO: we can possibly implement smarter logic to drop existing
merging and start a new one.
2017-11-07 21:22:50 +01:00
Alasdair G Kergon
1b6dfd4802 post-release 2017-11-03 04:42:54 +00:00
Alasdair G Kergon
29300e72ee pre-release 2017-11-03 02:28:55 +00:00
Bastian Blank
58b763c99c systemd: remove Install sections from socket-activated services
We always preferred and recommended socket activation for our services
so remove the Install section in related .service units which are unused
in this case and keep only the Install section in associated .socket
units.

Signed-off-by: Bastian Blank <waldi@debian.org>
2017-11-01 15:37:19 +01:00
Alasdair G Kergon
248144d066 liblvm: Fix segfault in lvm_pv_remove.
Since 4fa5add6b1 ("pvcreate: Wipe cached
bootloaderarea when wiping label.") label_remove is responsible
for the lvmcache_del.  (toollib and liblvm need fixing to share
the code.)
2017-10-30 22:03:35 +00:00
Zdenek Kabelac
0424410773 validation: capture store of LV without segment 2017-10-30 14:39:16 +01:00
Zdenek Kabelac
af21263cb3 thin: fix merging messages
Correct reported message when thin snapshot has been already merged.
So lvm2 is no longer reporting "Mergins of snapshot X will occur..."
(even with swapped names).
2017-10-30 11:53:39 +01:00
Zdenek Kabelac
90ee7783b4 pool: drop create spare on error path
When thin/cache pool creation fails and command created _pmspare,
such volume is now removed on error path.
2017-10-30 11:53:39 +01:00
Alasdair G Kergon
52fd66210b metadata: Avoid accessing ignored metadata.
When an ignored metadata area gets flagged for use again, make sure the
code doesn't try to parse its old metadata.  Firstly by trying to detect
this situation and skipping the read (while still remembering the
position reached in the circular buffer), and secondly by clearing the
invalid live metadata location on disk as a precaution when subsequently
writing out the precommitted metadata.

Problems showed up when a metadata area in one VG got moved to
another VG in ignored state (still holding metadata for the original
VG) and then later got brought into use in the new VG - only the header
should be read in this case, not any of the metadata content.
2017-10-27 22:53:43 +01:00
Alasdair G Kergon
84aca4201e vgsplit: Fix detection of moved PVs.
vgsplit shares the vg_rename code so that must only set the PV_MOVED_VG
flag introduced in commit 486ed10848
("vgmerge: Fix intermediate metadata corruption") on PVs that moved.
2017-10-27 22:53:43 +01:00
Heinz Mauelshagen
fdcc709ed0 WHATS_NEW: ignore stripes/stripesize on RAID takover 2017-10-26 18:18:24 +02:00
Zdenek Kabelac
1758614f96 WHATS_NEW: missed
Last patch missed to mention, we've improved/fixed generated paths
in units and init.d shell scripts when lvm2 was plainly configured
with just i.e. --prefix.

Note: some distros might have fully specified --sbindir and
--usrsbindir - thus those very not seeing problems in generated paths.
2017-10-26 14:04:58 +02:00
Zdenek Kabelac
0e7edd1d24 snapshot: improve validation
Do not allow to take snapshot of mirror/raid leg or log or metadata LV.
This was actually never supported, but user was able to create it,
and this put device stack in hardly fixable state (needs manual work).

This prevents such creation to pass.

Also improve validation when recreating snapshot volume type
from origin and COW volume.
2017-10-25 21:58:01 +02:00
Zdenek Kabelac
ea63a38f5a lvconvert: fixing extraction of vgname
Correction to function for extracting vgname out of lvconvert
parameters.

Avoid repeating some checks.

Add code to handle generic options which may provide vgname in its argument
and compare them all so they match to a single vgname (otherwise it's a
error).

Extract default (envvar) vgname only when no position nor optional vgname is
found.

Fixing regression instroduce with patchset started with commit:
1e2420bca8   (2.02.169)
2017-10-24 16:16:08 +02:00
Zdenek Kabelac
df3ff32fc0 lvcreate: skip checking for name restriction for caching
lvcreate supports a 'conversion' when caching LV.
This normally worked fine, however in case passed LV was
thin-pool's data LV with suffix _tdata we have failed to early.

As the easiest fix looks dropping validation of name when
caching type is select - such name check will happen later
once the VG is opened again and properly detect if the LV
with protected name already exists and can be converted,
or will be rejected as ambigiuous operation requiring user
to specify  --type cache | --type cache-pool.
2017-10-23 12:01:15 +02:00
Zdenek Kabelac
d6fcab900b lvextend: detect stacked cache lv used for thinpool
Ensure, that cacheLV is not tried to be resize until full support is
added.
2017-10-23 12:00:43 +02:00
Zdenek Kabelac
de58df390b lvconvert: preserve names of converted LV
When prompting and warning for conversion, remember initial LV names,
so after conversion is finished, correct original names are printed.
2017-10-23 11:58:27 +02:00
Alasdair G Kergon
f3ae99dcc0 liblvm: Move lib code used exclusively into metadata-liblvm.c
Also remove some redundant function definitions from metadata.h.
2017-10-18 19:29:32 +01:00
Alasdair G Kergon
146745ad88 device: Separate errors for dev not found and filtered.
Replaced the confusing device error message "not found (or ignored by
filtering)" by either "not found" or "excluded by a filter".
(Later we should be able to say which filter.)

Left the the liblvm code paths alone.
2017-10-17 02:12:41 +01:00
Zdenek Kabelac
186a3da998 thin: monitor also external origin
Add missing monitoring for external origin LVs and add -real suffix
for UUID used for monitoring of external origin.
2017-10-16 15:47:46 +02:00
David Teigland
6ac1e04b3a replicator: remove the code
It has not been used in a long time and is not
expected to be used further.
2017-10-13 16:20:42 -05:00
Marian Csontos
e14c0cabd9 Update WHATS_NEW 2017-10-13 13:11:01 +02:00
Zdenek Kabelac
e02e5b0c5b activation: fix activation lock
Activation lock has a primary purpose to serialize locking of individual
LV in case there is no other protecting mechanism for parallel
execution.

However in the case an activated LV is composed from several other LVs,
noone should be able to manipulate with those LVs as well.

This patch add a very 'naive' global VG activation locking in this case.
In the future we may introduce smarter function detecting minimal closed
graph components if this will appear as bottleneck

Patch checks if the  VG Write lock is held - in this case we do not
need any more locking - command has exclusive access to VG.

In case we have clustered VG and we are activating an LV which does not
need other LVs - we also do not need any more locks.

In all other cases take respective lock - for single LV - use lvid,
for complex LVs  use vgname.
2017-10-11 14:24:28 +02:00
Zdenek Kabelac
9bd7615fef activation: fix locking resource name for activation lock
Avoid cutting away 1st. character for activation lock.
Unlike with VG name locks like #orphan we should not cut-off 1st.
characted from resource name.
2017-10-11 14:24:28 +02:00
Ondrej Kozina
30293baaa0 fsadm: add support for crypt devices 2017-10-10 14:18:57 +02:00
Alasdair G Kergon
22789563de thin: Improve overprovisioning and repair warnings. 2017-10-09 19:48:00 +01:00
Alasdair G Kergon
a994fc5e50 post-release 2017-10-06 22:16:58 +01:00
Alasdair G Kergon
73b72b8331 pre-release 2017-10-06 22:10:48 +01:00
Alasdair G Kergon
486ed10848 vgmerge: Fix intermediate metadata corruption
vgmerge suffers from a similar problem to the one fixed in commit
8146548d25 ("vgsplit: Fix intermediate
metadata corruption.")

When merging, splitting or renaming VGs, use a new PV status flag
PV_MOVED_VG to mark the PVs that hold metadata with the old VG name and
use this to provide PV-level granularity instead of incorrectly assuming
all PVs in the VG are the same.
2017-10-06 02:20:45 +01:00