summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* locking: use lock file timestamps to detect vg changesdev-dct-lockfileDavid Teigland2019-11-208-57/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A reporting command that is run concurrently with another command modifying a VG may report either the old or new VG state. This flexibility means the reporting command could be optimized to report metadata that was read prior to taking the VG lock. Using lock file timestamps, that window can be closed so that metadata reported is always consistent with the held VG lock. In some cases, this additional consistency will avoid warnings that could be produced when the command compares the metadata with the dm kernel state. The end result is that the optimization is used (to read disks only once) and the reported metadata is consistent with the dm kernel state, even if a concurrent command is making changes. A reporting command will now save the VG lock file timestamps prior to scanning disks. The VG metadata that is read while scanning disks is saved in memory. After the scan, when reporting each VG, the command will lock the VG, and then check the lock file timestamp again. If the timestamp is unchanged, then the metadata saved from the scan is unchanged and is reused to report the VG. If the timestamp has changed, then another command has modified the metadata since the scan, and the metadata is reread from disk prior to reporting it. Changes to lock file handling to support this: - lock files are no longer unlinked and recreated by every lvm command, but are left in place. - a command modifying a VG (holding an exclusive flock) will update the lock file timestamp before unlocking it.
* lvs: disable scanning optimizationDavid Teigland2019-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* tests: add more tracing infoZdenek Kabelac2019-11-151-0/+2
|
* tests: reduce amount of written dateZdenek Kabelac2019-11-151-1/+1
| | | | Since we reduced created LV to 4M - dd also just 4M.
* revert "dmeventd: vdo plugin link lvm library"Zdenek Kabelac2019-11-151-0/+8
| | | | | | This reverts commit cbabdf2fca6131660cfb5525ed9edb3f7a41525a. and add extra comment why this code may look unused, but in runtime is necessary.
* Revert "hints: rewrite function"David Teigland2019-11-141-13/+26
| | | | This reverts commit 70fb31b5d6863248b5adfb2581b706cbb158b30e.
* Revert "debug: enhance debug messages"David Teigland2019-11-141-22/+20
| | | | This reverts commit e92d3bd1f75d335fba5303c433516ea4ebe5cab1.
* tests: enusure lib is initilizedZdenek Kabelac2019-11-141-1/+1
|
* debug: enhance debug messagesZdenek Kabelac2019-11-141-20/+22
|
* hints: drop unneeded memsetZdenek Kabelac2019-11-141-1/+0
| | | | strncpy will zero buffer itself.
* hints: no need to check for NULL before freeZdenek Kabelac2019-11-141-12/+6
| | | | free() itself checks for NULL.
* cov: use zallocZdenek Kabelac2019-11-141-6/+3
| | | | Instead of malloc() memset() -> zalloc()
* cov: add explicit ret value ignoringZdenek Kabelac2019-11-141-2/+2
| | | | We don't need to check for any error result codes here.
* cov: remove unused headersZdenek Kabelac2019-11-143-4/+0
|
* cov: more checks for failing syscallsZdenek Kabelac2019-11-142-2/+4
|
* dmeventd: vdo plugin link lvm libraryZdenek Kabelac2019-11-141-3/+0
| | | | | | | 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.
* cov: inline _build_desc_writeZdenek Kabelac2019-11-141-25/+6
| | | | | | Embed function into the code, since the function is actually simpler written this as there are no memleak troubles with failing allocation error path.
* hints: check for _touch_hintsZdenek Kabelac2019-11-141-2/+3
| | | | Exit when !_touch_hints().
* hints: fix mem leaking buffersZdenek Kabelac2019-11-141-0/+5
|
* hints: validate allocation resultZdenek Kabelac2019-11-141-2/+4
|
* hints: validate sscanf resultsZdenek Kabelac2019-11-141-5/+8
|
* hints: allocate hint only when neededZdenek Kabelac2019-11-141-12/+18
| | | | | | | 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.
* hints: rewrite functionZdenek Kabelac2019-11-141-26/+13
|
* pvck: check result of dev_get_sizeZdenek Kabelac2019-11-141-1/+2
| | | | Don't use garbage value for later computations.
* cov: fix mem leaking bufferZdenek Kabelac2019-11-141-14/+22
| | | | | Free allocated buffer on function's exit. Also check for fwrite() results.
* cov: avoid passing NULL to strstr functionZdenek Kabelac2019-11-141-5/+5
| | | | When 'str1' would be NULL, there is no point to run 2nd. strstr().
* cov: check for retvalueZdenek Kabelac2019-11-141-1/+4
|
* cov: fix memleak for duplicate deviceZdenek Kabelac2019-11-141-14/+15
| | | | | | 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.
* cov: check for NULLZdenek Kabelac2019-11-144-7/+6
| | | | | | | | | | | 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).
* devtype: simplify codeZdenek Kabelac2019-11-141-26/+13
| | | | Update code with simpler form and check for fclose().
* cov: fix memory leakZdenek Kabelac2019-11-141-1/+3
| | | | | Reapply 23cc7ddc50e2800a6dc248de897a4c88c1514160 to internal version of libdm.
* fix dev_unset_last_byte after write errorHeming Zhao2019-11-133-8/+4
| | | | | | | | | | | | | | | | | | | 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>
* WHATS_NEW: updateZdenek Kabelac2019-11-111-0/+1
|
* tests: add test of resize of different segtypesZdenek Kabelac2019-11-111-1/+12
|
* lvextend: fix resizing volumes of different segtypeZdenek Kabelac2019-11-111-0/+2
| | | | | | | | | | | | | | | | | | When resizing 2 volumes like thin-pool and it's metadata and they would be of a different type - command would be actually expecting both LVs being of a same segtype - and would throw an error in case they are different. This patch fixes is by setting a new segtype from last segment of 2nd. extented device. Also it fixes the possible 'percentage' extension setup that might have been used for 'primary' volume - while the 'secondary' LV always goes with direct size - as we do not support 'percentage' setup for them This affects maily usage of thin-pool where the extension of thin-pool data size may also lead to extension of metadata size.
* tests: add extra settleZdenek Kabelac2019-11-111-0/+4
| | | | | To avoid removing, while 'add' might not have been processed yet. (when emulating reboot in pvmove-restart)
* tests: skip unneeded status checkZdenek Kabelac2019-11-111-6/+5
| | | | If 'remove' was succesful - we can break loop immediatelly.
* daemons: check for non-zero thread_idZdenek Kabelac2019-11-111-1/+2
| | | | Do not call pthread_join if thread_id would be 0.
* daemon: better error path handling for shutdownZdenek Kabelac2019-11-111-7/+16
| | | | | Report errors for open in better order. Ensure descriptors are not leaked.
* cov: ensure read_ahead is availableZdenek Kabelac2019-11-111-1/+1
| | | | Make sure read_ahead pointer is not NULL when quering for RA.
* cov: missing checks of syscallsZdenek Kabelac2019-11-111-3/+6
| | | | Check for sigprocmask errors
* gcc: avoid declaration shadowingZdenek Kabelac2019-11-111-3/+3
| | | | dev_name is global in device.h
* man: adjust 'disks' to 'devices' as used throughoutHeinz Mauelshagen2019-11-071-4/+4
|
* test: Fix metadata-zero-space with long VG namesMarian Csontos2019-11-061-4/+6
|
* tests: be happy with less then 90 percentZdenek Kabelac2019-11-011-1/+4
| | | | | | Thin metadata evolve between kernel version, so it's not always precisely predictible its usage - so let's met test happy, when it gets bellow 90%.
* tests: skip test if scsi_debug is not availableZdenek Kabelac2019-11-011-1/+1
|
* tests: slowdown delay of raidZdenek Kabelac2019-11-011-1/+1
| | | | Slowdown 'delay' more.
* tests: conversion only of exclusive lvZdenek Kabelac2019-11-011-1/+1
| | | | We can 'cache' only exclusively active LV in cluster.
* tests: avoid checking command result in clusterZdenek Kabelac2019-11-011-4/+10
| | | | | | | | | | | | When running cluster test with clvmd, the actual 'monitoring' happens in cluster - so the 'already monitored' message is also logged within clvmd code and the command cannot see such effect. clvmd was incapable to report this information back to command so it cannot be displayed this way. Add 'lvs -o+seg_monitor' validation which also works in clustered mode.
* WHATS_NEW: updateZdenek Kabelac2019-10-311-0/+1
|