]> sourceware.org Git - lvm2.git/log
lvm2.git
8 years agotests: minor update
Zdenek Kabelac [Wed, 20 Apr 2016 21:21:03 +0000 (23:21 +0200)]
tests: minor update

8 years agotests: still show systems stas when command has not produced debug.log file
Zdenek Kabelac [Wed, 20 Apr 2016 21:19:33 +0000 (23:19 +0200)]
tests: still show systems stas when command has not produced debug.log file

When no debug.log* file is present whole stacktracking was skipped.
Add extra test the file exists to catch this case.

8 years agotests: document make parametr for tracing aux scripts
Zdenek Kabelac [Wed, 20 Apr 2016 21:18:51 +0000 (23:18 +0200)]
tests: document make parametr for tracing aux scripts

8 years agodebug: move misplaced log_debug
Zdenek Kabelac [Wed, 20 Apr 2016 10:45:15 +0000 (12:45 +0200)]
debug: move misplaced log_debug

It should log action before taking it instead of only in error path.

8 years agoconfigure: respect --disable-lvmetad/lvmpolld
Zdenek Kabelac [Wed, 20 Apr 2016 22:31:15 +0000 (00:31 +0200)]
configure: respect --disable-lvmetad/lvmpolld

When user requested on cmdline disabling of lvmetad/lvmpoll,
respect it and when lvmlockd requires these daemon,
Error configure with clear message about misconfiguration.

8 years agoconfigure: detect for /var/lock dir
Zdenek Kabelac [Wed, 20 Apr 2016 21:15:00 +0000 (23:15 +0200)]
configure: detect for /var/lock dir

Detecs systems with /run/lock dir and use such path directly instead
of /var/lock.

8 years agolvmetad: connect from forked polling process
David Teigland [Tue, 19 Apr 2016 22:07:22 +0000 (17:07 -0500)]
lvmetad: connect from forked polling process

With commit 5e9e43074a6c, lvmetad connections are
now made explicitly, so a new connection must be
created from a child created for polling.

8 years agotest: lvmetad-override
David Teigland [Tue, 19 Apr 2016 19:26:05 +0000 (14:26 -0500)]
test: lvmetad-override

Fix test case where a warning appears when it's not expected.

8 years agolvmetad: rework command connection setup and checking
David Teigland [Wed, 13 Apr 2016 22:00:01 +0000 (17:00 -0500)]
lvmetad: rework command connection setup and checking

The lvmetad connection is created within the
init_connections() path during command startup,
rather than via the old lvmetad_active() check.

The old lvmetad_active() checks are replaced
with lvmetad_used() which is a simple check that
tests if the command is using/connected to lvmetad.

The old lvmetad_set_active(cmd, 0) calls, which
stopped the command from using lvmetad (to revert to
disk scanning), are replaced with lvmetad_make_unused(cmd).

8 years agolvmetad: use defines for disabled reason strings
David Teigland [Tue, 19 Apr 2016 15:51:11 +0000 (10:51 -0500)]
lvmetad: use defines for disabled reason strings

8 years agotest: lvmetad-warning
David Teigland [Mon, 18 Apr 2016 21:49:22 +0000 (16:49 -0500)]
test: lvmetad-warning

The test was a weak attempt at verifying the special
combination of lvchange/vgchange -aay --sysinit, but
was only looking for lvmetad connection warnings.

Update the warning checks, and check the LV activation
state directly which is the main point.

Rename the test to reflect its purpose of checking
the -aay --sysinit combination.

8 years agotest: lvmetad-override
David Teigland [Mon, 18 Apr 2016 20:19:45 +0000 (15:19 -0500)]
test: lvmetad-override

8 years agotest: lvmetad-no-cluster
David Teigland [Mon, 18 Apr 2016 18:39:03 +0000 (13:39 -0500)]
test: lvmetad-no-cluster

Update warning message check

8 years agotest: update lvmetad-disabled
David Teigland [Mon, 18 Apr 2016 18:07:11 +0000 (13:07 -0500)]
test: update lvmetad-disabled

Update the check about lvmetad running but not used.

Also add tests related to the new lvmetad disabled state.
lvm1 metadata is used here to test the disabled state
because lvm1 metadata is the first condition using the
disabled state.

8 years agotest: update lvm1 test
David Teigland [Tue, 19 Apr 2016 14:18:31 +0000 (09:18 -0500)]
test: update lvm1 test

Make it a generic lvm1 test, which should work
with or without lvmetad now that lvmetad is just
disabled when lvm1 is used.

8 years agolvmetad: disable if command uses lvm1
David Teigland [Wed, 6 Apr 2016 20:57:09 +0000 (15:57 -0500)]
lvmetad: disable if command uses lvm1

Alternatively, a command could return an error saying
that lvm1 and lvmetad are not compatible.

8 years agolvmetad: clear the disabled flag in lvmetad
David Teigland [Wed, 6 Apr 2016 20:37:52 +0000 (15:37 -0500)]
lvmetad: clear the disabled flag in lvmetad

After a device rescan that repopulates lvmetad,
if no reason for disabling lvmetad was seen
(lvm1 metadata or duplicate PVs), then clear
the disabled flag in lvmetad.  This allows
commands to resume using the lvmetad cache
after the cause for disabling it has been removed.

8 years agolvmetad: use the disabled flag in commands
David Teigland [Wed, 6 Apr 2016 20:31:15 +0000 (15:31 -0500)]
lvmetad: use the disabled flag in commands

Commands already check if the lvmetad token is valid,
and if not, they rescan devices to repopulate lvmetad
before running.  Now, in addition to checking the
lvmetad token, they also check if the lvmetad disabled
flag is set.  If so, they do not use the lvmetad cache
and revert to disk scanning.

8 years agolvmetad: set disabled flag in lvmetad if lvm1 metadata is found
David Teigland [Fri, 29 Jan 2016 17:30:57 +0000 (11:30 -0600)]
lvmetad: set disabled flag in lvmetad if lvm1 metadata is found

When devices are being scanned, if lvm1 metadata is seen,
tell lvmetad to set its disabled flag because of lvm1 metadata.

8 years agolvmetad: add disabled state
David Teigland [Thu, 28 Jan 2016 22:54:36 +0000 (16:54 -0600)]
lvmetad: add disabled state

A global flag in lvmetad indicates it has been disabled.
Other flags indicate the reason it was disabled.
These flags can be queried using get_global_info.

The lvmetactl debugging utility can set and clear the
disabled flag in lvmetad.  Nothing else sets the
disabled flag yet.

Commands will check these flags after connecting to
lvmetad.  If the disabled flag is set, the command
will not use the lvmetad cache, but revert to disk
scanning.

To test this feature:

$ lvmetactl get_global_info
response = "OK"
global_invalid = 0
global_disable = 0
disable_reason = "none"
token = "filter:3041577944"

$ vgs
(should report VGs from lvmetad)

$ lvmetactl set_global_disable 1

$ lvmetactl get_global_info
response = "OK"
global_invalid = 0
global_disable = 1
disable_reason = "DIRECT"
token = "filter:3041577944"

$ vgs
  WARNING: Not using lvmetad because the disable flag was set directly.
(should report VGs without contacting lvmetad)

$ lvmetactl set_global_disable 0

$ vgs
(should report VGs from lvmetad)

8 years agotoollib: remove unneeded call in process_each_pv
David Teigland [Thu, 7 Apr 2016 18:45:26 +0000 (13:45 -0500)]
toollib: remove unneeded call in process_each_pv

process_each_pv was doing:

1. lvmcache_seed_infos_from_lvmetad()
   sends pv_list request to lvmetad.

2. get_vgnameids()
   sends vg_list request to lvmetad.

3. _get_all_devices()
   first calls lvmcache_seed_infos_from_lvmetad(),
   which is a no-op if it's already been called.

Because get_vgnameids() does not use the information
from lvmcache_seed_infos_from_lvmetad(), it does not
need to be called prior to get_all_devices where
it is actually needed.

8 years agometadata: don't repair shared VGs
David Teigland [Thu, 14 Apr 2016 21:40:26 +0000 (16:40 -0500)]
metadata: don't repair shared VGs

When the in-use flag looks like it needs to be repaired.

8 years agolvmlockd: skip unnecessary lvmetad cache update
David Teigland [Thu, 14 Apr 2016 18:45:10 +0000 (13:45 -0500)]
lvmlockd: skip unnecessary lvmetad cache update

In cases where a VG is reread from disk, but the
seqno matches what is currently in lvmetad, the
metadata in lvmetad doesn't need to be updated.

8 years agotests: use should for failing test
Zdenek Kabelac [Mon, 18 Apr 2016 21:12:05 +0000 (23:12 +0200)]
tests: use should for failing test

It's better to use 'should' for failing test before it gets fixed,
when we ignore failing result.

8 years agotests: use bigger raid size
Zdenek Kabelac [Mon, 18 Apr 2016 21:09:17 +0000 (23:09 +0200)]
tests: use bigger raid size

To avoid problem with report of array in-sync use for now bigger
raid size 64M.

8 years agolvchange: improve refresh for merging thin volume
Zdenek Kabelac [Mon, 18 Apr 2016 20:44:30 +0000 (22:44 +0200)]
lvchange: improve refresh for merging thin volume

When running lvchange --refresh on merging thin volume,
try to deactivate snapshot thinLV in case it's preventing
startup of merge process.

8 years agosnapshot: improve merge
Zdenek Kabelac [Mon, 18 Apr 2016 20:54:27 +0000 (22:54 +0200)]
snapshot: improve merge

Improve code for snapshot merge for readabilty
and also reduce number of tests needed to decide
if merging can or cannot be started.

(Further improving 9cccf5245a97a64f900f253fcf948edd5d7ba8c0)

8 years agodebug: use display_lvname
Zdenek Kabelac [Mon, 18 Apr 2016 09:04:06 +0000 (11:04 +0200)]
debug: use display_lvname

8 years agodebug: update message in libdm
Zdenek Kabelac [Sun, 17 Apr 2016 12:51:58 +0000 (14:51 +0200)]
debug: update message in libdm

When dm_tree_find_node_by_uuid() fails to find passed uuid,
report in lof_debug the complete original uuid,
not the one stripped of LVM- prefix.

TODO: inspect manipulation with LVM- prefix here.

8 years agodebug: fix error message
Zdenek Kabelac [Sun, 17 Apr 2016 12:44:13 +0000 (14:44 +0200)]
debug: fix error message

log_error is replaced with warn since the result
of function is not result in command error.

8 years agothin: improve recognizing of merge in progress
Zdenek Kabelac [Mon, 18 Apr 2016 09:04:16 +0000 (11:04 +0200)]
thin: improve recognizing of merge in progress

Rewrite too condensed condition in more readable form,
wher decision are clearly separated and commented and
also add debug messages for them.

8 years agothin: check runtime table line for merging
Zdenek Kabelac [Sun, 17 Apr 2016 12:51:48 +0000 (14:51 +0200)]
thin: check runtime table line for merging

To recognize in runtime if we are merging or not
to make consistent decision between suspend and resume
add function to parse thin table line when add
merging thin device to the table.

8 years agotests: fix check_lvmlockd_test
David Teigland [Fri, 15 Apr 2016 17:35:20 +0000 (12:35 -0500)]
tests: fix check_lvmlockd_test

8 years agoactivate: Improve snapshot merge initiation
Alasdair G Kergon [Fri, 15 Apr 2016 01:21:27 +0000 (02:21 +0100)]
activate: Improve snapshot merge initiation

A snapshot merge into its origin cannot be initiated while the devices
are in use.  If there is outside interference (such as from udev),
the suspend (preload) and resume stages can reach conflicting decisions
about whether or not to proceed.

Try to make the logic more robust by checking the inactive or live
table during resume.  (This is still not perfect.)

8 years agoactivation: Log when pending snap merge postponed.
Alasdair G Kergon [Thu, 14 Apr 2016 22:42:56 +0000 (23:42 +0100)]
activation: Log when pending snap merge postponed.

8 years agoWHATS_NEW for lvmetad scanning changes
David Teigland [Thu, 14 Apr 2016 21:55:34 +0000 (16:55 -0500)]
WHATS_NEW for lvmetad scanning changes

8 years agoactivation: Add LV name to a debug message.
Alasdair G Kergon [Thu, 14 Apr 2016 21:41:25 +0000 (22:41 +0100)]
activation: Add LV name to a debug message.

8 years agosnapshot: Don't deactivate fictional snapshot LV.
Alasdair G Kergon [Thu, 14 Apr 2016 19:48:28 +0000 (20:48 +0100)]
snapshot: Don't deactivate fictional snapshot LV.

Commit 971ab733b74e0ffecc3f9f60af48628cd3fba1db ("thin: activation of
merging thin snapshot") also added an incorrect deactivation attempt
for non-thin LVs: find_snapshot(lv)->lv is not designed to be
activated and any attempt to deactivate it is incorrect.

8 years agotoollib: Fix misleading message when forking.
Alasdair G Kergon [Thu, 14 Apr 2016 16:21:02 +0000 (17:21 +0100)]
toollib: Fix misleading message when forking.

Commands like pvscan --background run entirely in the background,
but others fork only for polling.

8 years agorefactor: factor out vg/lv/pv handling part from report_for_selection fn
Peter Rajnoha [Thu, 14 Apr 2016 13:21:41 +0000 (15:21 +0200)]
refactor: factor out vg/lv/pv handling part from report_for_selection fn

Functionality will be reused by future patches. Also, it makes the code
more readable.

8 years agotests: lvmetad-lvm1 fix
David Teigland [Wed, 13 Apr 2016 20:07:53 +0000 (15:07 -0500)]
tests: lvmetad-lvm1 fix

workaround this test failure until the proper
lvmetad/lvm1 fixes arrive shortly.

8 years agolvmetad: add FIXME to comment
David Teigland [Wed, 13 Apr 2016 19:08:29 +0000 (14:08 -0500)]
lvmetad: add FIXME to comment

8 years agolvmetad: preemptively check and rescan in commands
David Teigland [Thu, 28 Jan 2016 22:40:26 +0000 (16:40 -0600)]
lvmetad: preemptively check and rescan in commands

Move checking the lvmetad state, and the possible rescan,
out of lvmetad_send() to the start of the command.

Previously, the token mismatch and rescan would occur
within lvmetad_send() for some other request.  Now,
the token mismatch is detected earlier, so the
rescan can be done before the main command is in
progress.  Rescanning deep within the processing of
another command will disturb the lvmcache state of
that other command.

A rescan already exists at the start of the command
for the case where foreign VGs are going to be read.
This same rescan is now also performed when there is
an lvmetad token mismatch (from a changed global_filter).

The commands pvscan/vgscan/lvscan/vgimport are excluded
from this preemptive checking/rescanning for lvmetad
because they want to do rescanning themselves explicitly.

If rescanning devices fails, then lvmetad has not been
correctly repopulated and should not be used, so make
the command revert to not using lvmetad.

8 years agodebug: unify some tracing messages
Zdenek Kabelac [Tue, 12 Apr 2016 11:06:16 +0000 (13:06 +0200)]
debug: unify some tracing messages

Introduce  FMTVGID - although it might be possibly better to ensure
vgid is always \0 ended string.

Unify some lvmcache reported messages.

8 years agocleanup: gcc warn about comparing int with uint
Zdenek Kabelac [Tue, 12 Apr 2016 09:47:21 +0000 (11:47 +0200)]
cleanup: gcc warn about comparing int with uint

8 years agocleanup: avoid declaring var in the middle of code
Zdenek Kabelac [Tue, 12 Apr 2016 09:46:41 +0000 (11:46 +0200)]
cleanup: avoid declaring var in the middle of code

Easier to read code.

8 years agorename function read_vgname to read_vgsummary
David Teigland [Tue, 9 Feb 2016 19:32:26 +0000 (13:32 -0600)]
rename function read_vgname to read_vgsummary

The name did not clearly represent what it does.

8 years agodevcache: do not insert devices without device node
Zdenek Kabelac [Mon, 11 Apr 2016 08:08:16 +0000 (10:08 +0200)]
devcache: do not insert devices without device node

When not obtaining device from udev, we are doing deep devdir scan,
and at the same time we try to insert everything what /sys/dev/block
knows about. However in case  lvm2 is configured to use nonstardard
devdir this way it will see (and scan) devices from a real system.

lvm2 test suite is using its own test devdir with its
own device nodes. To avoid touching real /dev  devices, validate
the device node exist in give dir and do not insert such device
into a cache.

With obtain list from udev this patch has no effect
(the normal user path).

8 years agodevcache: index devices also without udev
Zdenek Kabelac [Mon, 11 Apr 2016 08:23:16 +0000 (10:23 +0200)]
devcache: index devices also without udev

We have _insert_dirs() for  udev and non-udev compilation.
Compiling without udev missed to call dev_cache_index_devs().
Move the call after _insert_dirs() call so both compilation
gets it.

8 years agopost-release
Alasdair G Kergon [Sat, 9 Apr 2016 01:10:39 +0000 (02:10 +0100)]
post-release

8 years agopre-release v2_02_150
Alasdair G Kergon [Sat, 9 Apr 2016 01:08:44 +0000 (02:08 +0100)]
pre-release

8 years agocleanup: avoid gcc warns
Zdenek Kabelac [Fri, 8 Apr 2016 09:36:02 +0000 (11:36 +0200)]
cleanup: avoid gcc warns

Some older systems may had global declaration to cause gcc warning.
Rename for cases we don't care...

8 years agocleanup: simplier to read condition
Zdenek Kabelac [Fri, 8 Apr 2016 17:34:56 +0000 (19:34 +0200)]
cleanup: simplier to read condition

Make more readable what we are looking for and just test for
KERNEL version at one place.

8 years agocleanup: reuse _setup_task
Zdenek Kabelac [Fri, 8 Apr 2016 17:28:35 +0000 (19:28 +0200)]
cleanup: reuse _setup_task

Shorten code and use common code from _setup_task.
Reorder naming of major:minor sscanf (as later it's been
also used swapped there was no real bug).

8 years agodev_manager: device_is_usable does not flush
Zdenek Kabelac [Fri, 8 Apr 2016 14:00:03 +0000 (16:00 +0200)]
dev_manager: device_is_usable does not flush

When scanning if device is being usable as PV,
we call STATUS - but this status should not cause
any flushing.
Skip also open_count information as it's not needed.

8 years agoactivation: Skip another non-prefixed info ioctl.
Alasdair G Kergon [Fri, 8 Apr 2016 15:27:12 +0000 (16:27 +0100)]
activation: Skip another non-prefixed info ioctl.

_percent() also does a lookup by dm uuid.
Also get kernel version from cmd->kernel_vsn.

8 years agotest: Fix testing of installed lvmdbusd
Marian Csontos [Fri, 1 Apr 2016 07:28:31 +0000 (09:28 +0200)]
test: Fix testing of installed lvmdbusd

If lvmdbusd is missing expression triggers ERR trap instead of skipping
the test.

8 years agoreport: remove superfluous SEGSSTATUS report type
Peter Rajnoha [Fri, 8 Apr 2016 12:18:00 +0000 (14:18 +0200)]
report: remove superfluous SEGSSTATUS report type

We don't have any report field of this type yet. Return this patch into
the play if we really need that. Currenly we always report status
(result of "status" dm ioctl) for an LV as a whole where we choose
segment which represents the LV, not calling status for each possible
segment it contains - we don't need this now so I'm removing it to
not make the code more complex uselessly.

8 years agocleanup: use common init/destroy_processing_handle in _report fn and cleanup error...
Peter Rajnoha [Fri, 8 Apr 2016 09:01:19 +0000 (11:01 +0200)]
cleanup: use common init/destroy_processing_handle in _report fn and cleanup error paths

8 years agocleanup: use #define for field's quote and pair character and also for the error...
Peter Rajnoha [Fri, 8 Apr 2016 08:55:13 +0000 (10:55 +0200)]
cleanup: use #define for field's quote and pair character and also for the error msg while extending output line

8 years agotests: require newer cache target
Zdenek Kabelac [Thu, 7 Apr 2016 22:04:26 +0000 (00:04 +0200)]
tests: require newer cache target

Older cache target is likely not updating status at all...

8 years agotests: use mkfs.ext3
Zdenek Kabelac [Thu, 7 Apr 2016 20:07:41 +0000 (22:07 +0200)]
tests: use mkfs.ext3

mkfs.ext4 is not really needed so use more widespread mkfs.ext3
so test runs on older system.

8 years agoactivation: do not check for devs without LVM-
Zdenek Kabelac [Thu, 7 Apr 2016 19:37:26 +0000 (21:37 +0200)]
activation: do not check for devs without LVM-

Devices without "LVM-" uuid prefix have been generated by very old
version of lvm2 2.00 and 2.01.
Since version 2.02 all lvm2 devices are using prefix "LVM-".

However checking for present of ancient non prefixed devices does
take extra IOCTL per every call and for majority of todays user
it will not find anything new.

So use the assumption that users with kernel 3.X and newer are not
really using such old versions of lvm2 (year <2005) and with their
new kernel they are also using new version of lvm2 and skip
checking for them.

This change also makes trace logs more readable.

8 years agolvcreate: %FREE -> %PVS
Zdenek Kabelac [Thu, 7 Apr 2016 09:12:49 +0000 (11:12 +0200)]
lvcreate: %FREE -> %PVS

This is hotfix for RHBZ: https://bugzilla.redhat.com/1324537
However already the %FREE is not a good fit and we need something
better. Meanwhile make  -l%PVS work at least as good as %FREE
for thin-pool.

TODO: this needs rework - it should be allocator to do all the size
decisions at one place.

8 years agoWHATS_NEW: update
Zdenek Kabelac [Thu, 7 Apr 2016 20:20:01 +0000 (22:20 +0200)]
WHATS_NEW: update

doc for previous commits.

8 years agolibdm: Correct typo.
Alasdair G Kergon [Thu, 7 Apr 2016 00:51:09 +0000 (01:51 +0100)]
libdm: Correct typo.

8 years agolvmdump: If dir exists check dir perms too.
Alasdair G Kergon [Wed, 6 Apr 2016 21:56:45 +0000 (22:56 +0100)]
lvmdump: If dir exists check dir perms too.

8 years agolvmdump: Allow dir to exist already if it is empty
Alasdair G Kergon [Wed, 6 Apr 2016 21:36:42 +0000 (22:36 +0100)]
lvmdump: Allow dir to exist already if it is empty

8 years agotests: do not break teardown on failing losetup
Zdenek Kabelac [Fri, 1 Apr 2016 07:36:23 +0000 (09:36 +0200)]
tests: do not break teardown on failing losetup

Ignore failing 'losetup -d' - i.e. device may have disappeared...

8 years agotests: verify repair of failing mirror
Zdenek Kabelac [Wed, 6 Apr 2016 09:50:18 +0000 (11:50 +0200)]
tests: verify repair of failing mirror

Improved test script to verify lost mirror image does not
cause mirror corruption while mirror is in use.

TODO: add more cases (lost mlog...), lost image from 3leg mirror...

8 years agocleanup: indent
Zdenek Kabelac [Wed, 6 Apr 2016 08:28:02 +0000 (10:28 +0200)]
cleanup: indent

8 years agolvconvert: show percent with %.2
Zdenek Kabelac [Tue, 5 Apr 2016 12:51:05 +0000 (14:51 +0200)]
lvconvert: show percent with %.2

lvm2 shows percent values with 2 decimal digits elsewhere so use
it consistently also for this output.

8 years agolibdm: improve debug message with ioctl
Zdenek Kabelac [Tue, 5 Apr 2016 12:59:59 +0000 (14:59 +0200)]
libdm: improve debug message with ioctl

Make the debug message a less difficult to read:
Ioctl shows  [ noopencount flush ] instead of cryptic [NF].

8 years agopreload: preserve flushing state
Zdenek Kabelac [Wed, 6 Apr 2016 08:29:57 +0000 (10:29 +0200)]
preload: preserve flushing state

When leaving preload routine it should not altet state of flush required
when it's been already set to 1 and drop it to 0.

The API here is unclean, but current usage expects the same
variable pointer is for all preload calls and combines 'flush_required'
across all of them.

8 years agosuspend: fix suspend with noflush limitation
Zdenek Kabelac [Wed, 6 Apr 2016 08:29:05 +0000 (10:29 +0200)]
suspend: fix suspend with noflush limitation

Commit 844b00958492224c448b30f89ae5532bb6591fd2 tried to move
limit for usage of noflush to 'preload' however this was not
correctly processed.

Intead explicitly check for which types we do not want noflush
and also add debug message in this case.

8 years agomirror: fix flushing for mirror target
Zdenek Kabelac [Tue, 5 Apr 2016 19:34:42 +0000 (21:34 +0200)]
mirror: fix flushing for mirror target

Fix regression caused by commit ba41ee1dc94264f7ac8e61f8b1d56b10225b0d2f.
The idea was to use no_flush for changed device only for thin volumes
and thin pools but also to merge this with change made in commit
844b00958492224c448b30f89ae5532bb6591fd2.

However the resulting condition has caused misbehavior for the mirror
suspend - as that has been before the ONLY allowed target type
that could have been suspended with noflush.

Result was badly working repair for --type mirror that has been
passing 'flush' to the repaired mirror target whenever preload
wrongly set flush_required.

The origin code has required the flush_required to be set whenever
deivce size is changed.

Now it first detects if device size got smaller
'dm_tree_node_size_changed(root) < 0' - this requires flush.
Otherwise it checks device is not thin volume nor thin pool and its
size has changed (got bigger) and requires flush.

This mean upsize of thin-pool or thin volume will not require flush.

8 years agopost-release
Alasdair G Kergon [Fri, 1 Apr 2016 19:36:40 +0000 (20:36 +0100)]
post-release

8 years agopre-release v2_02_149
Alasdair G Kergon [Fri, 1 Apr 2016 19:29:52 +0000 (20:29 +0100)]
pre-release

8 years agoRevert "thin: display highest mapped sector"
Alasdair G Kergon [Fri, 1 Apr 2016 19:09:38 +0000 (20:09 +0100)]
Revert "thin: display highest mapped sector"

This reverts commit fc7dacaa4c6bf0af4c5a457c098da26d7cc71f9c.

Let's put this information into a separate field.  It doesn't meet the
definition of the existing field.

8 years agodev-cache: skip VGID/LVID indexing if /sys/dev/block is not present
Peter Rajnoha [Fri, 1 Apr 2016 15:04:11 +0000 (17:04 +0200)]
dev-cache: skip VGID/LVID indexing if /sys/dev/block is not present

/sys/dev/block is available since kernel version 2.2.26 (~ 2008):
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-dev

The VGID/LVID indexing code relies on this feature so skip indexing
if it's not available to avoid error messages about inability to open
/sys/dev/block directory.

We're not going to provide fallback code to read the /sys/block/
instead in this case as that's not that efficient - it needs extra
reads for getting major:minor and reading partitions would also
pose further reads and that's not worth it.

8 years agofix: make udev_get_library_context available also for non-udev compilations
Peter Rajnoha [Fri, 1 Apr 2016 13:35:13 +0000 (15:35 +0200)]
fix: make udev_get_library_context available also for non-udev compilations

If compiling without udev_sync support, udev_get_library_context simply
returns NULL so we don't need to remember putting ifdef UDEV_SYNC_SUPPORT
in the code all the time we just need to check whether there's any udev
context initialized or not.

8 years agodev-cache: iterate devices in sysfs for VGID/LVID index if obtain_device_list_from_udev=0
Peter Rajnoha [Fri, 1 Apr 2016 09:34:09 +0000 (11:34 +0200)]
dev-cache: iterate devices in sysfs for VGID/LVID index if obtain_device_list_from_udev=0

If obtain_device_list_from_udev=0, LVM can make use of persistent .cache
file. This cache file contains only devices which underwent filters in
previous LVM command run. But we need to iterate over all block devices
to create the VGID/LVID index completely for the device mismatch check
to be complete as well.

This patch iterates over block devices found in sysfs to generate the
VGID/LVID index in dev cache if obtain_device_list_from_udev=0
(if obtain_device_list_from_udev=1, we always read complete list of
block devices from udev and we ignore .cache file so we don't need
to look in sysfs for the complete list).

8 years agodev-cache: also add dev name for device found in sysfs only
Peter Rajnoha [Fri, 1 Apr 2016 08:09:03 +0000 (10:09 +0200)]
dev-cache: also add dev name for device found in sysfs only

For the case when we print device name associated with struct device
that was not found in /dev, but in sysfs, for example when printing
devices where LV device mismatch is found.

8 years agorefactor: dev-cache: move code adding sysfs-only device into separate fn
Peter Rajnoha [Fri, 1 Apr 2016 07:41:41 +0000 (09:41 +0200)]
refactor: dev-cache: move code adding sysfs-only device into separate fn

8 years agorefactor: dev-cache: use btree instead of hash table for sysfs-only devices
Peter Rajnoha [Thu, 31 Mar 2016 13:14:01 +0000 (15:14 +0200)]
refactor: dev-cache: use btree instead of hash table for sysfs-only devices

major:minor btree is more convenient and more suitable than dev name
hash table here.

8 years agotests: fixed cache target reacts faster
Zdenek Kabelac [Thu, 31 Mar 2016 10:00:20 +0000 (12:00 +0200)]
tests: fixed cache target reacts faster

After kernel fixed in 4.6 cache target reacts promptly
and switches to Fail-ed state when disk error is detected.

Handle both cases in test...

8 years agotests: do not test settings when MQ is emulated by SMQ
Zdenek Kabelac [Thu, 31 Mar 2016 09:59:55 +0000 (11:59 +0200)]
tests: do not test settings when MQ is emulated by SMQ

8 years agocleanup: use local var to read struct
Zdenek Kabelac [Wed, 30 Mar 2016 08:16:09 +0000 (10:16 +0200)]
cleanup: use local var to read struct

8 years agocleanup: use TARGET define
Zdenek Kabelac [Wed, 30 Mar 2016 08:15:47 +0000 (10:15 +0200)]
cleanup: use TARGET define

8 years agocleanup: debug message fix
Zdenek Kabelac [Tue, 29 Mar 2016 13:57:12 +0000 (15:57 +0200)]
cleanup: debug message fix

Reported-by: Ming-Hung Tsai <mingnus gmail com>
8 years agothin: display highest mapped sector
Zdenek Kabelac [Wed, 30 Mar 2016 09:14:13 +0000 (11:14 +0200)]
thin: display highest mapped sector

Use  meta%  to expose highest mapped sector in thinLV.
so showing there 100.00% means thinLV maps latest sector.

Currently using a 'trick' with total_numerator to pass-in
device size when  'seg==NULL'

TODO: Improve device status API per target - current 'percentage'
is not really extensible.

8 years agothin: no thin-pool flush when reading metadata status
Zdenek Kabelac [Wed, 30 Mar 2016 08:16:41 +0000 (10:16 +0200)]
thin: no thin-pool flush when reading metadata status

Previous fix missed the fact the we do query for 'percent' with
seg value either set or unset (API overload...)
When 'seg' was unset, we still issue flush with status.
Fix it by cheking segtype by target_type.

As we check for segtype - we could also skip whole percentage
if the 'segtype' is unknown by code directly.

Reported-by: Ming-Hung Tsai <mingnus gmail com
8 years agotests: vg-check-devs-used requires driver version 4.15 at least
Peter Rajnoha [Thu, 31 Mar 2016 08:38:05 +0000 (10:38 +0200)]
tests: vg-check-devs-used requires driver version 4.15 at least

8 years agodev-cache: fix check for already indexed dev in _index_dev_by_vgid_and_lvid
Peter Rajnoha [Wed, 30 Mar 2016 12:35:06 +0000 (14:35 +0200)]
dev-cache: fix check for already indexed dev in _index_dev_by_vgid_and_lvid

8 years agodoc: describe lvmlockd/lvmpolld features as available if LVM compiled with lockd...
Peter Rajnoha [Wed, 30 Mar 2016 12:10:56 +0000 (14:10 +0200)]
doc: describe lvmlockd/lvmpolld features as available if LVM compiled with lockd/polld support

8 years agodev-cache: dev_cache_index_devs fn is available unconditionally
Peter Rajnoha [Wed, 30 Mar 2016 11:06:12 +0000 (13:06 +0200)]
dev-cache: dev_cache_index_devs fn is available unconditionally

The new dev_cache_index_devs fn was under ifdef UDEV_SYNC_SUPPORT by mistake,
move it out of this ifdef.

8 years agodev-cache: remove spurious error msg if no value found in /sys/dev/block/<major>...
Peter Rajnoha [Wed, 30 Mar 2016 09:11:37 +0000 (11:11 +0200)]
dev-cache: remove spurious error msg if no value found in /sys/dev/block/<major>:<minor>/dm/uuid during dev scan

It's correct to have a DM device that has no DM UUID assigned
so no need to issue error message in this case. Also, if the
device doesn't have DM UUID, it's also clear it's not an LVM LV
(...when looking for VGID/LVID while creating VGID/LVID indices
in dev cache).

For example:

$ dmsetup create test --table "0 1 linear /dev/sda 0"
And there's no PV in the system.

Before this patch (spurious error message issued):
$ pvs
  _get_sysfs_value: /sys/dev/block/253:2/dm/uuid: no value

With this patch applied (no spurious error message):
$ pvs

8 years agodev-cache: also index VGIDs and LVIDs if using persistent .cache file
Peter Rajnoha [Wed, 30 Mar 2016 08:39:30 +0000 (10:39 +0200)]
dev-cache: also index VGIDs and LVIDs if using persistent .cache file

If we're using persistent .cache file, we're reading this file instead
of traversing the /dev content. Fix missing indexing by VGID and LVID
here - hook this into persistent_filter_load where we populate device
cache from persistent .cache file instead of scanning /dev.

For example, inducing situation in which we warn about different device
actually used than what LVM thinks should be used based on metadata:

$ lsblk -s /dev/vg/lvol0
NAME     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vg-lvol0 253:4    0  124M  0 lvm
`-loop1    7:1    0  128M  0 loop

$ lvmconfig --type diff

global {
use_lvmetad=0
}
devices {
obtain_device_list_from_udev=0
}

(obtain_device_list_from_udev=0 also means the persistent .cache file is used)

Before this patch - pvs is fine as it does the dev scan, but lvs relies
on persistent .cache file and it misses the VGID/LVID indices to check
and warn about incorrect devices used:

$ pvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop0 vg lvm2 a--  124.00m    0

$ lvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  LV    VG Attr       LSize
  lvol0 vg -wi-a----- 124.00m

With this patch applied - both pvs and lvs is fine - the indices are
always created correctly (lvs just an example here, other LVM commands
that rely on persistent .cache file are fixed with this patch too):

$ pvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop0 vg lvm2 a--  124.00m    0

$ lvs
  Found duplicate PV B9gXTHkIdEIiMVwcOoT2LX3Ywh4YIHgR: using /dev/loop0 not /dev/loop1
  Using duplicate PV /dev/loop0 without holders, ignoring /dev/loop1
  WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/loop1 instead of /dev/loop0.
  LV    VG Attr       LSize
  lvol0 vg -wi-a----- 124.00m

8 years agodev-cache: handle situation where device is referenced in sysfs, but the node is...
Peter Rajnoha [Wed, 30 Mar 2016 08:29:35 +0000 (10:29 +0200)]
dev-cache: handle situation where device is referenced in sysfs, but the node is not yet in dev dir

It's possible that while a device is already referenced in sysfs, the node
is not yet in /dev directory.

This may happen in some rare cases right after LVs get created - we sync
with udev (or alternatively we create /dev content ourselves) while VG
lock is held. However, dev scan is done without VG lock so devices may
already be in sysfs, but /dev may not be updated yet if we call LVM command
right after LV creation (so the fact that fs_unlock is done within VG
lock is not usable here much). This is not a problem with devtmpfs as
there's at least kernel name for device in /dev as soon as the sysfs
item exists, but we still support environments without devtmpfs or
where different directory for dev nodes is used (e.g. our test suite).

This patch covers these situations by tracking such devices in
_cache.sysfs_only_names helper hash for the vgid/lvid check to work still.

This also resolves commit 6129d2e64d14047169048775dc7081135c0fcc50
which was then reverted by commit 109b7e2095a7bc5603bf79db0224b8399463af7c
due to performance issues it may have brought (...and it didn't resolve
the problem fully anyway).

8 years agotest: Add missing directory
Marian Csontos [Tue, 29 Mar 2016 06:24:52 +0000 (08:24 +0200)]
test: Add missing directory

Fix commit bb93a28bc1

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