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

10313 Commits

Author SHA1 Message Date
David Teigland
97e3e84c2c man: update lvmthin about repair and recovery
Explain the thin metadata repair might not work.
Clarify that a full thin pool won't require fsck for journaled fs.
2015-02-19 10:49:39 -06:00
Peter Rajnoha
f80e7bb61b configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
AC_ARG_WITH(default-raid10r-segtype --> AC_ARG_WITH(default-raid10-segtype

(...raid10r... --> ...raid10... - extra "r")
2015-02-19 16:19:15 +01:00
Zdenek Kabelac
af395e61d5 cleanup: drop unused header file 2015-02-19 14:44:04 +01:00
Zdenek Kabelac
a18d789684 cleanup: simplify error path code
Mempool needs to free only with first alllocated element,
everything allocated afterwards is released as well.
2015-02-19 14:44:04 +01:00
Zdenek Kabelac
4c184e9d6b cleanup: drop unused value assign
Dop unused value assignments.

Unknown is detected via other combination
(!linear && !striped).

Also change the log_error() message into a warning,
since the function is not really returning error,
but still keep the INTERNAL_ERROR.

Ret value is always set later.
2015-02-19 14:43:25 +01:00
Peter Rajnoha
ed420fb691 pvcreate: switch to "none" dev-ext source during pvcreate
The dev ext source must be reset for the dev_cache_get call
(which evaluates filters), not lvmcache_label_scan - so fix
original commit 727c7ff85d.

Also, add comments in _pvcreate_check fn explaining why
refresh filter and rescan is needed and exactly in which
situations.
2015-02-19 14:34:55 +01:00
Peter Rajnoha
69b1e32c8a wiping: blkid: do not count skipped signatures in final number of wipes
We exclude some signatures from being wiped when using blkid wiping.
These are signatures which we simply overwrite. For example, the
LVM2_member signature which denotes a PV - if we call pvcreate on
existing PV, we just overwrite the PV header, no need to wipe it.

Previously, we counted such signatures as if they were wiped
and they were counted in the final number of wiped signatures
that _wipe_known_signatures_with_blkid fn returned in the "wiped"
output arg. Then the code checking this output arg could be
mislead that wiping happened while no wiping took place in real
and we could fire some code uselessly based on this information
(e.g. refreshing filters/rescanning - see also
commit 6b4066585f).
2015-02-19 13:30:05 +01:00
Petr Rockai
373f855684 clvmd: Fix BZ 1140095 by updating lastfd upon EINTR. 2015-02-18 12:45:43 +01:00
Petr Rockai
88411fb6f9 test: Avoid a race in pvmove-restart.sh. 2015-02-18 12:27:47 +01:00
Petr Rockai
733e3f6f98 test: Make pvmove0 device removal more robust, in pvmove-restart.sh. 2015-02-18 10:21:06 +01:00
Zdenek Kabelac
10b8d2a4ea tests: hide uninteresting output
We don't care about diff output.
2015-02-17 15:54:21 +01:00
Petr Rockai
973afcbb20 NIX: Fix a typo that broke evaluation of fc19+. 2015-02-17 15:32:04 +01:00
Zdenek Kabelac
a009c0fb40 cleanup: fix compate of return value
Drop '!' for 'ret' compare.
Since the effect of false compare was only stack trace printing,
it present no real code flow change.
2015-02-17 13:40:35 +01:00
Zdenek Kabelac
4bb60c05bf cleanup: drop !! from code
It's unused piece of code - but gcc5 noticed problem with
usage of !! on the leftside.
2015-02-17 13:39:47 +01:00
Zdenek Kabelac
cb144c0097 cleanup: drop unused val 2015-02-17 13:39:26 +01:00
Zdenek Kabelac
cd1a76a492 tests: syncaction update
Improve syncaction testing with some minor
workaround for current upstream kernel
2015-02-17 11:05:04 +01:00
Zdenek Kabelac
120e1aa4bd tests: ensure lv1 goes away first
$lv1 may appear in the table after -pvmove0 which could make -pvmove0
unremovable.
2015-02-17 11:05:04 +01:00
Peter Rajnoha
6b4066585f filters: no need to refresh filters/rescan if no signature is wiped during pvcreate at all
Before, we refreshed filters and we did full rescan of devices if
we passed through wiping (wipe_known_signatures fn call). However,
this fn returns success even if no signatures were found and so
nothing was wiped. In this case, it's not necessary to do the
filter refresh/rescan of devices as nothing changed clearly.

This patch exports number of wiped signatures from all the
wiping functions below. The caller (_pvcreate_check) then checks
whether any wiping was done at all and if not, no refresh/rescan
is done, saving some time and resources.
2015-02-17 09:46:34 +01:00
Petr Rockai
1ee82b545b spec: Include lvmsystemid.7 in RPMs. 2015-02-16 17:15:03 +01:00
Petr Rockai
78d7466713 NIX: Fix CentOS builds. 2015-02-16 15:32:01 +01:00
Petr Rockai
df28c4d912 NIX: Resolve issues with fedora-release and kernel-modules-extra. 2015-02-16 15:32:01 +01:00
Peter Rajnoha
727c7ff85d pvcreate: switch to "none" dev-ext source during pvcreate
pvcreate code path executes signature wiping if there are any signatures
found on device to prepare the device for PV. When the signature is wiped,
the WATCH udev rule triggers the event which then updates udev database
with fresh info, clearing the old record about previous signature.

However, when we're using udev db as dev-ext source, we'd need to wait
for this WATCH-triggered event. But we can't synchronize against such
events (at least not at this moment). Without this sync, if the code
continues, the device could still be marked as containing the old
signature if reading udev db. This may end up even with the device
to be still filtered, though the signature is already wiped.

This problem is then exposed as (an example with md components):

$  mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb --run
$  mdadm -S /dev/md0
$  pvcreate -y /dev/sda
Wiping linux_raid_member signature on /dev/sda.
/dev/sda: Couldn't find device.  Check your filters?
$ echo $?
5

So we need to temporarily switch off "udev" dev-ext source here
in this part of pvcreate code until we find a way how to sync
with WATCH events.

(This problem does not occur with signature wiping which we do
on newly created LVs since we already handle this properly with
our udev flags - the LV_NOSCAN/LV_TEMPORARY flag. But we can't use
this technique for non-dm devices to keep WATCH rule under control.)
2015-02-16 15:07:00 +01:00
Alasdair G Kergon
032c9178ca conf: Set default global/etc from --with-confdir. 2015-02-13 19:10:10 +00:00
David Teigland
d726246f78 system_id: warn if the system_id_file cannot be opened 2015-02-13 11:37:11 -06:00
David Teigland
def0866ded system_id: omit leading hyphens from system_id 2015-02-13 11:14:46 -06:00
David Teigland
737c992431 toollib: add underscore to static ignore_vg function 2015-02-13 11:01:55 -06:00
David Teigland
d3f3878ffd WHATS_NEW for system_id 2015-02-13 10:27:17 -06:00
David Teigland
8cdec4c434 system_id: use for VG ownership
See included lvmsystemid(7) for full description.
2015-02-13 10:10:27 -06:00
David Teigland
f5d06efbab vgextend: Use process_each_vg.
Tags and --select are not yet supported because new code is needed
to ensure exactly one VG matches before the VG starts to be processed.
2015-02-13 14:58:51 +00:00
Peter Rajnoha
1ced5562cd tests: fix pvcreate-operation-md test to properly clean up devs before their reuse
pvcreate filters out devices with existing partitions defined on them,
we need to properly clean up the devs before we reuse them.
2015-02-13 14:53:26 +01:00
Peter Rajnoha
993c988895 tests: comment in select-tools.sh 2015-02-13 11:45:13 +01:00
Peter Rajnoha
e0ce728579 tolllib: process_each_pv: always use full_filter unconditionally when getting all devices
(This reverts patch #d95c6154)

Filter complete device list through full_filter unconditionally when
we're getting the list of *all* devices even in case we're interested
only in fraction of those devices - the PVs, not the other devices
which are not PVs yet (e.g. pvs vs. pvs -a).

We need to do this full filtering whenever we're handling *complete*
list of devices, we need to be safe here, mainly if there are any
future changes and we'd forgot to change to use proper filtering then.
Also properly preventing duplicates if there are any block subsystem
components used (mpath, MD ...).

Thing here is that (under use_lvmetad=1), cmd->filter can be used
only if we're sure that the list of devices we're filtering contains
only PVs. We have to use cmd->full_filter otherwise (like it is in
case of _get_all_devices fn which acquires complete list of devices,
no matter if it is a PV or not).

Of course, cmd->full_filter is more extensive than cmd->filter
which is only a subset of full_filter.

We could optimize this in a way that if we're interested in PVs only
during process_each_pv processing (e.g. using pvs in contrast to pvs -a),
we'd get the list of PV devices directly from lvmetad from the
lvmcache_seed_infos_from_lvmetad fn call which currently updates
lvmcache only. We'd add an additional output arg for this fn to get
the list of PV devices directly in addition, without a need to iterate
over all devices which include non-PVs which we're not interested in
anyway, hence we could use only cmd->filter, not the cmd->full_filter.

So the code would look something like this:

static int _get_all_devices(....)
{
	struct device_id_list *dil;

	if (interested_in_pvs_only)
		lvmcache_seed_infos_from_lvmetad(cmd, &dil); /* new "dil" arg */
		/* the "dil" list would be filtered through cmd->filter inside lvmcache_seed_infos_from_lvmetad */
	else {
		lvmcache_seed_infos_from_lvmetad(cmd, NULL);
		dev_iter_create(cmd->full_filter)
		while (dev = dev_iter_get ...) {
			dm_list_add(all_devices, &dil->list);
		}
	}
}
2015-02-13 11:27:09 +01:00
Peter Rajnoha
1c005b557a tests: select-tools.sh: pvchange now uses process_each_pv
pvchange now uses process_each_pv so uncomment parts of the test
which check proper functionality of intersection between selection
result and PVs or PV tags directly provided on command line. This
didn't work properly before when pvchange was not using process_each_pv.

For example:

  pvchange -u -S 'pv_name=/dev/sda' /dev/sdb

..changes nothing since clearly the intersection of /dev/sda and
/dev/sdb is empty set. The same applies for tags:

  pvchange -u -S 'pv_name=/dev/sda' @some_tag

..changes nothing if /dev/sda is not tagged with some_tag.
2015-02-13 11:27:09 +01:00
Peter Rajnoha
969d2bf448 cleanup: remove deallocate_handle_root arg from destroy_procesing_handle fnw 2015-02-13 11:27:09 +01:00
Peter Rajnoha
66b10d6d12 cleanup: replace static struct processing_handle initializer with common init_processing_handle
It's cleaner this way - do not mix static and dynamic
(init_processing_handle) initializers. Use the dynamic one everywhere.
This makes it easier to manage the code - there are no "exceptions"
then and we don't need to take care about two ways of initializing the
same thing - just use one common initializer throughout and it's clear.

Also, add more comments, mainly in the report_for_selection fn explaining
what is being done and why with respect to the processing_handle and
selection_handle.
2015-02-13 11:26:57 +01:00
Peter Rajnoha
1a72933143 pvchange: no need to initialize selection handle directly, process_each_pv will do that automatically 2015-02-13 09:29:30 +01:00
Peter Rajnoha
e1710f34bb lvchange: change msg about required params (LV or selection) to be consistent with msgs used in other tools 2015-02-13 09:04:21 +01:00
Alasdair G Kergon
e4e703ab60 pvchange: Use process_each_pv.
Invalid devices no longer included in the counters printed at the end.
May now need to use --ignoreskippedcluster if relying upon exit status.
If more than one change is requested per-PV, attempt to perform them
all.  Note that different arguments still handle exit status
differently.
2015-02-12 16:37:47 +00:00
Peter Rajnoha
acb6c06207 autoreconf: recent changes
autoconf-2.69-14.fc20.noarch
automake-1.13.4-6.fc20.noarch
2015-02-12 15:48:12 +01:00
Zdenek Kabelac
77ceb3ee47 valgrind: when executed within valrind skip close
Since valgrind uses internal file descriptors for communication,
don't try to close them in this case.
2015-02-12 15:40:54 +01:00
Zdenek Kabelac
9809038b9d memory: disable check with valgrind pool build
When lvm2 is build with valgrind pool detection - always disable
memcheck, since pool memory allocation are unconditionaly passed
into valgrind library.
2015-02-12 15:40:53 +01:00
Zdenek Kabelac
425c04e4dc configure.in: AC_SUBST needs to be always executed 2015-02-12 15:40:53 +01:00
Zdenek Kabelac
d303d9973f tests: BACKING_DEV
Reset BACKING_DEV when it's same as LOOP.
Reset only 64K - so just eats a bit less space from underlaying loop
devices...
2015-02-12 15:40:52 +01:00
Zdenek Kabelac
4b7097b96c tests: ensure array is synchronized
Before continue of repair test, ensure mirror is in sync
2015-02-12 15:38:51 +01:00
Zdenek Kabelac
739b751046 tests: don't crash if checked string is shorter
Not really sure what is this testing - just avoid coredump if
the test cannot happen since the index would too high.
2015-02-12 15:38:51 +01:00
Zdenek Kabelac
b1002e98e0 makefiles: more _CFLAGS for -MM
Move of valgrind flags to _CFLAGS make the -MM generation
not compilable (d571eab3b2)

Add these _CFLAGS right into .c->.d rules
(as well as  UDEV)
2015-02-12 15:38:50 +01:00
Zdenek Kabelac
65d95caad5 tests: respect LVM_TEST_DIR
Check for empty LVM_TEST_DIR
(regression from 48275c7836)
2015-02-12 15:38:50 +01:00
Peter Rajnoha
d95c6154ff toollib: process_each_pv: fix commit d38d047e which worked for processing "all devices", but didn't work for "all PVs"
We still need to get the list as the calls underneath process_each_pv
rely on this list. But still keep the change related to the filters -
if we're processing all devices, we need to use cmd->full_filter.
If we're processing only PVs, we can use cmd->filter only to save
some time which would be spent in filtering code.
2015-02-12 14:14:45 +01:00
Peter Rajnoha
e52c998c49 toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs)
When lvmetad is used and at the same time we're getting list of all
PV-capable devices, we can't use cmd->filter (which is used to filter
out lvmetad responses - so we're sure that the devices are PVs already).

To get the list of PV-capable devices, we're bypassing lvmetad (since
lvmetad only caches PVs, not all the other devices which are not PVs).
For this reason, we have to use the "full_filter" filter chain (just
like we do when we're running without lvmetad).

Example scenario:
- sdo and sdp components of MD device md0
- sdq, sdr and sds components of mpatha multipath device
- mpatha multipath device partitioned
- vda device partitioned

=> sdo,sdp,sdr,sds, mpatha and vda should be filtered!

$ lsblk -o NAME,TYPE
NAME            TYPE
sdn             disk
sdo             disk
`-md0           raid0
sdp             disk
`-md0           raid0
sdq             disk
`-mpatha        mpath
  `-mpatha1     part
sdr             disk
`-mpatha        mpath
  `-mpatha1     part
sds             disk
`-mpatha        mpath
  `-mpatha1     part
vda             disk
|-vda1          part
`-vda2          part
  |-fedora-swap lvm
  `-fedora-root lvm

Before this patch:
==================
use_lvmetad=0 (correct behaviour!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

use_lvmetad=1 (incorrect behaviour - sdo,sdp,sdq,sdr,sds and mpatha not filtered!)
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha              ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/sdo                        ---     0     0
  /dev/sdp                        ---     0     0
  /dev/sdq                        ---     0     0
  /dev/sdr                        ---     0     0
  /dev/sds                        ---     0     0
  /dev/vda                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0

With this patch applied:
========================
use_lvmetad=1
$ pvs -a
  PV                  VG     Fmt  Attr PSize PFree
  /dev/fedora/root                ---     0     0
  /dev/fedora/swap                ---     0     0
  /dev/mapper/mpatha1             ---     0     0
  /dev/md0                        ---     0     0
  /dev/sdn                        ---     0     0
  /dev/vda1                       ---     0     0
  /dev/vda2           fedora lvm2 a--  9.51g    0
2015-02-12 13:46:11 +01:00
Peter Rajnoha
d38d047eec toollib: process_each_pv: do not acquire list of all devices if not necessary
List of all devices is only needed if we want to process devices
which are not PVs (e.g. pvs -a). But if this is not the case, it's
useless to get the list of all devices and then discard it without
any use, which is exactly what happened in process_each_pv where
the code was never reached and the list was unused if we were
processing just PVs, not all PV-capable devices:

int process_each_pv(...)
{
	...
	process_all_devices = process_all_pvs &&
			      (cmd->command->flags & ENABLE_ALL_DEVS) &&
			      arg_count(cmd, all_ARG);
	...
	/*
	 * If the caller wants to process all devices (not just PVs), then all PVs
	 * from all VGs are processed first, removing them from all_devices.  Then
	 * any devs remaining in all_devices are processed.
	*/
	_get_all_devices(cmd, &all_devices);
	...
	ret = _process_pvs_in_vgs(...);
	...
	if (!process_all_devices)
		goto out;

        ret = _process_device_list(cmd, &all_devices, handle, process_single_pv);
	...
}

This patch adds missing check for "process_all_devices" and it gets the
list of all (including non-PV) devices only if needed:
2015-02-12 13:46:11 +01:00