1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-25 10:04:17 +03:00

15641 Commits

Author SHA1 Message Date
Zdenek Kabelac
40f57155a3 libdm: print params only for ioctls using them
When preparing ioctl buffer and flatting all parameters,
add table parameters only to ioctl that do process them.

Note: list of ioctl should be kept in sync with kernel code.
(cherry picked from commit 43f8da76997a22be123e97b6d0f357d6ec2d0c7c)

Conflicts:
	WHATS_NEW_DM
	device_mapper/ioctl/libdm-iface.c
2019-03-05 12:47:50 +01:00
Zdenek Kabelac
1bef4dfab3 libdm: add DM_DEVICE_ARM_POLL
Expose DM_DEVICE_ARM_POLL via standard API enum.

(cherry picked from commit 1ae5bf2b833a5d55cf97de1619cc820d4e8c394f)

Conflicts:
	WHATS_NEW_DM
	device_mapper/all.h
	device_mapper/ioctl/libdm-iface.c
2019-03-05 12:46:21 +01:00
Zdenek Kabelac
e974f6866a cleanup: move cast to det_t into MKDEV macro
(cherry picked from commit aa8b2d6a0feb91bb5ea4364cdc53a00dfa233dca)

Conflicts:
	daemons/clvmd/clvmd-common.h
	device_mapper/ioctl/libdm-iface.c
	device_mapper/libdm-common.c
	device_mapper/libdm-deptree.c
2019-03-05 12:39:17 +01:00
Zdenek Kabelac
a93699ece9 cov: remove unused assigns
(cherry picked from commit 70e3d0a613fb53e52f7a7cb31d65bcc2fa7ab738)

Conflicts:
	tools/pvscan.c
	tools/vgchange.c
2019-03-05 12:28:31 +01:00
Zdenek Kabelac
e4bb94a93e cov: hide intentionaly ptr arithmetic report
Only single region count is ever replaced with on-stack uint64_t.

(cherry picked from commit a91ac41b93eff0f3ebd3af3319e8bbcb1fe8d00f)
2019-03-05 12:17:18 +01:00
Zdenek Kabelac
93ac80037a cov: mark warning as expected one
(cherry picked from commit 9238b972c543a83fbd553cc44a916608809cfc53)

Conflicts:
	base/data-struct/radix-tree-adaptive.c
	device_mapper/libdm-file.c
2019-03-05 12:16:33 +01:00
Zdenek Kabelac
c9e5e6800c cov: split check for type assignment
Check that type is always defined, if not make it explicit internal
error (although logged as debug - so catched only with proper lvm.conf
setting).
This ensures later type being NULL can't be dereferenced with coredump.

(cherry picked from commit 79879bd201d4156312bb03fc0b7228ce34a3bf38)
2019-03-05 12:16:07 +01:00
Zdenek Kabelac
f0f68791f3 cov: shutdown warning
Since previous patch reverted coverity patch as this case is intentional,
provide override this coverity warning.

(cherry picked from commit 05b57748274492aa76e530e4513e5f8e9a39a735)
2019-03-05 12:15:40 +01:00
Zdenek Kabelac
b39c26ddc3 revert "cov: dm stats missed terminating null"
This reverts commit 20971f7034cbd329f873e08869bfb7acf3f1ac0e
as the parsing of 'dmstatus' started to fail on present \0 char.

(cherry picked from commit 6179cab877442aac884a0bfcd5c5541396980cdf)
2019-03-05 12:15:16 +01:00
Zdenek Kabelac
d1ae1455b4 cov: ensure vars are set
Make sure, tmp_begin and tmp_end are always set, even for blind
coverity.

(cherry picked from commit 251366146727aac97af5de2eef855860d14910ca)

Conflicts:
	device_mapper/libdm-report.c
2019-03-05 12:14:43 +01:00
Marian Csontos
c115d92287 cov: dmstats check for failing malloc
Add missing check for allocation success.

Backported from: 9b7121226258f7dfe759cc1f8625cbfb80fec161
2019-03-05 12:13:08 +01:00
Zdenek Kabelac
ece117ee10 cov: dm stats missed terminating null
Coverity noticed allocating insufficient memory
for the terminating null of the string.

(cherry picked from commit 20971f7034cbd329f873e08869bfb7acf3f1ac0e)
2019-03-05 12:10:36 +01:00
David Teigland
590a1ebcf7 io: increase the default io memory from 4 to 8 MiB
This is the default bcache size that is created at the
start of the command.  It needs to be large enough to
hold a single copy of metadata for a given VG, or the
VG cannot be read or written (since the entire VG would
not fit into available memory.)

Increasing the default reduces the chances of anyone
needing to increase the default to use their VG.

The size can be set in lvm.conf global/io_memory_size;
the lower limit is 4 MiB and the upper limit is 128 MiB.
2019-03-04 11:18:34 -06:00
David Teigland
863a2e693e io: warn when metadata size approaches io memory size
When a single copy of metadata gets within 1MB of the
current io_memory_size value, begin printing a warning
that the io_memory_size should be increased.
2019-03-04 10:57:52 -06:00
David Teigland
8dbfdb5b73 config: add new setting io_memory_size
which defines the amount of memory that lvm will allocate
for bcache.  Increasing this setting is required if it is
smaller than a single copy of VG metadata.
2019-03-04 10:31:47 -06:00
Marcos Paulo de Souza
675b94a11b pvscan.service.in: Move StartLimitInterval to Service section
Without this patch, pvscan service file contains StartLimitInterval at
the Unit section, which trigger an error:

 Unknown lvalue 'StartLimitInterval' in section 'Unit'

Moving StartLimitInterval to Service section fixes the issue.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.de>
2019-02-28 09:38:34 -06:00
David Teigland
850e95f24a tests: add scan_lvs.sh 2019-02-20 14:38:01 -06:00
David Teigland
083f162e8e WHATS_NEW: scan_lvs 2019-02-20 14:33:09 -06:00
David Teigland
7f56908c2b tests: set scan_lvs=1 in tests that stack PVs on LVs 2019-02-20 14:32:01 -06:00
David Teigland
427e8ba3e3 config: change scan_lvs default to 0
so that lvm does not scan LVs for PVs by default.
2019-02-20 14:31:03 -06:00
David Teigland
6a5575e959 filter: add config setting to skip scanning LVs
devices/scan_lvs (default 1) determines whether lvm
will scan LVs for layered PVs.  The lvm behavior has
always been to scan LVs, but it's rare for LVs to have
layered PVs, and much more common for there to be many
LVs that substantially slow down scanning with no benefit.

This is implemented in the usable filter, and has the
same effect as listing all LVs in the global_filter.
2019-02-20 14:30:24 -06:00
David Teigland
57cde6063f apply obtain_device_list_from_udev to all libudev usage
udev_dev_is_md_component and udev_dev_is_mpath_component
are not used for obtaining the device list, but they still
use libudev for device info.  When there are problems with
udev, these functions can get stuck. So, use the existing
obtain_device_list_from_udev config setting to also control
whether these "is component" functions are used, which gives
us a way to avoid using libudev entirely when it's causing
problems.
2019-02-05 10:20:24 -06:00
David Teigland
d0cb672466 lvmlockd: fix make lockstart wait
when building without lvmlockd
2019-01-31 09:56:29 -06:00
David Teigland
75886f59e4 lvmlockd: make lockstart wait for existing start
If there are two independent scripts doing:
  vgchange --lockstart vg
  lvchange -ay vg/lv

The first vgchange to do the lockstart will wait for
the lockstart to complete before returning.
The second vgchange to do the lockstart will see that
the start is already in progress (from the first) and
will do nothing.  This means the second does not wait
for any lockstart to complete, and moves on to the
lvchange which may find the lockspace still starting
and fail.

To fix this, make the vgchange lockstart command
wait for any lockstart's in progress to complete.
2019-01-31 09:38:50 -06:00
Marian Csontos
1d2de5dd13 spec: Use python3 setuptools with python3 2019-01-03 14:39:28 +01:00
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 859feb81e5b61ac2109b1d7850844ccf1ce3e5bf)
(cherry picked from commit 219ba4f54a462c175f5e9acaa0558afac94d5ff7)

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 v2_02_183 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 v2_02_182 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 de2863739f2ea17d89d0e442379109f967b5919d
    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