1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

15766 Commits

Author SHA1 Message Date
Ming-Hung Tsai
df0797db8c lvmanip: uninitialized members in struct pv_list (#10)
Scenario: Given an existed LV `lvol0`, I want to create another LV
on the PVs used by `lvol0`.

I use `build_parallel_areas_from_lv()` to obtain the `pv_list` of each segments.
However, the returned `pv_list` is not properly initialized, which causes
segfault in subsequent operations.

(cherry picked from commit 859feb81e5)
(cherry picked from commit 219ba4f54a)

Conflicts:
	WHATS_NEW
2018-12-19 09:18:25 +01:00
Marian Csontos
2d077286b9 post-release 2018-12-07 15:19:10 +01:00
Marian Csontos
f5ea02ffee pre-release 2018-12-07 15:12:34 +01:00
Marian Csontos
262a42025f build: make generate 2018-12-07 15:05:50 +01:00
Zdenek Kabelac
d5234e1b7e libdm: do not add params for resume and remove
DM_DEVICE_CREATE with table is doing several ioctl operations,
however only some of then takes parameters.
Since _create_and_load_v4() reused already existing dm task from
DM_DEVICE_RELOAD it has also kept passing its table parameters
to DM_DEVICE_RESUME ioctl - but this ioctl is supposed to not take
any argument and thus there is no wiping of passed data - and
since kernel returns buffer and shortens dmi->data_size accordingly,
anything past returned data size remained uncleared in zfree()
function.

This has problem if the user used dm_task_secure_data (i.e. cryptsetup),
as in this case binary expact secured data are erased from main memory
after use, but they may have been left in place.

This patch is also closing the possible hole for error path,
which also reuse same dm task structure for DM_DEVICE_REMOVE.
2018-12-06 17:46:51 +01:00
David Teigland
a188b1e513 pvscan lvmetad: use udev info to improve md component detection
When no md devs are started, pvscan will only scan the start of
an md component, and if it has a superblock at the end may not
exclude it.  udev may already have info identifying it as an
md component, so use that.
2018-12-03 11:05:35 -06:00
David Teigland
9764ee0b3f lvmetad: fix disabling in previous commit
it broke the case where a connection already exists.
2018-11-30 15:49:03 -06:00
David Teigland
322d4ed05e lvmetad: only disable if repair will do something
lvconvert --repair would disable lvmetad at the start of
the command.  This would leave lvmetad disabled even if the
command did nothing.  Move the step to disable lvmetad until
later, just before some actual repair is done.  There are
now numerous cases where nothing is actually done and lvmetad
is not disabled.
2018-11-30 14:54:19 -06:00
David Teigland
a01e1fec0f pvscan lvmetad: use full md filter when md 1.0 devices are present
Apply the same logic to pvscan/lvmetad that was added to
the non-lvmetad label_scan in commit 3fd75d1b:
  scan: use full md filter when md 1.0 devices are present

Before scanning, check if any of the devs on the system are
md 0.90/1.0, and if so make the scan read both the start and
the end of the device so that the components of those md
versions can be ignored.
2018-11-29 14:08:46 -06:00
Peter Rajnoha
0e42ebd6d4 scan: md metadata version 0.90 is at the end of disk
commit de28637
  scan: use full md filter when md 1.0 devices are present

missed the fact that md superblock version 0.90 also puts
metadata at the end of the device, so the full md filter
needs to be used when either 0.90 or 1.0 is present.
2018-11-29 12:16:37 -06:00
David Teigland
fe1cabfa34 WHATS_NEW: sync io 2018-11-20 09:04:37 -06:00
David Teigland
cb5405ded8 bcache: sync io fixes
fix lseek error check
fix read/write error checks
handle zero return from read and write
don't return an error for short io
fix partial read/write loop
2018-11-20 09:04:37 -06:00
David Teigland
f8ce9bf3bc io: use sync io if aio fails
io_setup() for aio may fail if a system has reached the
aio request limit.  In this case, fall back to using
sync io.  Also, lvm use of aio can be disabled entirely
with config setting global/use_aio=0.

The system limit for aio requests can be seen from
  /proc/sys/fs/aio-max-nr

The current usage of aio requests can be seen from
  /proc/sys/fs/aio-nr

The system limit for aio requests can be increased by
setting fs.aio-max-nr using sysctl.

Also add last-byte limit to the sync io code.
2018-11-20 09:00:26 -06:00
David Teigland
9fda169077 update WHATS_NEW 2018-11-06 16:41:43 -06:00
David Teigland
9799c8da07 devices: reuse bcache fd when getting block size
This avoids an unnecessary open() on the device.
2018-11-06 16:41:04 -06:00
Bryn M. Reeves
613466aa8f dmsetup: fix stats report command output
Since the stats handle is neither bound nor listed before the
attempt to call dm_stats_get_nr_regions(), it will always return
zero: this prevents reporting of any dmstats regions on any
device.

Remove the dm_stats_get_nr_regions() check and instead rely on
the correct return status from dm_stats_populate() which only
returns 0 in the case that there are regions to inspect (and
which logs a specific error for all other cases).

Reported-by: Bryan Gurney <bgurney@redhat.com>
2018-11-01 16:49:55 +00:00
Bryn M. Reeves
813a83b2d6 libdm-stats: move no regions warning after dm_stats_list()
It doesn't make sense to test or warn about the region count until
the stats handle has been listed: at this point it may or may not
contain valid information (but is guaranteed to be correct after
the list).
2018-11-01 16:47:56 +00:00
Marian Csontos
fa8d5e4e81 post-release 2018-10-30 10:01:01 +01:00
Marian Csontos
b93aded021 pre-release 2018-10-30 10:00:58 +01:00
Marian Csontos
efa281685a Update WHATS_NEW 2018-10-30 10:00:24 +01:00
David Teigland
ab27d5dc2a metadata: prevent writing beyond metadata area
lvm uses a bcache block size of 128K.  A bcache block
at the end of the metadata area will overlap the PEs
from which LVs are allocated.  How much depends on
alignments.  When lvm reads and writes one of these
bcache blocks to update VG metadata, it can also be
reading and writing PEs that belong to an LV.

If these overlapping PEs are being written to by the
LV user (e.g. filesystem) at the same time that lvm
is modifying VG metadata in the overlapping bcache
block, then the user's updates to the PEs can be lost.

This patch is a quick hack to prevent lvm from writing
past the end of the metadata area.
2018-10-29 16:46:03 -05:00
Marian Csontos
bd872064a2 spec: Fix python and applib interactions
When python3 is not present, macro expends to --disable-applib.
2018-10-29 16:48:42 +01:00
David Teigland
d1b652143a tests: add new test for lvm on md devices 2018-10-18 12:36:11 -05:00
David Teigland
e7bb508809 scan: enable full md filter when md 1.0 devices are present
The previous commit de2863739f
    scan: use full md filter when md 1.0 devices are present

needs the use_full_md_check flag in the md filter, but
the cmd struct is not available when the filter is run,
so that commit wasn't working.  Fix this by setting the
flag in a global variable.

(This was fixed in the master branch with commit 8eab37593
in which the cmd struct was passed to the filters, but it
was an intrusive change, so this commit is using the less
intrusive global variable.)
2018-10-18 12:35:57 -05:00
David Teigland
de2863739f scan: use full md filter when md 1.0 devices are present
The md filter can operate in two native modes:
- normal: reads only the start of each device
- full: reads both the start and end of each device

md 1.0 devices place the superblock at the end of the device,
so components of this version will only be identified and
excluded when lvm uses the full md filter.

Previously, the full md filter was only used in commands
that could write to the device.  Now, the full md filter
is also applied when there is an md 1.0 device present
on the system.  This means the 'pvs' command can avoid
displaying md 1.0 components (at the cost of doubling
the i/o to every device on the system.)

(The md filter can operate in a third mode, using udev,
but this is disabled by default because there have been
problems with reliability of the info returned from udev.)
2018-10-17 13:49:40 -05:00
Heinz Mauelshagen
c26bde42af lvconvert: fix interim segtype regression on raid6 conversions
When converting from striped/raid0/raid0_meta
to raid6 with > 2 stripes, allow possible
direct conversion (to raid6_n_6).

In case of 2 stripes, first convert to raid5_n to restripe
to at least 3 data stripes (the raid6 minimum in lvm2) in
a second conversion before finally converting to raid6_n_6.

As before, raid6_n_6 then can be converted
to any other raid6 layout.

Enhance lvconvert-raid-takeover.sh to test the
2 stripes conversions to raid6.

Resolves: rhbz1624038
(cherry picked from commit e2e30a64ab)

Conflicts:
	WHATS_NEW
2018-09-10 11:21:02 +02:00
Heinz Mauelshagen
0e03c68619 lvconvert: avoid superfluous interim raid type
When converting striped/raid0*/raid6_n_6 <-> raid4,
avoid superfluous interim raid5_n layout.

Related: rhbz1447809
(cherry picked from commit 22a1304368)
2018-09-05 16:41:14 +02:00
Peter Rajnoha
3374a59250 scripts: add After=rbdmap.service to {lvm2-activation-net,blk-availability}.service
We need to have Ceph RBD devices mapped first before use in a stack
where LVM is on top so make sure rbdmap.service is called before
generated lvm2-activation-net.service.

On shutdown, we need to stop blk-availability first before we stop the
rbdmap.service.

Resolves: rhbz1623479
(cherry picked from commit cb17ef221b)

Conflicts:
	WHATS_NEW
2018-09-05 14:41:55 +02:00
Zdenek Kabelac
6afb911252 tests: check activation of many thin-pool
Artifitical testing of monitoring of many thin-pools with low number
of resources in use (need only few pools to actually hit the race).
2018-09-05 14:40:01 +02:00
Zdenek Kabelac
a8d59404f7 dmeventd: lvm2 plugin uses envvar registry
Thin plugin started to use configuble setting to allow to configure
usage of external scripts - however to read this value it needed to
execute internal command as dmeventd itself has no access to lvm.conf
and the API for dmeventd plugin has been kept stable.

The call of command itself was not normally 'a big issue' until users
started to use higher number of monitored LVs and execution of command
got stuck because other monitored resource already started to execute
some other lvm2 command and become blocked waiting on VG lock.

This scenario revealed necesity to somehow avoid calling lvm2 command
during resource registration - but this requires bigger changes - so
meanwhile this patch tries to minimize the possibility to hit this race
by obtaining any configurable setting just once - such patch is small
and covers majority of problem - yet better solution needs to be
introduced likely with bigger rework of dmeventd.

TODO: Avoid blocking registration of resource with execution of lvm2
commands since those can get stuck waiting on mutexes.
2018-09-05 14:39:14 +02:00
Marian Csontos
a1a89a453f Update WHATS_NEW 2018-08-28 15:31:55 +02:00
David Teigland
ed749cdb5b WHATS_NEW: recent fixes 2018-08-27 14:41:29 -05:00
David Teigland
5502f72e41 lvmetad: fix pvs for many devices
When using lvmetad, 'pvs' still evaluates full filters
on all devices (lvmetad only provides info about PVs,
but pvs needs to report info about all devices, at
least sometimes.)

Because some filters read the devices, pvs still reads
every device, even with lvmetad (i.e. lvmetad is no help
for the pvs command.)  Because the device reads are not
being managed by the standard label scan layer, but only
happen incidentally through the filters, there is nothing
to control and limit the bcache content and the open file
descriptors for the devices.  When there are a lot of devs
on the system, the number of open fd's excedes the limit
and all opens begin failing.

The proper solution for this would be for pvs to really
use lvmetad and not scan devs, or for pvs to do a proper
label scan even when lvmetad is enabled.  To avoid any
major changes to the way this has worked, just work around
this problem by dropping bcache and closing the fd after
pvs evaluates the filter on each device.
2018-08-27 14:39:49 -05:00
David Teigland
c527a0cbfc lvmetad: improve scan for pvscan all
For 'pvscan --cache' avoid using dev_iter in the loop
after the label_scan by passing the necessary devs back
from the label_scan for the continued pvscan.
The dev_iter functions reapply the filters which will
trigger more io when we don't need or want it.  With
many devs, incidental opens from the filters (not controlled
by the label scan) can lead to too many open files.
2018-08-27 14:39:49 -05:00
Marian Csontos
63d4983890 spec: Disable python bindings on newer versions 2018-08-27 16:17:11 +02:00
David Teigland
a991664dec bcache: reduce MAX_IO to 256
This is the number of concurrent async io requests that
the scan layer will submit to the bcache layer.  There
will be an open fd for each of these, so it is best to
keep this well below the default limit for max open files
(1024), otherwise lvm may get EMFILE from open(2) when
there are around 1024 devices to scan on the system.
2018-08-24 14:50:53 -05:00
Heinz Mauelshagen
ab1aa0a4fb test: add striped -> raid0 test script
(cherry picked from commit 3c966e637f)
2018-08-23 11:29:24 +02:00
Heinz Mauelshagen
d910f75d89 lvconvert: fix conversion attempts to linear
"lvconvert --type linear RaidLV" on striped and raid4/5/6/10
have to provide the convenient interim layouts.  Fix involves
a cleanup to the convenience type function.

As a result of testing, add missing sync waits to
lvconvert-raid-reshape-linear_to_raid6-single-type.sh.

Resolves: rhbz1447809
(cherry picked from commit e83c4f07ca)

Conflicts:
	WHATS_NEW
2018-08-23 11:29:16 +02:00
Marian Csontos
94362423c4 spec: Add vdo plugin for dmeventd 2018-08-23 11:27:17 +02:00
Heinz Mauelshagen
acf40f5587 lvconvert: fix regression preventing direct striped conversion
Conversion to striped from raid0/raid0_meta is directly possible.

Fix a regression setting superfluous interim raid5_n conversion type
introduced by commit bd7cdd0b09.

Add new test script lvconvert-raid0-striped.sh.

Resolves: rhbz1608067
(cherry picked from commit 4578411633)

Conflicts:
	WHATS_NEW
2018-08-21 18:13:51 +02:00
Zdenek Kabelac
227a0d7336 tests: check policy mq can be used with format2 2018-08-07 18:05:35 +02:00
Zdenek Kabelac
a41968c4b4 tests: splitmirror for mirror type 2018-08-07 18:04:41 +02:00
Zdenek Kabelac
672b8c196b mirror: fix splitmirrors for mirror type
With improved mirror activation code --splitmirror issue poppedup
since there was missing proper preload code and deactivation
for splitted mirror leg.
2018-08-07 18:04:39 +02:00
Zdenek Kabelac
cc96eea029 cache: drop metadata_format validation
Allow to use any combination of cache metadata format for policy.
2018-08-07 18:04:14 +02:00
David Teigland
5f648406b0 mirrors: fix read_only_volume_list
If a mirror LV is listed in read_only_volume_list, it would
still be activated rw.  The activation would initially be
readonly, but the monitoring function would immediately
change it to rw.  This was a regression from commit

fade45b1d1 mirror: improve table update

The monitoring function needs to copy the read_only setting
into the new set of mirror activation options it uses.
2018-08-02 11:39:08 -05:00
Marian Csontos
3ebc745f53 Merge branch '2018-06-01-stable' of git://sourceware.org/git/lvm2 into 2018-06-01-stable
* '2018-06-01-stable' of git://sourceware.org/git/lvm2:
  vgcreate: close exclusive fd after pvcreate
2018-08-02 08:08:51 +02:00
Marian Csontos
acd2c6f256 post-release 2018-08-02 08:08:34 +02:00
Marian Csontos
b10b462fde pre-release 2018-08-01 17:30:40 +02:00
David Teigland
a75eb8d74c vgcreate: close exclusive fd after pvcreate
When vgcreate does an automatic pvcreate, it opens the
dev with O_EXCL to ensure no other subsystem is using
the device.  This exclusive fd remained in bcache and
prevented activation parts of lvm from using the dev.

This appeared with vgcreate of a sanlock VG because of
the unique combination where the dev is not yet a PV,
so pvcreate is needed, and the vgcreate also creates
and activates an internal LV for sanlock.

Fix this by closing the exclusive fd after it's used
by pvcreate so that it won't interfere with other
bits of lvm that may try to use the device.
2018-08-01 10:26:28 -05:00
Marian Csontos
0569add94c pre-release 2018-08-01 16:47:09 +02:00