]> sourceware.org Git - lvm2.git/log
lvm2.git
6 years agoformat-text.c log message fixes
David Teigland [Wed, 7 Feb 2018 21:20:39 +0000 (15:20 -0600)]
format-text.c log message fixes

6 years agolvmcache: simplify metadata cache
David Teigland [Wed, 1 Nov 2017 14:35:40 +0000 (09:35 -0500)]
lvmcache: simplify metadata cache

The copy of VG metadata stored in lvmcache was not being used
in general.  It pretended to be a generic VG metadata cache,
but was not being used except for clvmd activation.  There
it was used to avoid reading from disk while devices were
suspended, i.e. in resume.

This removes the code that attempted to make this look
like a generic metadata cache, and replaces with with
something narrowly targetted to what it's actually used for.

This is a way of passing the VG from suspend to resume in
clvmd.  Since in the case of clvmd one caller can't simply
pass the same VG to both suspend and resume, suspend needs
to stash the VG somewhere that resume can grab it from.
(resume doesn't want to read it from disk since devices
are suspended.)  The lvmcache vginfo struct is used as a
convenient place to stash the VG to pass it from suspend
to resume, even though it isn't related to the lvmcache
or vginfo.  These suspended_vg* vginfo fields should
not be used or touched anywhere else, they are only to
be used for passing the VG data from suspend to resume
in clvmd.  The VG data being passed between suspend and
resume is never modified, and will only exist in the
brief period between suspend and resume in clvmd.

suspend has both old (current) and new (precommitted)
copies of the VG metadata.  It stashes both of these in
the vginfo prior to suspending devices.  When vg_commit
is successful, it sets a flag in vginfo as before,
signaling the transition from old to new metadata.

resume grabs the VG stashed by suspend.  If the vg_commit
happened, it grabs the new VG, and if the vg_commit didn't
happen it grabs the old VG.  The VG is then used to resume
LVs.

This isolates clvmd-specific code and usage from the
normal lvm vg_read code, making the code simpler and
the behavior easier to verify.

Sequence of operations:

- lv_suspend() has both vg_old and vg_new
  and stashes a copy of each onto the vginfo:
  lvmcache_save_suspended_vg(vg_old);
  lvmcache_save_suspended_vg(vg_new);

- vg_commit() happens, which causes all clvmd
  instances to call lvmcache_commit_metadata(vg).
  A flag is set in the vginfo indicating the
  transition from the old to new VG:
  vginfo->suspended_vg_committed = 1;

- lv_resume() needs either vg_old or vg_new
  to use in resuming LVs.  It doesn't want to
  read the VG from disk since devices are
  suspended, so it gets the VG stashed by
  lv_suspend:
  vg = lvmcache_get_suspended_vg(vgid);

If the vg_commit did not happen, suspended_vg_committed
will not be set, and in this case, lvmcache_get_suspended_vg()
will return the old VG instead of the new VG, and it will
resume LVs based on the old metadata.

6 years agolabel_scan: remove extra label scan and read for orphan PVs
David Teigland [Mon, 6 Nov 2017 18:09:52 +0000 (12:09 -0600)]
label_scan: remove extra label scan and read for orphan PVs

When process_each_pv() calls vg_read() on the orphan VG, the
internal implementation was doing an unnecessary
lvmcache_label_scan() and two unnecessary label_read() calls
on each orphan.  Some of those unnecessary label scans/reads
would sometimes be skipped due to caching, but the code was
always doing at least one unnecessary read on each orphan.

The common format_text case was also unecessarily calling into
the format-specific pv_read() function which actually did nothing.

By analyzing each case in which vg_read() was being called on
the orphan VG, we can say that all of the label scans/reads
in vg_read_orphans are unnecessary:

1. reporting commands: the information saved in lvmcache by
the original label scan can be reported.  There is no advantage
to repeating the label scan on the orphans a second time before
reporting it.

2. pvcreate/vgcreate/vgextend: these all share a common
implementation in pvcreate_each_device().  That function
already rescans labels after acquiring the orphan VG lock,
which ensures that the command is using valid lvmcache
information.

6 years agovgcreate: improve the use of label_scan
David Teigland [Thu, 26 Oct 2017 19:32:30 +0000 (14:32 -0500)]
vgcreate: improve the use of label_scan

The old code was doing unnecessary label scans when
checking to see if the new VG name exists.  A single
label_scan is sufficient if it is done after the
new VG lock is held.

6 years agolvmetad: use new label_scan for update from pvscan
David Teigland [Wed, 7 Feb 2018 19:58:40 +0000 (13:58 -0600)]
lvmetad: use new label_scan for update from pvscan

Take advantage of the common implementation with aio
and reduced disk reads.

6 years agolvmetad: use new label_scan for update from lvmlockd
David Teigland [Thu, 26 Oct 2017 15:58:23 +0000 (10:58 -0500)]
lvmetad: use new label_scan for update from lvmlockd

When lvmlockd indicates that the lvmetad cache is out of
date because of changes by another node, lvmetad_pvscan_vg()
rescans the devices in the VG to update lvmetad.  Use the
new label_scan in this function to use the common code and
take advantage of the new aio and reduced reads.

6 years agoindependent metadata areas: fix bogus code
David Teigland [Wed, 25 Oct 2017 18:55:22 +0000 (13:55 -0500)]
independent metadata areas: fix bogus code

Fix mixing bitwise & and logical && which was
always 1 in any case.

6 years agolabel_scan: fix independent metadata areas
David Teigland [Wed, 25 Oct 2017 18:39:46 +0000 (13:39 -0500)]
label_scan: fix independent metadata areas

This fixes the use of lvmcache_label_rescan_vg() in the previous
commit for the special case of independent metadata areas.

label scan is about discovering VG name to device associations
using information from disks, but devices in VGs with
independent metadata areas have no information on disk, so
the label scan does nothing for these VGs/devices.
With independent metadata areas, only the VG metadata found
in files is used.  This metadata is found and read in
vg_read in the processing phase.

lvmcache_label_rescan_vg() drops lvmcache info for the VG devices
before repeating the label scan on them.  In the case of
independent metadata areas, there is no metadata on devices, so the
label scan of the devices will find nothing, so will not recreate
the necessary vginfo/info data in lvmcache for the VG.  Fix this
by setting a flag in the lvmcache vginfo struct indicating that
the VG uses independent metadata areas, and label rescanning should
be skipped.

In the case of independent metadata areas, it is the metadata
processing in the vg_read phase that sets up the lvmcache
vginfo/info information, and label scan has no role.

6 years agoscan: do scanning at the start of a command
David Teigland [Wed, 7 Feb 2018 19:26:37 +0000 (13:26 -0600)]
scan: do scanning at the start of a command

Move the location of scans to make it clearer and avoid
unnecessary repeated scanning.  There should be one scan
at the start of a command which is then used through the
rest of command processing.

Previously, the initial label scan was called as a side effect
from various utility functions.  This would lead to it being called
unnecessarily.  It is an expensive operation, and should only be
called when necessary.  Also, this is a primary step in the
function of the command, and as such it should be called prominently
at the top level of command processing, not as a hidden side effect
of a utility function.  lvm knows exactly where and when the
label scan needs to be done.  Because of this, move the label scan
calls from the internal functions to the top level of processing.

Other specific instances of lvmcache_label_scan() are still called
unnecessarily or unclearly by specific commands that do not use
the common process_each functions.  These will be improved in
future commits.

During the processing phase, rescanning labels for devices in a VG
needs to be done after the VG lock is acquired in case things have
changed since the initial label scan.  This was being done by way
of rescanning devices that had the INVALID flag set in lvmcache.
This usually approximated the right set of devices, but it was not
exact, and obfuscated the real requirement.  Correct this by using
a new function that rescans the devices in the VG:
lvmcache_label_rescan_vg().

Apart from being inexact, the rescanning was extremely well hidden.
_vg_read() would call ->create_instance(), _text_create_text_instance(),
_create_vg_text_instance() which would call lvmcache_label_scan()
which would call _scan_invalid() which repeats the label scan on
devices flagged INVALID.  lvmcache_label_rescan_vg() is now called
prominently by _vg_read() directly.

6 years agoscan: use new label_scan for lvmcache_label_scan
David Teigland [Wed, 7 Feb 2018 19:14:08 +0000 (13:14 -0600)]
scan: use new label_scan for lvmcache_label_scan

To do label scanning, lvm code calls lvmcache_label_scan().
Change lvmcache_label_scan() to use the new label_scan()
based on bcache.

Also add lvmcache_label_rescan_vg() which calls the new
label_scan_devs() which does label scanning on only the
specified devices.  This is for a subsequent commit and
is not yet used.

6 years agoscan: use bcache for label scan and vg read
David Teigland [Tue, 6 Feb 2018 21:18:11 +0000 (15:18 -0600)]
scan: use bcache for label scan and vg read

New label_scan function populates bcache for each device
on the system.

The two read paths are updated to get data from bcache.

The bcache is not yet used for writing.  bcache blocks
for a device are invalidated when the device is written.

6 years ago[makefile] add -laio to makefiles
David Teigland [Thu, 8 Feb 2018 15:32:19 +0000 (09:32 -0600)]
[makefile] add -laio to makefiles

6 years ago[device/bcache] bcache_read_bytes should put blocks
David Teigland [Thu, 8 Feb 2018 19:44:54 +0000 (13:44 -0600)]
[device/bcache] bcache_read_bytes should put blocks

6 years ago[device/bcache] fix min() function
David Teigland [Thu, 8 Feb 2018 17:16:19 +0000 (11:16 -0600)]
[device/bcache] fix min() function

6 years ago[device/bcache] fix missing max_io fn in bcache async engine
David Teigland [Thu, 8 Feb 2018 16:10:31 +0000 (10:10 -0600)]
[device/bcache] fix missing max_io fn in bcache async engine

6 years ago[device/bcache] more work on bcache
Joe Thornber [Tue, 6 Feb 2018 15:10:44 +0000 (15:10 +0000)]
[device/bcache] more work on bcache

6 years ago[device/bcache] More fiddling with tests
Joe Thornber [Tue, 6 Feb 2018 13:06:15 +0000 (13:06 +0000)]
[device/bcache] More fiddling with tests

6 years ago[device/bcache] add bcache_prefetch_bytes() and bcache_read_bytes()
Joe Thornber [Mon, 5 Feb 2018 16:56:56 +0000 (16:56 +0000)]
[device/bcache] add bcache_prefetch_bytes() and bcache_read_bytes()

Not tested yet.

6 years ago[device/bcache] More tests and some bug fixes
Joe Thornber [Mon, 5 Feb 2018 16:04:23 +0000 (16:04 +0000)]
[device/bcache] More tests and some bug fixes

6 years ago[build] include test/unit/Makefile rather than recursive build
Joe Thornber [Fri, 2 Feb 2018 15:39:17 +0000 (15:39 +0000)]
[build] include test/unit/Makefile rather than recursive build

FIXME: unit tests are not currently run as part of make check.

6 years ago[device/bcache] rename a unit test
Joe Thornber [Fri, 2 Feb 2018 15:38:46 +0000 (15:38 +0000)]
[device/bcache] rename a unit test

6 years ago[device/bcache] another unit test
Joe Thornber [Fri, 2 Feb 2018 14:35:11 +0000 (14:35 +0000)]
[device/bcache] another unit test

6 years ago[device/bcache] fix bug in _alloc_block
Joe Thornber [Fri, 2 Feb 2018 14:34:45 +0000 (14:34 +0000)]
[device/bcache] fix bug in _alloc_block

6 years ago[device/bcache] Add bcache_max_prefetches()
Joe Thornber [Fri, 2 Feb 2018 12:06:14 +0000 (12:06 +0000)]
[device/bcache] Add bcache_max_prefetches()

Ignore prefetches if max io is in flight.

6 years ago[device/bcache] Add a couple of invalidate methods
Joe Thornber [Fri, 2 Feb 2018 07:59:49 +0000 (07:59 +0000)]
[device/bcache] Add a couple of invalidate methods

6 years ago[device/bcache] some more work on bcache
Joe Thornber [Thu, 1 Feb 2018 14:52:43 +0000 (14:52 +0000)]
[device/bcache] some more work on bcache

6 years ago[device/bcache] stub a unit test
Joe Thornber [Thu, 1 Feb 2018 09:54:56 +0000 (09:54 +0000)]
[device/bcache] stub a unit test

6 years ago[git] Update .gitignore
Joe Thornber [Wed, 31 Jan 2018 11:35:47 +0000 (11:35 +0000)]
[git] Update .gitignore

6 years ago[unit tests] remove old unit tests that weren't built or run.
Joe Thornber [Wed, 31 Jan 2018 11:28:51 +0000 (11:28 +0000)]
[unit tests] remove old unit tests that weren't built or run.

6 years ago[build] Quieten the build down
Joe Thornber [Wed, 31 Jan 2018 10:04:17 +0000 (10:04 +0000)]
[build] Quieten the build down

It was hard to see warnings with the long command lines scrolling by so
quickly.

Use 'make V=1' if you need to see all the gritty details.

6 years ago[lib/device/bcache] Tweaks after Kabi's review
Joe Thornber [Tue, 30 Jan 2018 12:13:48 +0000 (12:13 +0000)]
[lib/device/bcache] Tweaks after Kabi's review

6 years ago[device/bcache] Initial code drop.
Joe Thornber [Tue, 30 Jan 2018 10:46:08 +0000 (10:46 +0000)]
[device/bcache] Initial code drop.

Compiles.  Not written tests yet.

6 years ago[io paths] Unpick agk's aio stuff
Joe Thornber [Fri, 20 Apr 2018 15:43:50 +0000 (10:43 -0500)]
[io paths] Unpick agk's aio stuff

6 years agotests: improve mirror_images_redundant
Zdenek Kabelac [Fri, 20 Apr 2018 08:15:14 +0000 (10:15 +0200)]
tests: improve mirror_images_redundant

Use only passed VG for lvs and avoid 1 extra uneeded use of lvs.

6 years agotests: update mirror test
Zdenek Kabelac [Fri, 20 Apr 2018 08:13:21 +0000 (10:13 +0200)]
tests: update mirror test

Since lvconvert again is able to wait on mirror synchronization,
drop 'should'.

Also add FIXME about  'lvreduce' and too big region size.

6 years agocoverity: ensure 0 end string
Zdenek Kabelac [Thu, 29 Mar 2018 17:07:31 +0000 (19:07 +0200)]
coverity: ensure 0 end string

Use dm_strncpy() to enusure string ends with '\0'.
In case uuid does not fit, report error.

6 years agocleanup: avoid compiler warn
Zdenek Kabelac [Thu, 29 Mar 2018 16:49:42 +0000 (18:49 +0200)]
cleanup: avoid compiler warn

When variable is unused...

6 years agocleanup: correcting macro wrapping
Zdenek Kabelac [Thu, 19 Apr 2018 15:35:48 +0000 (17:35 +0200)]
cleanup: correcting macro wrapping

Use proper do {} while(0) so ';' after macros are correctly
interpretted..

6 years agocleanup: enhance debug message
Zdenek Kabelac [Thu, 19 Apr 2018 10:32:01 +0000 (12:32 +0200)]
cleanup: enhance debug message

6 years agocleanup: display_lvname update message
Zdenek Kabelac [Tue, 27 Mar 2018 19:08:20 +0000 (21:08 +0200)]
cleanup: display_lvname update message

Add more display_lvname usage.
Update some error messages.
Indent.

6 years agocleanup: add _mb_ to regiosize option
Zdenek Kabelac [Wed, 18 Apr 2018 10:56:32 +0000 (12:56 +0200)]
cleanup: add _mb_ to regiosize option

Just like with others mentions default unit in function name.

6 years agocleanup: correct casting
Zdenek Kabelac [Mon, 16 Apr 2018 10:57:02 +0000 (12:57 +0200)]
cleanup: correct casting

6 years agocleanup: reorder condition
Zdenek Kabelac [Thu, 29 Mar 2018 20:53:13 +0000 (22:53 +0200)]
cleanup: reorder condition

There is no point to wait for sync for non-locally active LV.

6 years agocleanup: call uname once
Zdenek Kabelac [Tue, 27 Mar 2018 19:07:13 +0000 (21:07 +0200)]
cleanup: call uname once

Call uname() once and keep result for mirror use-case.

6 years agomirror: use vg mempool
Zdenek Kabelac [Thu, 29 Mar 2018 21:12:57 +0000 (23:12 +0200)]
mirror: use vg mempool

Use vg mempool with mirror log metadata update.

6 years agomirror: checking for mirror segtype
Zdenek Kabelac [Fri, 20 Apr 2018 08:01:28 +0000 (10:01 +0200)]
mirror: checking for mirror segtype

Checking more correctly for mirror segtype here instead of
mirrored one which can be also 'raid'.

6 years agomirror: validate region_size for mirrors
Zdenek Kabelac [Thu, 19 Apr 2018 15:38:04 +0000 (17:38 +0200)]
mirror: validate region_size for mirrors

Check for region size properties of mirror segments.

6 years agomirror: properly reload table for log init
Zdenek Kabelac [Thu, 29 Mar 2018 21:26:22 +0000 (23:26 +0200)]
mirror: properly reload table for log init

Since mirror can be stacked, we need to properly reload whole
table stack, otherwice we may mishandle devices in dm table.

6 years agomirror: block_on_error only with monitoring
Zdenek Kabelac [Thu, 29 Mar 2018 19:10:58 +0000 (21:10 +0200)]
mirror: block_on_error only with monitoring

When user configured lvm2 to NOT user monitoring, activated mirror
actually hang upon error and it's quite unusable moment.

So instead Warn those 'brave' non-monitoring users about possible
problem and activation mirror without blocking error handling.

This also makes it a bit simpler for test suite to handle trouble
cases when test is running without  dmeventd.

6 years agomirror: fix region_size for clustered VG
Zdenek Kabelac [Fri, 20 Apr 2018 08:07:42 +0000 (10:07 +0200)]
mirror: fix region_size for clustered VG

When adjusting region size for clustered VG it always needs to fit
2 full bitset into 1MB due to old limits of CPG.

This is relatively big amount of bits, but we have still limitation
for region size to fit into 32bits (0x8000000).

So for too big mirrors this operation needs to fail - so whenever
function returns now 0, it means we can't find matching region_size.

Since return 0 is now 'error' we need to also pass proper region_size
when creating pvmove mirror.

6 years agomirror: fix calcs for maximal region_size
Zdenek Kabelac [Fri, 20 Apr 2018 08:03:26 +0000 (10:03 +0200)]
mirror: fix calcs for maximal region_size

Since extent_size is no longer power_of_2 this max region size
evalution was rather producing random bitsize as a combination
of lowest bit from number of extents and extent size itself.

Correct calculation to use whole LV size and pick biggest
possible power of 2 value smaller then UINT32_MAX.

6 years agomirror: improve mirror log size estimation
Zdenek Kabelac [Fri, 20 Apr 2018 08:12:25 +0000 (10:12 +0200)]
mirror: improve mirror log size estimation

Drop mirrored mirror log limitation that applies only in very limited
use-case and actually mirrored mirror log is deprecated anyway.

So 'disk' mirror log is selecting the correct minimal size, and
bigger size is only enforced with real mirrored mirror log.

Also for mirrored mirror log we let use 'smalled' region size if needed
so if user uses  1G region size, we still keep small mirror log
with much smaller region size in this case when needed.

Also mirror log extent calculation is now properly detecting error
with too big mirrors where previosly trimmed uint32_t was applies
unintentionally.

6 years agomirror: fix 32bit size calculation
Zdenek Kabelac [Thu, 19 Apr 2018 10:29:42 +0000 (12:29 +0200)]
mirror: fix 32bit size calculation

On 32bit arch  size_t remains 4-byte wide - so size can't
get correct result for multiplication of 32bit numbers.

6 years agoactivation: add generic rule for visibility change
Zdenek Kabelac [Fri, 20 Apr 2018 09:55:22 +0000 (11:55 +0200)]
activation: add generic rule for visibility change

Whenever we make visible LV out of previously invisible one,
reload it's table - the is mandator for proper udev rule
processing as well as ensure content of dm table is correct.

TODO: this new generic rule probably make extra raid rules unnecessary.

6 years agolvconvert: drop limitation for converting lv
Zdenek Kabelac [Wed, 18 Apr 2018 10:57:17 +0000 (12:57 +0200)]
lvconvert: drop limitation for converting lv

Fixing regresion on argument acceptance where any lv can be passed
with paramaterless lvconvert which is meant to figure out needed
operation - i.e. wait for  mirror synchronization.

User has no other 'effective' method to wait for mirror getting in-sync.

6 years agothin: restore usability of thin for external origin
Zdenek Kabelac [Thu, 29 Mar 2018 16:55:09 +0000 (18:55 +0200)]
thin: restore usability of thin for external origin

With command definition it's been lost support for thin LV being
an external origin for another thinLV.

6 years agopvmove: support properly subLV locking
Zdenek Kabelac [Tue, 27 Mar 2018 19:08:40 +0000 (21:08 +0200)]
pvmove: support properly subLV locking

Since we support snapshot of mirrors, we do need to properly check
for stacked lock holder - fixes problem of pvmove in cluster
with mirrors under snapshot.

WHATS_NEW for this patch goes with 'Restore pvmove support...'

6 years agoudev: keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload
Martin Wilck [Tue, 17 Apr 2018 09:38:12 +0000 (11:38 +0200)]
udev: keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload

The current logic that avoids setting SYSTEMD_ALIAS and SYSTEMD_WANTS
on "change" events is flawed in the default "systemd background job"
configuration. For systemd, it's important that device properties don't
change spuriously.

If an "add" event starts lvm2-pvscan@.service for a device, and a
"change" event follows, removing SYSTEMD_ALIAS and SYSTEMD_WANTS from the
udev db, information about unit dependencies between the device and the
pvscan service can be lost in systemd, in particular if the daemon
configuration is reloaded.

Steps to reproduce problem:

- create a device with an LVM PV
- remove device
- add device (generates "add" and "change" uevents for the device)
  (at this point SYSTEMD_ALIAS and SYSTEMD_WANTS are clear in udev db)
- systemctl daemon-reload
  (systemd reloads udev db)
- vgchange -a n
- remove device

=> the lvm2-pvscan@.service for the device is still active although the
device is gone.

- add device again

=> the PV is not detected, because systemd sees the lvm2-pvscan@.service
as active and thus doesn't restart it.

The original purpose of this logic was to avoid volumes being scanned
over and over again. With systemd background jobs, that isn't necessary,
because systemd will not restart the job as long as it's active.

Signed-off-by: Martin Wilck <mwilck@suse.com>
6 years agoudev: explicit pvscan rule in 69-dm-lvm-metad.rules
Martin Wilck [Tue, 17 Apr 2018 09:32:52 +0000 (11:32 +0200)]
udev: explicit pvscan rule in 69-dm-lvm-metad.rules

Make the distinction between the cases with and without systemd
background jobs explicit in 69-dm-lvm-metad.rules rather than
substituting the rule from the Makefile. At this stage,
this improves only readibility, at the cost of one GOTO statement.

This patch introduces no functional change to the udev rules.

Signed-off-by: Martin Wilck <mwilck@suse.com>
6 years agotest: add lvcreate-raid-volume_list
Heinz Mauelshagen [Fri, 6 Apr 2018 13:25:46 +0000 (15:25 +0200)]
test: add lvcreate-raid-volume_list

Test that no (Sub)LV remnants persist if the volume group is
not listed in configuration variable activation/volume_list,
hence not activatable thus causing initialization of rmeta
SubLVs to fail.

Related: rhbz1161347

6 years agotests: shellcheck misc
Zdenek Kabelac [Fri, 23 Mar 2018 16:01:13 +0000 (17:01 +0100)]
tests: shellcheck misc

Few more minor complains from ShellCheck.

6 years agotests: shellcheck split assing
Zdenek Kabelac [Fri, 23 Mar 2018 16:03:00 +0000 (17:03 +0100)]
tests: shellcheck split assing

Keep possibly error unmasked by assign

6 years agotests: shellcheck liter
Zdenek Kabelac [Fri, 23 Mar 2018 16:02:44 +0000 (17:02 +0100)]
tests: shellcheck liter

6 years agotests: shellcheck use grep -E
Zdenek Kabelac [Fri, 23 Mar 2018 15:59:51 +0000 (16:59 +0100)]
tests: shellcheck use grep -E

Replace egrep with grep -E

6 years agotests: shellcheck prevention check
Zdenek Kabelac [Fri, 23 Mar 2018 15:58:48 +0000 (16:58 +0100)]
tests: shellcheck prevention check

Always make sure variable is set to something else the /dev/*

6 years agofsadm: shellcheck prefer explicit escaping
Zdenek Kabelac [Fri, 23 Mar 2018 14:53:36 +0000 (15:53 +0100)]
fsadm: shellcheck prefer explicit escaping

Backslash is literal in "\t". Prefer explicit escaping: "\\t".

6 years agotests: handle setting better
Zdenek Kabelac [Mon, 19 Mar 2018 18:58:53 +0000 (19:58 +0100)]
tests: handle setting better

When using 'make check...  LVM_TEST_AUX_TRACE=0'  make it behaving
like other supported VARS in use so it's like disabled.

6 years agolibdm: enhance mounted fs detection
Zdenek Kabelac [Tue, 20 Mar 2018 10:13:22 +0000 (11:13 +0100)]
libdm: enhance mounted fs detection

btrfs is using fake major:minor device numbers.
try to be smarter and detect used node via DM device name.

This shortens delays, where i.e. lvm2 is asked to deactivate
volume with mounted btrfs as such operation is not retryed
and user is informed about device being in use.

6 years agotests: update no tool test
Zdenek Kabelac [Mon, 19 Mar 2018 09:26:50 +0000 (10:26 +0100)]
tests: update no tool test

Correct testing with format 1 and mq policy.

Add testing of 'smq'

Fix testing with clvmd - where logged message is part of clvmd log
and we can only check command status.

6 years agocleanup: typo fix
Zdenek Kabelac [Mon, 19 Mar 2018 11:05:36 +0000 (12:05 +0100)]
cleanup: typo fix

6 years agocache: disallow to combine format 2 with mq
Zdenek Kabelac [Mon, 19 Mar 2018 09:23:48 +0000 (10:23 +0100)]
cache: disallow to combine format 2 with mq

Only policy 'smq' is meant to be used with format version 2.
Code used to let pass 'mq' policy also with format 2. But 'mq'
is obsoloted wth smq and kernel currently matches it. But this
is incompatible with older original mq logic - so disallow creation
of this rather useless combination.

6 years agotests: use 4k extents
Zdenek Kabelac [Sat, 17 Mar 2018 23:30:43 +0000 (00:30 +0100)]
tests: use 4k extents

Use 4K chunks since some older kernels are not capable
to create striped volumes with smaller size.

TODO: lvm2 should detect this ahead and avoid kernel
reporting "Invalid chunk".

6 years agotests: check activation of cache without cache_check
Zdenek Kabelac [Sat, 17 Mar 2018 22:26:48 +0000 (23:26 +0100)]
tests: check activation of cache without cache_check

6 years agotests: test striped COW LV
Zdenek Kabelac [Sat, 17 Mar 2018 13:26:15 +0000 (14:26 +0100)]
tests: test striped COW LV

6 years agocleanup: use zalloc
Zdenek Kabelac [Sat, 17 Mar 2018 13:14:25 +0000 (14:14 +0100)]
cleanup: use zalloc

Replace malloc() + memset()   with zalloc().

6 years agocleanup: use direct initializer
Zdenek Kabelac [Sat, 17 Mar 2018 13:13:30 +0000 (14:13 +0100)]
cleanup: use direct initializer

6 years agocoverity: drop unused local static var
Zdenek Kabelac [Sat, 17 Mar 2018 13:00:44 +0000 (14:00 +0100)]
coverity: drop unused local static var

6 years agocoverity: drop unneeded header files
Zdenek Kabelac [Sat, 17 Mar 2018 13:00:21 +0000 (14:00 +0100)]
coverity: drop unneeded header files

6 years agocoverity: move declaration out of the loop
Zdenek Kabelac [Sat, 17 Mar 2018 12:57:40 +0000 (13:57 +0100)]
coverity: move declaration out of the loop

Move declaration of count counter outside the while loop.

6 years agocoverity: make use of defined variable
Zdenek Kabelac [Sat, 17 Mar 2018 12:56:44 +0000 (13:56 +0100)]
coverity: make use of defined variable

Since we declare 'r', let's use the value for something.

6 years agocoverity: validate descriptor
Zdenek Kabelac [Sat, 17 Mar 2018 12:53:12 +0000 (13:53 +0100)]
coverity: validate descriptor

Since this function is called with 'fd == -1', but Coverity can't see
this path can't be visited with this argument, add explicit check for
valid descriptor.

6 years agocoverity: ensure lock_type is not NULL
Zdenek Kabelac [Sat, 17 Mar 2018 13:16:09 +0000 (14:16 +0100)]
coverity: ensure lock_type is not NULL

6 years agocoverity: add missing error check for str_list_add
Zdenek Kabelac [Sat, 17 Mar 2018 13:15:11 +0000 (14:15 +0100)]
coverity: add missing error check for str_list_add

Validate success.

6 years agolvconvert: accept striped LV as snapshot COW LV
Zdenek Kabelac [Sat, 17 Mar 2018 13:01:09 +0000 (14:01 +0100)]
lvconvert: accept striped LV as snapshot COW LV

Restore back acceptance of striped LV to be valid COW LV.

6 years agoraid: fix version check of target
Zdenek Kabelac [Sat, 17 Mar 2018 20:44:53 +0000 (21:44 +0100)]
raid: fix version check of target

Comparision missed to check patch level for matching minor version.
Howerver since all checked patchlevels were 0 - the fix doesn't change result.

6 years agopools: skip checks when tools are missing
Zdenek Kabelac [Sat, 17 Mar 2018 20:50:03 +0000 (21:50 +0100)]
pools: skip checks when tools are missing

If the tools for checking thin_pool or cache metadata are missing,
issue rather just a WARNING, but let the operation of activation
continue.

This has the advantage, the if user is missing those tools,
but he already started to use thinpool or cacheing, he can
access these volumes with a WARNING.

Also if the user is using too old tools i.e. for CacheV2 format
dmpd tool 0.7 is required - provide informative WARNING and
skip failure from older tool version which can't understand
new format V2.

6 years agolvcreate: remove RaidLV on creation failure
Heinz Mauelshagen [Fri, 16 Mar 2018 14:47:12 +0000 (15:47 +0100)]
lvcreate: remove RaidLV on creation failure

In case a newly created RaidLV is blacklisted using config
\"activation { volume list = [ ... ] }\" (i.e. its SubLVs stay inactive),
the metadata SubLVs can't get wiped thus failing the creation.

As a result, the RaidLV together with its SubLVs
is left behind in an inconsistent state.

Fix by removing the RaidLV and provide a hint about volume_list reasoning.

Resolves: rhbz1161347

6 years agoactivation: separate prioritized counter
Zdenek Kabelac [Thu, 15 Mar 2018 11:30:45 +0000 (12:30 +0100)]
activation: separate prioritized counter

While prioritized_section() based on raised priority works
nicely for standard lvm comman - separate counter is actually needed
when it's used in daemons like clvmd/dmeventd  where priority
stays raised all the time.

6 years agotests: skip test when not enough space
Zdenek Kabelac [Wed, 14 Mar 2018 10:21:56 +0000 (11:21 +0100)]
tests: skip test when not enough space

Make the test skipped instead of failing when there was not
enough space.

6 years agotests: use DM_DEBUG_WITH_LINE_NUMBERS
Zdenek Kabelac [Thu, 15 Mar 2018 09:41:08 +0000 (10:41 +0100)]
tests: use DM_DEBUG_WITH_LINE_NUMBERS

Use src:line also for debugging of tools like dmsetup.

6 years agotests: fix running tests on systems without udevd
Zdenek Kabelac [Wed, 14 Mar 2018 10:23:14 +0000 (11:23 +0100)]
tests: fix running tests on systems without udevd

Variable was unbound on systems without running udevd.

6 years agocleanup: missing dots and indent
Zdenek Kabelac [Wed, 14 Mar 2018 20:00:20 +0000 (21:00 +0100)]
cleanup: missing dots and indent

6 years agoactivation: check for prioritized_section
Zdenek Kabelac [Thu, 15 Mar 2018 09:28:43 +0000 (10:28 +0100)]
activation: check for prioritized_section

Detect we are in prioritezed section instead of critical one,
since these operation were supposed to NOT be happining during
whole set of operation.

This patch fixes verification of udev operations.

6 years agolocking: introduce prioritized_section
Zdenek Kabelac [Thu, 15 Mar 2018 08:07:24 +0000 (09:07 +0100)]
locking: introduce prioritized_section

Introduce prioritized_section() as a closer match to previous logic
of critical_section() that has been held over longer sequence of
ioctl commands - essentially it's matching operation on a single
cookie.

While 'critical_section()' now corresponds to locked memory - we hold
this memory only between suspend/resume thus notion of 'cookie' was
lost.

This patch restores some logic unintentionaly lost with dropping
memory locking for just activation/deactivation calls.

6 years agolibdm-stats: fix error messages
Zdenek Kabelac [Wed, 14 Mar 2018 20:00:46 +0000 (21:00 +0100)]
libdm-stats: fix error messages

When function dm_stats_populate() returns 0 it's an error and needs
log_error() message -  function can't have 'success' returning 0 or
error without reasons.

6 years agodmstatus: check nr_regions ahead of find call
Zdenek Kabelac [Wed, 14 Mar 2018 20:01:22 +0000 (21:01 +0100)]
dmstatus: check nr_regions ahead of find call

Prevent call of dm_stats_populate(), when there has been no
stats region detected for a DM device.
Such skip is evaluated as 'correct' visit of stats call and
not causing 'dmstats' command failure.

6 years agodmsetup: loop output table as verbose
Zdenek Kabelac [Wed, 14 Mar 2018 20:02:32 +0000 (21:02 +0100)]
dmsetup: loop output table as verbose

Resulting loop table line was streamed to 'stderr' stream - assuming this
was not a feature when user used '-v' for more verbose output
and properly show it via  'log_verbose()' on 'stdout'.

6 years agodevcache: add reason and always log_error
Zdenek Kabelac [Wed, 14 Mar 2018 18:33:20 +0000 (19:33 +0100)]
devcache: add reason and always log_error

With these read errors it's useful to know the reason.
Also avoid to log error just once so we know exactly
how many times we did failing read.

On the other hand reduce repeated log_error() on code 'backtrace'
path and change severity of message to just log_debug() so the
actual read error is printed once for one read.

6 years agolibdm: support for DM_DEBUG_WITH_LINE_NUMBERS
Zdenek Kabelac [Wed, 14 Mar 2018 17:08:16 +0000 (18:08 +0100)]
libdm: support for DM_DEBUG_WITH_LINE_NUMBERS

For any libdm tool using default debugging function allow
to show source filename and code line number when this
functionality is available.

6 years agotest: Skip tests which require too much RAM
Marian Csontos [Tue, 13 Mar 2018 12:41:33 +0000 (13:41 +0100)]
test: Skip tests which require too much RAM

- Tests for RAID reshape under load require too much RAM

This page took 0.117076 seconds and 5 git commands to generate.