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

6262 Commits

Author SHA1 Message Date
Zdenek Kabelac
1a0bf79b72 lvm: drop usage of dl library
Since lvm no longer supports any dlopen-able plugins
(which in practice was never really usable) drop linking
with -ldl.

(cherry picked from commit 701ecff0ff)

Conflicts:
	lib/commands/toolcontext.c
2018-12-17 16:14:35 +01:00
Ming-Hung Tsai
219ba4f54a 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)
2018-12-17 16:11:10 +01:00
Zdenek Kabelac
d7725f9b37 cleanup: some local headers first
(cherry picked from commit cc5cfb88d7)
2018-12-17 16:11:09 +01:00
Zdenek Kabelac
8fad471c6e headers: use configure.h as 1st. header
Ensure configure.h is always 1st. included header.
Maybe we could eventually introduce gcc -include option, but for now
this better uses dependency tracking.

Also move _REENTRANT and _GNU_SOURCE into configure.h so it
doesn't need to be present in various source files.
This ensures consistent compilation of headers like stdio.h since
it may produce different declaration.

(cherry picked from commit 0b19387dae)

Conflicts:
	include/configure.h.in
2018-12-17 16:10:56 +01:00
Heinz Mauelshagen
74906dad60 raid: fix (de)activation of RaidLVs with visible SubLVs
There's a small window during creation of a new RaidLV when
rmeta SubLVs are made visible to wipe them in order to prevent
erroneous discovery of stale RAID metadata.  In case a crash
prevents the SubLVs from being committed hidden after such
wiping, the RaidLV can still be activated with the SubLVs visible.
During deactivation though, a deadlock occurs because the visible
SubLVs are deactivated before the RaidLV.

The patch adds _check_raid_sublvs to the raid validation in merge.c,
an activation check to activate.c (paranoid, because the merge.c check
will prevent activation in case of visible SubLVs) and shares the
existing wiping function _clear_lvs in raid_manip.c moved to lv_manip.c
and renamed to activate_and_wipe_lvlist to remove code duplication.
Whilst on it, introduce activate_and_wipe_lv to share with
(lvconvert|lvchange).c.

Resolves: rhbz1633167
2018-12-12 16:26:55 +01:00
Heinz Mauelshagen
8eefba4459 lvcreate/lvconvert: prohibit creation of/conversion to mirrored mirror logs
In RHEL7 we marked mirrored mirror logs as deprecated and
added a related message.  This patch prohibits creating new
'mirror' LVs with that log type or converting existing LVs
to have one.

Existing LVs with mirrored mirror log can be activated
and converted to disk/core logs.

Avoid double deprecation message when running lvconvert.

Resolves: rhbz1643562
2018-12-12 16:26:42 +01:00
David Teigland
cb47de4d3e remove unused full filter
it's the same as cmd->filter
2018-12-04 14:33:39 -06:00
David Teigland
7d13df8cef remove unused lvmetad filter 2018-12-04 14:33:38 -06:00
David Teigland
b63cb982ee devs: use udev info to improve md component detection
Use udev info to supplement native md component detection.
2018-12-04 14:33:38 -06:00
Zdenek Kabelac
4f8c928253 gcc: ensure sector is initilized
Some older gcc errnously report the variable can be used uninitlized.
Quite warning by explicit initalization.
2018-12-04 14:33:38 -06:00
Zdenek Kabelac
8ef634d1f9 gcc: avoid shadowing use_aio
Function use_aio() is already declared, avoid its shadowing.
lvm-globals.h:59: warning: shadowed declaration is here
2018-12-04 14:33:38 -06:00
Zdenek Kabelac
e9eac41b31 gcc: avoid shadowing activate_lv
Function activate_lv() is already declared, avoid its shadowing.
activate.h:133: warning: shadowed declaration is here
2018-12-04 14:33:38 -06:00
Peter Rajnoha
b6a767930f 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-12-04 14:33:37 -06:00
David Teigland
d02a64cf36 config settings: fix version 3.0.0
version 3.0.0 was changed in the end to 2.3.0,
but config settings had previously been encoded
with version 3.0.0.
2018-12-04 14:33:37 -06:00
David Teigland
8266d54a55 pvscan systemd service for event based activation
The pvscan systemd service for autoactivation was
mistakenly dropped along with the lvmetad related
services.

The activation generator program now looks at the new
lvm.conf setting "event_activation" (default 1) to
switch between event activation and direct activation.

Previously, the old use_lvmetad setting was used to
switch between event and direct activation.
2018-12-04 14:33:37 -06:00
David Teigland
263e34b9b6 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-12-04 14:33:37 -06:00
David Teigland
52502b1fba 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-12-04 14:33:37 -06:00
Zdenek Kabelac
205b4f0146 activation: trimming string is expected
Commit 813347cf84 added extra validation,
however in this particular we do want to trim suffix out so rather ignore
resulting error code here intentionaly.
2018-12-04 14:33:36 -06:00
David Teigland
35b06d808a devices: reuse bcache fd when getting block size
This avoids an unnecessary open() on the device.
2018-12-04 14:33:36 -06:00
Zdenek Kabelac
c171211254 debug: missing backtrace 2018-12-04 14:33:36 -06:00
Zdenek Kabelac
67d19a480a cleanup: move cast to det_t into MKDEV macro 2018-12-04 14:33:36 -06:00
Zdenek Kabelac
8c4f8c1329 cov: avoid unsing unchecked label_scan_open
Drop extra call too label_scan_open() without checking return value,
and let code go through next call bellow.
2018-12-04 14:33:36 -06:00
Zdenek Kabelac
af08412fd9 cov: remove unused assigns 2018-12-04 14:33:36 -06:00
Zdenek Kabelac
cc83091cd5 cov: add missing check for dm_strncpy 2018-12-04 14:33:36 -06:00
Zdenek Kabelac
e2cb6e8fe0 cov: overflow before widen
Evaluate as 64bit arithmetic (instead of doing 32bit mults which can
in this case purely teoretically overflow).
2018-12-04 14:33:35 -06:00
Zdenek Kabelac
6c9615ce60 cov: remove uneeded code
Since clvmd was dropped this code become useless.
2018-12-04 14:33:35 -06:00
Zdenek Kabelac
7ac14e3d32 label: add stack trace for failing dev_set_last_byte
Temporarily add check for failure, but whole function
needs to be likely traced for error result.

FIXME
2018-12-04 14:33:35 -06:00
David Teigland
2262430681 lvmlockd: fix size/resizing of internal lvmlock LV for sanlock
The lvmlock LV size was not adjusted correctly for 512 vs 4K
sector sizes which influence the lease size used by sanlock.

When lvmlock was automatically extended, the zeroing through
bcache wasn't working.
2018-12-04 14:33:35 -06:00
David Teigland
aecf542126 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:53:17 -05:00
Heinz Mauelshagen
8df2dd66ce Revert "raid: fix left behind SubLVs"
This reverts commit 16ae968d24.

We need to come up with a better fix, because we fall short
wiping all known signatures when not using the wipe_lv API.
2018-10-25 14:35:56 +02:00
Heinz Mauelshagen
16ae968d24 raid: fix left behind SubLVs
lvm metadata writes, commits and activations are performed
for (newly) allocated RAID metadata SubLVs to wipe any preexisiting
data thus avoid false raid superblock positives on RaidLV activation.

This process can be interrupted by command or system crashs
thus leaving stale SubLVs in the lvm metadata as a problem.

Because we hold an exclusive lock in this metadata SubLV wiping
process, we can address this problem by avoiding aforementioned
commits/writes/activations altogether wiping the respective first
sector of the first physical extent allocated to any metadata SubLV
directly via the existing dev_set() API.

Succeeds all LVM RAID tests.

Related: rhbz1633167
2018-10-24 16:35:30 +02:00
David Teigland
2217d6396a fix: cov: missed return value test
use the existing error paths
2018-10-15 11:53:28 -05:00
Zdenek Kabelac
06a4a356db cov: avoid selfrecursive inclusion of toolcontext.h 2018-10-15 17:49:44 +02:00
Zdenek Kabelac
fdd76da33d cov: drop uneeded header files 2018-10-15 17:49:44 +02:00
Zdenek Kabelac
84f00f5058 cov: add missing error path check for label_scan_open 2018-10-15 17:49:44 +02:00
Zdenek Kabelac
b57e73a0f1 cov: make sure label scans valid lvinfo 2018-10-15 17:49:44 +02:00
Zdenek Kabelac
b1ff52ca14 cov: check dev_close_immediate
Function can report log_error() on fail path.
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
253989ecd9 cov: fix error path
Avoid calling 'bad:' section since we have not set 'fd' yet
and instead directly return failing 0 value.
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
13c49033ed cov: fix failing filter initialization
When persistent_filter_create() fails, the existing passed filter
should be preserved, so it could be properly deleted on
error path - so new pfilter is assigned instead.
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
eb566e034f cov: add check for positive value
As pgsize parameter for _init_free_list() can't be negative,
report problem in case for any reason we would get negative number.
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
9b85ecb85b cov: fix memleak on bcache io error path
Drop allocated IO.

merge free bache
2018-10-15 17:49:44 +02:00
Zdenek Kabelac
fbfbbf6d6a cov: drop check for pointer
Pointer must be always set and it's been already dereferenced.
2018-10-15 14:24:28 +02:00
Zdenek Kabelac
5811fa33bb cov: missed return value test
Check validity of read.
2018-10-15 14:24:28 +02:00
Marian Csontos
48768cc5be config: Fix version for VDO 2018-10-11 11:06:23 +02:00
David Teigland
a49f494c4d metadata: clarify comments about max size
Since there is now a direct limit of half the space.
2018-09-24 15:27:03 -05:00
David Teigland
6be1efd13d metadata: add direct size limit
Previously the size was limited by checking if the
old and new copies of the metadata overlapped.
This generally limited the size to about half of
the total space, but it could be larger given the
size differences between old and new.  Now add a
direct check to limit the size to half the space.
2018-09-24 14:41:58 -05:00
David Teigland
91c7e66f2b metadata: remove incorrect comment about alignment 2018-09-20 15:38:09 -05:00
David Teigland
09131e3922 metadata: add comment about negative impact of rounding 2018-09-20 14:15:49 -05:00
David Teigland
30c94b0324 metadata: remove an unused and incorrect overflow check
Remove another instance of an invalid check for metadata
overflow during read.  The previous instance was removed
in commit 5fb15b193.

This was checking for metadata that that overflowed the
circular disk metadata buffer during read, but such metadata
cannot be written, so it shouldn't be possible to find see.
Also, the check was incorrect and could trigger when there
was no overflow.
2018-09-20 13:53:50 -05:00
David Teigland
0aeca60aaa fix readonly activation override options
This fixes a problem in commit e6bb780d24, in which the
back compat handling for the old locking_type=4 was
incorrectly translated to mean the same thing as --readonly,
which prevented activation because activation uses an
exclusive vg lock.  Previously, locking_type=4 allowed
activation.

If we see locking_type 4 in an old config, translate it to
the new combination of --readonly and --sysinit, which we
now define to mean the --readonly behavior with an exception
to allow activation.
2018-09-12 16:30:50 -05:00