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

16644 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
c38be06531 hints: fix mem leaking buffers 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
1349a52626 hints: validate allocation result 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
219fe72359 hints: validate sscanf results 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
d4d82dbb70 hints: allocate hint only when needed
Avoid mem leaking hint on every loop continue and
allocate hint only when it's going to be added into list.

Switch to use 'dm_strncpy()' and validate sizes.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
70fb31b5d6 hints: rewrite function 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
1f4968289c pvck: check result of dev_get_size
Don't use garbage value for later computations.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
d67ce9e140 cov: fix mem leaking buffer
Free allocated buffer on function's exit.
Also check for fwrite() results.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
0bad3977df cov: avoid passing NULL to strstr function
When 'str1' would be NULL, there is no point to run 2nd. strstr().
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
153e55c20e cov: check for retvalue 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
44bf9c9a6a cov: fix memleak for duplicate device
For  dev_in_device_list() != 0 allocated  'devl' was
actually leaking - so instead allocate 'devl' only
when !dev_in_device_list() and indent code around.
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
82e6b820b8 cov: check for NULL
Since we check for NULL pointers earlier we need
to be consistent across function - since the NULL
would applies across whole function.

When dropping 'mda' check - we are actually
already dereferencing it before - so it can't
be NULL at that places (and it's validated
before entering  _read_mda_header_and_metadata).
2019-11-14 18:06:42 +01:00
Zdenek Kabelac
43f149526d devtype: simplify code
Update code with simpler form and check for fclose().
2019-11-14 18:06:14 +01:00
Zdenek Kabelac
33c8e4de33 cov: fix memory leak
Reapply 23cc7ddc50 to internal version
of libdm.
2019-11-14 18:05:41 +01:00
Heming Zhao
13c254fc05 fix dev_unset_last_byte after write error
dev_unset_last_byte() must be called while the fd is still valid.
After a write error, dev_unset_last_byte() must be called before
closing the dev and resetting the fd.

In the write error path, dev_unset_last_byte() was being called
after label_scan_invalidate() which meant that it would not unset
the last_byte values.

After a write error, dev_unset_last_byte() is now called in
dev_write_bytes() before label_scan_invalidate(), instead of by
the caller of dev_write_bytes().

In the common case of a successful write, the sequence is still:
dev_set_last_byte(); dev_write_bytes(); dev_unset_last_byte();

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2019-11-13 09:36:58 -06:00
Zdenek Kabelac
9cad26be32 WHATS_NEW: update 2019-11-11 22:44:25 +01:00
Zdenek Kabelac
38617213f0 tests: add test of resize of different segtypes 2019-11-11 22:44:25 +01:00