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

17189 Commits

Author SHA1 Message Date
Zdenek Kabelac
6b168afcad tests: use parametrized function
Shorten and make the test easily readable by moving same code into
function and removed one duplicated test for 512,4096 combination.

Always use scsi_debug - since default ramdisk or loop device backend
is unpredictible.
2020-09-19 17:30:51 +02:00
Zdenek Kabelac
f63aac5309 tests: use zero backend
Since we are not reading read - just use zero device as backend for
test, so we do not eat real disk space.
2020-09-19 17:30:51 +02:00
Zdenek Kabelac
f7c58c636d tests: use faster awk generator
Shortens log length.
2020-09-19 17:30:51 +02:00
Zdenek Kabelac
8e3e2c74ed tests: ensure mnt is defined before trap install 2020-09-19 17:30:51 +02:00
Zdenek Kabelac
530fc17b38 tests: reduce disk usage 2020-09-19 17:30:51 +02:00
David Teigland
1404e5ee61 metadata: open rw fd before closing ro fd
lvm opens devices readonly to scan them, but
needs to open then readwrite to update the metadata.
Previously, the ro fd was closed before the rw fd
was opened, leaving a small gap where the dev was
not held open, and during which the dev could
possibly change which storage it referred to.

With the bcache_change_fd() interface, lvm opens a
rw fd on a device to be written, tells bcache to
change to the new rw fd, and closes the ro fd.

. open dev ro
. read dev with the ro fd (label_scan)
. lock vg (ex for writing)
. open dev rw
. close ro fd
. rescan dev to check if the metadata changed
  between the scan and the lock
. if the metadata did change, reread in full
. write the metadata
2020-09-18 15:10:11 -05:00
David Teigland
1570e76233 bcache: use indirection table for fd
Add a "device index" (di) for each device, and use this
in the bcache api to the rest of lvm.  This replaces the
file descriptor (fd) in the api.  The rest of lvm uses
new functions bcache_set_fd(), bcache_clear_fd(), and
bcache_change_fd() to control which fd bcache uses for
io to a particular device.

. lvm opens a dev and gets and fd.
  fd = open(dev);

. lvm passes fd to the bcache layer and gets a di
  to use in the bcache api for the dev.
  di = bcache_set_fd(fd);

. lvm uses bcache functions, passing di for the dev.
  bcache_write_bytes(di, ...), etc.

. bcache translates di to fd to do io.

. lvm closes the device and clears the di/fd bcache state.
  close(fd);
  bcache_clear_fd(di);

In the bcache layer, a di-to-fd translation table
(int *_fd_table) is added.  When bcache needs to
perform io on a di, it uses _fd_table[di].

In the following commit, lvm will make use of the new
bcache_change_fd() function to change the fd that
bcache uses for the dev, without dropping cached blocks.
2020-09-18 15:10:11 -05:00
Zdenek Kabelac
4b07ae55f1 tests: printf to awk
Shorten trace logs.
2020-09-18 17:30:45 +02:00
Zdenek Kabelac
9fbcba1c40 tests: update integrity-dmeventd
Use tee.
Switch to more simple generator with awk
(which doesn't produce long debug trace)
Sync before sleep to provoke raid action.
2020-09-18 17:30:45 +02:00
Zdenek Kabelac
9448476202 tests: enhance low-disk-space behavior
Use new SKIP_WITH_LOW_SPACE and set higher requirement for free space.

But still this test can't run on system's tmpfs directories -
as they typically provide less then 2G of space and when the test
runs there it also provisioning for all READ pages!)
BRD (ramdisk) device should work.

Extend a _wait_recalc() loop for slower hw.
When creating large raid which do not need to be fully synchronized use
them on delay devices - so even less data needs read/write.
Remove unneeded lvchange as lvcreate is already leaving LV inactive.
Replace printf with awk as generator.

mm
2020-09-18 17:30:45 +02:00
Zdenek Kabelac
206620018e tests: inittest supports SKIP_WITH_LOW_SPACE
Test can set individually a higher value for required free space on
storage.

Note: it is not fully reliable since when 'brd' (ramdisk) device is used
this free space value is rather meanigul, but it might help
in case where a real filesystem is doing back-end for test devices.
2020-09-18 17:30:31 +02:00
Zdenek Kabelac
048e04e417 tests: utils better handle ouf of disk space
When the test exhausts all the available free space on storage device,
then during the fail we cannot write anything as well - yet
the teardown needs to finish it's work - otherwise we leave
basicaly overfilled filesystem for all remaining tests.
2020-09-18 17:29:26 +02:00
Zdenek Kabelac
b77595ac8b tests: aux better handle invalid table
In cases where internal functions like zero_dev, delay_dev pass-in
invalid parameter so resulting table can't work, resume at least
previous table line before failing out - so the cleaning process
later on is not stuck waiting on a suspended device.
2020-09-18 14:23:20 +02:00
Zdenek Kabelac
a4137412bf tests: also use sed to shorten log output 2020-09-18 00:31:59 +02:00
Zdenek Kabelac
8d40859e29 tests: resolve missing removal of loopdevice on error path
In case of test failure, loop device leaked and occupied space forever.
2020-09-18 00:31:11 +02:00
Zdenek Kabelac
a5e867139d tests: bigger data still needed for 0.7.0 2020-09-17 23:27:52 +02:00
Zdenek Kabelac
7f019f2580 tests: lower memory usage
Reduce memory needed by test at one time.
2020-09-17 23:27:45 +02:00
David Teigland
72b931d664 configure: enable integrity by default 2020-09-16 15:14:51 -05:00
David Teigland
46f43589d0 hints: enhance debug messages 2020-09-16 15:01:10 -05:00
David Teigland
491eb25832 label: cleanup set_byte error exit 2020-09-16 13:54:16 -05:00
David Teigland
37bcd7ce84 Revert "label: use formaters FMTu64 and FMTsize_t"
This reverts commit d0ccb2521b.
2020-09-16 13:47:06 -05:00
Zdenek Kabelac
52d3c4de6e tests: smaller delay and lowered version
See if this will still work. Some boxes are delayed too much.
Also try to check for raid extend progress from version 1.13.
2020-09-16 14:08:05 +02:00
Zdenek Kabelac
49292bccc3 tests: fix bash regex syntax
Typo before last commit.
2020-09-16 14:08:05 +02:00
Zdenek Kabelac
2c6bd480b2 tests: switch for checking version of installed tools
It looks like older tools were compacting metadata more.
2020-09-15 23:07:06 +02:00
Zdenek Kabelac
cf4fed3761 tests: skip kernel for this test
Kills this kernel ATM
2020-09-15 23:07:06 +02:00
Zdenek Kabelac
d0ccb2521b label: use formaters FMTu64 and FMTsize_t
Produces code without casts to differntly signed types
and also shortens and enhances readbility.
2020-09-15 23:07:06 +02:00
Zdenek Kabelac
2b36542f41 wipe: dev_set_bytes resolves zeroing
Since dev_write_zeros() is just subset of dev_set_bytes()
use it directly and simplify code.
2020-09-15 23:07:06 +02:00
Zdenek Kabelac
d588de77aa wipe: convert zero_value to uint8_t
We always write this value as byte.
2020-09-15 22:52:25 +02:00
Zdenek Kabelac
ec4e8b5c0e wipe: zeroing of 8 sectors is granted
With do_zero min is always 8 sectors, so use 0 as default.
2020-09-15 22:52:25 +02:00
Zdenek Kabelac
7bcc994776 label: deduplicate dev_set_bytes
As dev_write_zeros() is same as dev_set_bytes() reused the code
directly.
2020-09-15 22:52:25 +02:00
Zdenek Kabelac
7b08133844 label: code deduplication 2020-09-15 22:52:25 +02:00
Zdenek Kabelac
6d344b4ac0 hints: enhance debug with log_sys_debug 2020-09-15 22:52:25 +02:00
Zdenek Kabelac
187cc8d344 lvcreate: change error message
Provide more useful error message.
2020-09-15 22:52:25 +02:00
Zdenek Kabelac
39198eb2ce lvcreate: add extra synchronization at error path
Put explict udev synchronization before we try to deactive devices.
2020-09-15 22:52:25 +02:00
Zdenek Kabelac
18a60c6340 tests: protect this test for another kernel
Thisi 3.10.0-862 kernel also dies with this test.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
9c0d11ecc9 tests: tune usage of smaller metadata
While the previous commit c9b40083fc
decresed version to 1.19 for using bigger datasets,  it's not
been quite right - so from our bb machine it looks like
bigger metadata consumption started with 1.19 and kernel 4.18
(fc27)
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
1005fd7b06 tests: raise needed target version
Require higher version to avoid early bugs.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
57e1e037b6 tests: improve cache abort test
Use bigger volume and slowdown writing to cache device.
This allows more simple to reach 'dirty' state.
Also document exactly 1 SIGINT has to fire aborting of flushing.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
64c8827cf3 tests: check in_sync prints also dm status
It's more useful to see how the progress of status checking is moving.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
b2978efbff cache: simplier signal handling
Use just single sigint_allow()/restore() within flushing loop
and void one extra signal manipulation.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
c285bf2f37 headers: remove unused headers 2020-09-14 00:15:14 +02:00
Zdenek Kabelac
27383a4b3d configure: just upper case start of sentence 2020-09-14 00:15:14 +02:00
Zdenek Kabelac
2101e324f9 locking: restore blocking signal for VG_GLOBAL lck
During removal of a lot of locking code the signal blocking got lost
and signal processing got broken leading to unpredictable
behavior of i.e. activation code the can get interrupted in the
middle of DM table processing.

lvm2 code always expects signals are blocked while lock is held
unless it is explictelly placed into section of:
sigint_allow();....;sigint_restore();
For checking catched interrupt there is sigint_catched();
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
fe77d1a710 tests: avoid using string
String 'TEST WARNING' may not be present in the test script itself.
Add '\ ' to avoid 'grep' matching test as the test with warning.
2020-09-12 13:24:03 +02:00
Zdenek Kabelac
3008e1be08 tests: support for 16T is needed
Likely 32bit machines can't pass here.
2020-09-12 13:24:03 +02:00
Zdenek Kabelac
17dbb24f7c tests: change skip to die for upstream crash
So the failing test is not lost from sight.
2020-09-12 13:24:03 +02:00
Zdenek Kabelac
7bd015861d tests: skip test on failing kernel 2020-09-12 13:24:03 +02:00
Zdenek Kabelac
a940979ff7 cov: drop checking for EWOULDBLOCK
Reduce cov warning and remove this really ancient define
as lvm2 was never compilable on such platform.
2020-09-12 13:24:03 +02:00
Zdenek Kabelac
740d5bf6cd cov: check sscanf result 2020-09-12 13:24:03 +02:00
Zdenek Kabelac
a5d45b237d cov: drop model for origin_from_cow 2020-09-12 13:23:49 +02:00