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

14565 Commits

Author SHA1 Message Date
Zdenek Kabelac
0d0a3397c2 cleanup: add braces in macro 2017-07-20 11:18:29 +02:00
Zdenek Kabelac
b37e4e3f90 cleanup: constify used parameter 2017-07-20 11:18:29 +02:00
Zdenek Kabelac
e769e3d3bf dmsetup: simplify check of parsed cookie value
Improving parsing error detection for strtoul.
2017-07-20 11:18:16 +02:00
Zdenek Kabelac
86d7adc2a5 tests: aux.sh fix wait_pvmove_lv_ready
Ignore error if the 'queried' LV is still not available
(since 'get' now properly returns failure when LV is missing)
2017-07-19 12:15:39 +02:00
Zdenek Kabelac
43dbfee32a tests: aus.sh better defaults 2017-07-18 21:25:03 +02:00
Zdenek Kabelac
466da710e0 tests: avoid endless loops
If there is some problem with device removal avoid generating very long
error logs...
2017-07-18 21:17:51 +02:00
Zdenek Kabelac
9599645bb6 tests: aux.sh limit device
During test do a more close selection of visible devices.
If some test leaks a device with LVMTEST prefix, next
test should not be influnced (or parallel running one).

If the test is running in non-/dev  dir - it's already protected
by full path with $PREFIX in it - however it test is running
in real /dev dir - there was no such protection and test
were confused when they have seen such leaked device.
2017-07-18 13:14:02 +02:00
Zdenek Kabelac
4fa739faf2 lvmcmdline: enhance locales check
Make check for 'radixchar' more readable and logical.
Also avoid reread of number of locale is already using '.' as radixchar.
2017-07-17 21:25:50 +02:00
Zdenek Kabelac
864017710c lvmcmdline: restore digit check
Commit 9b4b5d449e started to accept
rather way to wide set of strings we do not want to take for size.
i.e.  lvresize -t vg0/lvol0 -LNaNM

Restore check for 'digit ||  locales defined 'dot' |  '.'
(as we tend to take '.' even if locales uses ',')
2017-07-17 20:54:42 +02:00
Zdenek Kabelac
fde23f7ce1 tests: better support for unbound vars for older shell 2017-07-17 20:32:48 +02:00
Zdenek Kabelac
5a5553bcec tests: aux.sh some backward compatible updates
Older bash does not take empty array as bounded variable
(except for $@)
2017-07-17 15:01:44 +02:00
Zdenek Kabelac
3c32883cec test: repeat rediscovery few times
Avoid using 'aux' shell when setting dmsetup cookie.
Do not user '--force' when using external cookie.
2017-07-17 13:38:31 +02:00
Zdenek Kabelac
f293d46946 tests: aux.sh correcting bounder values
grep for defined PREFIX.
use 'dev' instead of undefined mddev.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
84b56872fb tests: aux.sh also uses increseed hardening protection
Also use similar incresed hardeing of script correctness
for standalone aux scripts - so there is one common
logic for pipe failures.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
bd2a0fe2ec tests: utils.sh look for more coredump places
Quoting helps to anyone storing coredumps inside dir with spaces....
Also add default dir for coredumps with systemd coredumpctl.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
d15b9ac510 tests: extend lvcreate size validation 2017-07-17 12:33:42 +02:00
Zdenek Kabelac
567aa60fa1 lvmetad: cleanup
Avoid hashing insertion when object with same content is already there.
2017-07-17 12:33:17 +02:00
Zdenek Kabelac
767a5e1281 dev-cache: avoid hashing same data again
Before hashing device again with path, check if it's not already hashed.

TODO: maybe bigger chunk of executed code might be actually skipped.
2017-07-17 12:33:17 +02:00
Zdenek Kabelac
9b4b5d449e lvmcmdline: enhance acceptance of size numbers
Explictely detect duplicate sing symbols and leave the rest of
double number validation on 'strtod()' function. This way
we can also accept size like:

lvcreate -L.1M

We already accept -L0.1M - but it's common to accept numbers
starting with leading '.' - just as 'strtod()' accepts it).
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
f7e62bc55c cleanup: drop extra compare
dm_free() already validates for NULL itself.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
55f9e2f399 cleanup: shorten dump output code
Save couple lines on code with simpler code.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
f6c2ee57fa cleanup: drop const from allocated value
Avoid using const for casting to non-const.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
ba9820b142 numbers: strtod or strtoul need reset of errno
API for strtod() or strtoul() needs reset of errno, before it's being
called. So add missing resets in missing places and some also some
errno validation for out-of-range numbers.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
94838b4df0 lvmcmdline: validate size as double
Since we are reading size as (double) we can get way bigger
number then just plain int64. So to make this check actually
more valid and usable do a maxsize compare in 'double'.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
28e319ddc0 clvmd: fix valgrind memory report
Avoid reading already released memory and do a continue directly.

Invalid read of size 1
   at 0x1201B0: main_loop (clvmd.c:931)
   by 0x11F640: main (clvmd.c:666)
 Address 0x72ddef0 is 32 bytes inside a block of size 224 free'd
   at 0x4C30D18: free (vg_replace_malloc.c:530)
   by 0x54D6FD1: dm_free_wrapper (dbg_malloc.c:357)
   by 0x122E6E: process_work_item (clvmd.c:2034)
   by 0x123003: lvm_thread_fn (clvmd.c:2085)
   by 0x590A3A8: start_thread (pthread_create.c:465)
   by 0x5C3C7FE: clone (in /usr/lib64/libc-2.25.90.so)
 Block was alloc'd at
   at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
   by 0x54D6EF1: dm_malloc_aux (dbg_malloc.c:286)
   by 0x54D6F1C: dm_zalloc_aux (dbg_malloc.c:291)
   by 0x54D6F96: dm_zalloc_wrapper (dbg_malloc.c:345)
   by 0x11F89C: local_rendezvous_callback (clvmd.c:731)
   by 0x1203D2: main_loop (clvmd.c:964)
   by 0x11F640: main (clvmd.c:666)
2017-07-17 12:30:01 +02:00
Zdenek Kabelac
d7f92ea8ee clvmd: fix valgrind warning
Initialize mutex upfront any debugging and fix this report:

Mutex reinitialization: mutex 0x485d20, recursion count 0, owner 1.
   at 0x4C38480: pthread_mutex_init_intercept (drd_pthread_intercepts.c:821)
   by 0x4C38480: pthread_mutex_init (drd_pthread_intercepts.c:830)
   by 0x11F359: main (clvmd.c:562)
mutex 0x485d20 was first observed at:
   at 0x4C38F63: pthread_mutex_lock_intercept (drd_pthread_intercepts.c:885)
   by 0x4C38F63: pthread_mutex_lock (drd_pthread_intercepts.c:898)
   by 0x11E920: debuglog (clvmd.c:254)
   by 0x11F1D8: main (clvmd.c:527)
2017-07-17 12:29:57 +02:00
Zdenek Kabelac
ea96a9d68e devcache: correct logging severity for connection
Switch from warn to log_error since this generated
failing return code for command so printing log_error()
is mandatory.

Happens with i.e. pvscan --cache meets crashing lvmetad.
2017-07-17 12:28:51 +02:00
Zdenek Kabelac
919fa89482 lvmetad: fix memory leaks
Hash tables need to release no longer needed inserted data.
2017-07-17 12:27:53 +02:00
Heinz Mauelshagen
fb641c3423 raid: add validation checks for segment data_offset member
Commit 34504855a7 introduced
flag LV_RESHAPE_DATA_OFFSET and used it to avoid incompatible
activation on older runtime.

Enhance vg_validate() raid checking functions with checks for it.
2017-07-15 00:51:43 +02:00
Zdenek Kabelac
c64e2a85cb tests: use get_devs 2017-07-15 00:13:33 +02:00
Zdenek Kabelac
413209f3f8 tests: utils.sh looks for more dumps
Check for core in  sysctl kernel.core_pattern
(assuming core prefix still)
2017-07-15 00:12:07 +02:00
Zdenek Kabelac
2154f30a99 tests: add udev_wait before tearing scsi_debug
Make less probably there will be some udev work going while we try
to remove scsi_debug target.
2017-07-14 20:30:04 +02:00
Zdenek Kabelac
ac0945bc4a tests: aux.sh fix double quote
Patch 72a58ce4b0 was wronly placing
double quotes around this variable which we want to pass expanded,
as it's just set of 'space' device args ATM.

TODO consider using array[@] to make this cleaner.
Add shellcheck directive to skip warning here
2017-07-14 20:29:38 +02:00
Marian Csontos
1c95cf8c6f tests: utils.sh six stacktrace
Changes:

- BASH_SOURCE index was one off.
- The first line of stacktrace was pure confusion displaying executed
  script together with innermost line number (which was either 125 when
  STACKTRACE or 229 when skip was called.)
- We can safely ignore innermost call, as stack trace is always produced
  by stacktrace function.
- It is safer to test for array length, instead of testing FUNCNAME is
  main - if main function were introduced.
- Bashishm is safe to use as this function as a whole is relying on bash.
2017-07-14 20:18:42 +02:00
Heinz Mauelshagen
34504855a7 raid: add data_offset incompatibility segment type flag
In order to reject out of place reshaping with segment data_offset
field on old runtime, add a respective segment type incompatibility
flag causing "+RESHAPE_DATA_OFFSET" to be suffixed to the segment
type name.
2017-07-14 15:53:23 +02:00
Heinz Mauelshagen
1d69fc7c5e raid: use return_0 for better backtracking 2017-07-14 15:53:23 +02:00
Heinz Mauelshagen
1c4b7a3c2d report: fix data_offset/new_data_offset reporting 2017-07-14 15:53:23 +02:00
Heinz Mauelshagen
6685460f5a lvconvert: allow reshaping in the cluster and on open devices
The previous commit fixed allocation/activation of reshape space.

Remove conditionals prohibiting reshaping in these cases.

Related: rhbz1447812
Related: rhbz1448116
Related: rhbz1461562
2017-07-14 15:53:23 +02:00
Heinz Mauelshagen
f1b78665ef raid: fix allocation/activation of reshape space
When reshape space is allocated anew, an update and reload is needed to
promote the new size to the cluster node with the exclusively active RaidLV
or reloading the RaidLV will fail with a size related error.  Additionally,
store "data_offset <sectors>" with the RaidLV in the lvm2 metadata so that
it can be retrieved on cluster nodes.

Process allocation of reshape space on a 2-legged raid4/5 (interim layout
to convert from/to linear via raid1) properly in the cluster.

Resolves: rhbz1461562
Resolves: rhbz1448116
2017-07-14 15:53:23 +02:00
Zdenek Kabelac
cd4e6c9b17 tests: aux.sh integrate both teardown loops
Use 1 logic for 2 loops tearing down left device.
First loops tries to remove all closed devices with 'normal' remove.
Second loop tries to replace those left devices with 'error' target.
2017-07-14 13:22:15 +02:00
Zdenek Kabelac
8a2448a4ed tests: skip test for non dirty cache
Seems some cache LV can't be made dirty easily with older
cache policy implementations....
2017-07-14 00:42:40 +02:00
Zdenek Kabelac
e682af7878 tests: aux.sh better teardown loop
We can't really sleep that much in teardown as it slows test too much.
So do a nested loop (similar to 'dmsetup remove_all') and keep
removing devices with open count == 0 as long as it works.
2017-07-14 00:27:55 +02:00
Zdenek Kabelac
f64f6c5e70 tests: wait for udev to minize race windows
mkfs can complain about volume in use when meets udev rule processing.
2017-07-13 21:11:16 +02:00
Zdenek Kabelac
870c7bc76c tests: bound variables 2017-07-13 21:11:16 +02:00
Zdenek Kabelac
e88534b680 tests: delay read of cache pool data
It's better to delay read of cached data.
Limit loop checking for cleaner policy.
2017-07-13 21:11:16 +02:00
Zdenek Kabelac
490e6e9ef1 tests: add some delay after dmsetup
When we want to squash as much device as possible,
it's better to give it some delay, so devices have
some time to release it's resouces for next removal.

Also drop surrounding cookie processing and let each
dmsetup call run on its own.
2017-07-13 21:11:16 +02:00
Alasdair G Kergon
5027c3c7ee format_text: Extend FIXME to reduce label scans
It's unnecessarily scanning all invalid labels even when nothing changed
instead of first just scanning the ones under the lock.
2017-07-13 17:05:49 +01:00
Alasdair G Kergon
c2de4b9747 docs: Refresh kernel target docs 2017-07-12 18:59:52 +01:00
Zdenek Kabelac
c838e79cd2 tests: fix for new hardened bash
Add missing get_devs.
When $7 is not given use empty string.
See if we can live with less RAM disk for PVs.
Drop limitation on single core as presence 1.12 should address this.
2017-07-12 18:05:56 +02:00
David Teigland
e329da173f pvs: use dummy structs in duplicate processing
Use the same dummy struct approach from report.c
when a pv needs to be processed without a real vg.
2017-07-12 10:51:54 -05:00