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

16660 Commits

Author SHA1 Message Date
Zdenek Kabelac
4353823306 libdm: set maj:min while creating and reloading device
Add maj:min to the task structure for RELOAD - which is now
handled in _flatten() and will just skip passing device name.
2019-12-10 15:42:59 +01:00
Zdenek Kabelac
df0bc5081c libdm: support device RELOAD with maj:min and devname set
When devices are created - we were not giving meaning error messages
when the failure happened on 'reload' part of creation.

With this patch we are now able to report both name and major:minor.

Enhancment is most visible with 'crypto' devices,
which are using 'secure' memory erase bit.
2019-12-10 15:42:59 +01:00
David Teigland
338f4df54b man pvck: describe settings 2019-12-06 16:24:27 -06:00
David Teigland
3f381784f2 update option description for settings 2019-12-06 16:21:26 -06:00
David Teigland
ec71df6fec pvck: deal with coverity warnings 2019-12-02 11:16:02 -06:00
Marian Csontos
91f91b80f1 post-release 2019-11-30 14:46:56 +01:00
Marian Csontos
3d7f755674 pre-release 2019-11-30 14:45:51 +01:00
Marian Csontos
0a7495e680 build: make generate 2019-11-30 14:24:22 +01:00
David Teigland
5a88b2ce7f pvck: use zalloc in more places 2019-11-27 11:17:15 -06:00
David Teigland
3145a85583 pvck: repair headers and metadata
To write a new/repaired pv_header and label_header:

  pvck --repairtype pv_header --file <file> <device>

This uses the metadata input file to find the PV UUID,
device size, and data offset.

To write new/repaired metadata text and mda_header:

  pvck --repairtype metadata --file <file> <device>

This requires a good pv_header which points to one or two
metadata areas.  Any metadata areas referenced by the
pv_header are updated with the specified metadata and
a new mda_header. "--settings mda_num=1|2" can be used
to select one mda to repair.

To combine all header and metadata repairs:

  pvck --repair --file <file> <device>

It's best to use a raw metadata file as input, that was
extracted from another PV in the same VG (or from another
metadata area on the same PV.)  pvck will also accept a
metadata backup file, but that will produce metadata that
is not identical to other metadata copies on other PVs
and other areas.  So, when using a backup file, consider
using it to update metadata on all PVs/areas.

To get a raw metadata file to use for the repair, see
pvck --dump metadata|metadata_search.

List all instances of metadata from the metadata area:
  pvck --dump metadata_search <device>

Save one instance of metadata at the given offset to
the specified file (this file can be used for repair):

  pvck --dump metadata_search --file <file>
    --settings "metadata_offset=<off>" <device>
2019-11-27 11:13:47 -06:00
David Teigland
2e0f273008 pvck: dump functions cleanup args and return vals 2019-11-27 11:13:47 -06:00
David Teigland
d051e899a5 pvck: dump show most recent metadata 2019-11-27 11:13:47 -06:00
David Teigland
9cf08836ef pvck: allow disk locations to be specified
using --settings:

mda_offset=<offset> mda_size=<size> can be used
in place of the offset/size that normally come
from headers.

metadata_offset=<offset> prints/saves one instance
of metadata text at the given offset, in
metadata_all or metadata_search.
2019-11-27 11:13:47 -06:00
David Teigland
53126ceada pvck: move some arg processing 2019-11-27 11:13:47 -06:00
David Teigland
94076245df scan: add simple scan to find a pvid 2019-11-27 11:13:47 -06:00
David Teigland
74ad2cd76f metadata: add vg_from_config_tree
Add cmd/fmt args to import functions so that
they can be used without the fid arg which.
2019-11-27 11:13:47 -06:00
David Teigland
13c629fb78 Revert "cov: use zalloc"
This reverts commit 9af1d63b4d.

fixes folded into subsequent pvck commit
2019-11-27 11:13:43 -06:00
David Teigland
39bd9b111b Revert "pvck: check result of dev_get_size"
This reverts commit 1f4968289c.

fixes folded into subsequent pvck commit
2019-11-27 11:13:40 -06:00
David Teigland
4485b8edca Revert "cov: fix mem leaking buffer"
This reverts commit d67ce9e140.

fixes folded into subsequent pvck commit
2019-11-27 11:13:36 -06:00
David Teigland
657d42e879 Revert "cov: avoid passing NULL to strstr function"
This reverts commit 0bad3977df.

fixes folded into subsequent pvck commit
2019-11-27 11:13:32 -06:00
David Teigland
595aa1d452 Revert "cov: check for retvalue"
This reverts commit 153e55c20e.

fixes folded into subsequent pvck commit
2019-11-27 11:13:09 -06:00
David Teigland
98a8099da9 scanning: use bool type for _scan_text_mismatch 2019-11-27 09:26:49 -06:00
David Teigland
b400353c71 tests hints: update check for io count
Running a reporting command on a VG now includes one
additional read to check the mda_header for any change
to the vg between scan and lock.
2019-11-26 16:52:28 -06:00
David Teigland
a61272a6f0 Revert "lvs: disable scanning optimization"
This reverts commit 7474440d3b.

lvs can use the scanning optimization again since it has
been changed in:
"scanning: optimize by checking text offset and checksum"
2019-11-26 16:52:28 -06:00
David Teigland
0c1316cda8 scanning: optimize by checking text offset and checksum
After the VG lock is taken for vg_read, reread the mda_header
and compare the metadata text offset and checksum to what was
seen during label scan.  If it is unchanged, then the metadata
has not changed since the label scan, and the metadata does not
need to be reread under the lock for command processing.

For commands that do not make changes (e.g. reporting), the
mda_header is reread and checked on one mda to decide if the
full metadata rereading can be skipped.  For other commands
(e.g. modifying the vg) the mda_header is reread and checked
from all PVs.  (These could probably just check one mda also.)
2019-11-26 16:52:28 -06:00
David Teigland
56a295f78c bcache: add invalidate_bytes function 2019-11-26 16:52:28 -06:00
Heinz Mauelshagen
29db9c6325 lvcreate: ensure striped raid region size is at least stripe size
The kernel MD runtime requires region size to be larger than stripe size
on striped raid layouts, thus the dm-raid target's constructor rejects
such request.

This causes e.g. an 'lvcreate --type raid10 -i3 -I4096 -R2048 -n lv vg' to fail.

Avoid failing late in the kernel by enforcing region size to be
larger or equal to stripe size.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1698225
2019-11-26 22:31:58 +01:00
David Teigland
2037476008 pvcreate,pvremove: fix reacquiring global lock after prompt
When pvcreate/pvremove prompt the user, they first release
the global lock, then acquire it again after the prompt,
to avoid blocking other commands while waiting for a user
response.  This release/reacquire changes the locking
order with respect to the hints flock (and potentially other
locks).  So, to avoid deadlock, use a nonblocking request
when reacquiring the global lock.
2019-11-26 14:34:43 -06:00
David Teigland
1c9b36618e writecache: modprobe dm-writecache 2019-11-26 11:21:09 -06:00
David Teigland
bbd8badaef tests: update to md dev name
Restore WAIT_MD_DEV in teardown.

NOTE: The name of MD device may have changed.

(cherry picked from commit c2ff8876f9)
2019-11-26 10:34:51 +01:00
Marian Csontos
b690258518 tests: Find md name using lsblk
After stopping MD device and rescanning the leg, it is created with
different name.
2019-11-26 09:13:17 +01:00
Marian Csontos
4757ce4c2a Partial revert "tests: update to md dev name"
This partially reverts commit c2ff8876f9.

Not all MD devices are stopped. Something is missing there...
2019-11-25 09:23:02 +01:00
Marian Csontos
1e669ab315 test: Fix handling leftovers from previous tests
teardown fails current PREFIX is prefix of previously failed test with
leftovers in dmtable.
2019-11-20 15:27:03 +01:00
David Teigland
7474440d3b lvs: disable scanning optimization
The scanning optimization can produce warnings from
'lvs' when run concurrently with commands modifying LVs,
so disable the optimization until it can be improved.

Without the scanning optimization, lvs will always
read all PVs twice:

1. read metadata from all PVs, saving it in memory
2. for each VG
3. lock VG
4. reread metadata from all PVs in VG, replacing metadata
   saved from step 1
5. run command on VG
6. unlock VG

The optimization would usually cause step 4 to be skipped,
and PVs would be read only once.

Running the command in step 5 using metadata that was not
read under the VG lock is usually fine, except for the
fact that lvs attempts to validate the metadata by comparing
it to current dm state.  If other commands are modifying dm
state while lvs is running, lvs may see differences between
metadata from step 1 and dm state checked during step 5,
and print warnings.

(A better fix may be to detect the concurrent change and
fall back to rereading metadata in step 4 only when needed.)
2019-11-19 10:56:12 -06:00
Zdenek Kabelac
f88f7c0fdc tests: add more tracing info 2019-11-15 12:37:44 +01:00
Zdenek Kabelac
496c368528 tests: reduce amount of written date
Since we reduced created LV to 4M - dd also just 4M.
2019-11-15 12:37:44 +01:00
Zdenek Kabelac
dccc50f6f6 revert "dmeventd: vdo plugin link lvm library"
This reverts commit cbabdf2fca.
and add extra comment why this code may look unused, but
in runtime is necessary.
2019-11-15 12:37:41 +01:00
David Teigland
7ea71a9eb9 Revert "hints: rewrite function"
This reverts commit 70fb31b5d6.
2019-11-14 12:15:05 -06:00
David Teigland
31a862a6be Revert "debug: enhance debug messages"
This reverts commit e92d3bd1f7.
2019-11-14 12:11:53 -06:00
Zdenek Kabelac
91df257b53 tests: enusure lib is initilized 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
e92d3bd1f7 debug: enhance debug messages 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
14e01d6316 hints: drop unneeded memset
strncpy will zero buffer itself.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
1760b96368 hints: no need to check for NULL before free
free() itself checks for NULL.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
9af1d63b4d cov: use zalloc
Instead of malloc() memset() -> zalloc()
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
33c1d2e921 cov: add explicit ret value ignoring
We don't need to check for any error result codes here.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
ad0343d8cb cov: remove unused headers 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
9ee3af7efc cov: more checks for failing syscalls 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
cbabdf2fca dmeventd: vdo plugin link lvm library
Since we fixed linking of proper version of 'libdevmapper' with
linking lvm2 plugin correctly - we already have correct function
available linked with internal lvm library.
So drop unneeded include of parsing function.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
1da5fd8226 cov: inline _build_desc_write
Embed function into the code, since the function is actually
simpler written this as there are no memleak troubles
with failing allocation error path.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
61a483a654 hints: check for _touch_hints
Exit when !_touch_hints().
2019-11-14 18:06:42 +01:00