summaryrefslogtreecommitdiff
path: root/device_mapper
Commit message (Collapse)AuthorAgeFilesLines
* cov: fix memory leakZdenek Kabelac2019-11-141-1/+3
| | | | | Reapply 23cc7ddc50e2800a6dc248de897a4c88c1514160 to internal version of libdm.
* dm: fix compilation of dmsetupMarian Csontos2019-10-221-1/+1
| | | | | Fix: 889c88e9dab33195efc4dc0400a4b0aaa3383948 Use correct enum DM_DEVICE_GET_TARGET_VERSION.
* vdo: keep minimum_io_size in sectorsZdenek Kabelac2019-10-043-4/+5
|
* dm: introduce DM_GET_TARGET_VERSIONMikulas Patocka2019-10-043-1/+9
| | | | | | | | Adds support for the DM_GET_TARGET_VERSION to dmsetup. It introduces a new comman "target-version" that will accept list of targets and print their version. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
* libdm: implement search for device names for older kernelsZdenek Kabelac2019-08-091-1/+117
| | | | | | | Kernels <2.6.27 don't have /sys/dev dir - add code for looking out device name via longre seach in /sys/block This makes commands like 'dmsetup dep -o blkdevname' working.
* cache: support no_discard_passdownZdenek Kabelac2019-06-052-0/+3
| | | | | | | | | | | | | | | | | Recent kernel version from kernel commit: de7180ff908b2bc0342e832dbdaa9a5f1ecaa33a started to report in cache status line new flag: no_discard_passdown Whenever lvm spots unknown status it reports: Unknown feature in status: So add reconginzing this feature flag and also report this with 'lvs -o+kernel_discards' When no_discard_passdown is found in status 'nopassdown' gets reported for this field (roughly matching what we report for thin-pools).
* metadata: allow reading metadata with invalid creation_timeZdenek Kabelac2019-05-101-3/+15
| | | | | | | | | | | | | | | | lvm2 till version 2.02.169 (commit 78d004efa8a1809cea68283e6204edfa9d7c1091) was printing invalid creation_time argument into metadata on 32bit arch. However with commit ba9820b14223b731125c83dbc9709aa44fdcdbf1 we started to properly validate all input numbers and thus we refused to accept invalid metadata with 'garbage' string - but this results in the situation where metadata produced on older lvm2 on 32 bit architecture will become unreadable after upgrade. To fix this case - extend libdm parser in a way, that whenever we find error integer value, we also check if the parsed value is not for creation_time node and in this case we let the metadata pass through with made-up date 2018-05-24 (release date of 2.02.169).
* dm: ensure migration_threshold is big enoughZdenek Kabelac2019-01-211-3/+17
| | | | | | | | | | | | When using caches with BIG pool size (>TB) there is required to use relatively huge chunk size. Once the chunksize has got over 1MiB - kernel cache target stopped writing such chunks back on this if the migration_threshold remained on default 1MiB (2048 sectors) size. This patch ensure, DM layer will not let pass table line which has not big enough migration threshold that can let pass at least 8 chunks (independently of lvm2 metadata).
* configure: avoid repeative inclusion of configure.hZdenek Kabelac2018-12-212-4/+0
| | | | | | | | | | Since configure.h is a generated header and it's missing traditional ifdefs preambule - it can be included & parsed multiple times. Normally compiler is fine when defines have same value and there is no warning - yet we don't need to parse this several times and by adding -include directive we can ensure every file in the package is rightly compile with configure.h as the first header file.
* lib: move towards v2 version of VDO formatZdenek Kabelac2018-12-205-22/+37
| | | | | | | | | Drop very old original format of VDO target and focus on V2 version. So some variables were renamed or replaced. There is no compatibility preserved (with assumption so far this is experimental feature and there is no real user). Note - version currently VDO calls this version 6.2.
* dmeventd: resolve compilation of vdo status parsingZdenek Kabelac2018-12-201-2/+20
| | | | | | | | | | | | | A bit of chicken & egg problem - dmeventd needs to use old libdm library. VDO is only part of new device_mapper internal library. So include directly source file for parsing status - this fixes usability problem of VDO plugin introduced with previous Makefile reshaping patchset. NOTE: source file needs to be keep then compilable in both environments. Also add missing copyright header.
* makefiles: correcting login of makefileZdenek Kabelac2018-12-171-13/+8
| | | | | | Fixing some ordering issue with inclusion of common make.tmpl. Correcting dependency calculation Simplifying inclusive makefile
* makefiles: sortZdenek Kabelac2018-12-171-3/+3
|
* debug: drop extra tracingZdenek Kabelac2018-12-141-1/+1
| | | | Stack tracing after log_error() is not needed.
* headers: use configure.h as 1st. headerZdenek Kabelac2018-12-143-6/+2
| | | | | | | | | | | Ensure configure.h is always 1st. included header. Maybe we could eventually introduce gcc -include option, but for now this better uses dependency tracking. Also move _REENTRANT and _GNU_SOURCE into configure.h so it doesn't need to be present in various source files. This ensures consistent compilation of headers like stdio.h since it may produce different declaration.
* device_mapper: move internal header to frontZdenek Kabelac2018-12-011-2/+2
|
* device_mapper: optimize dm_pool_strndupZdenek Kabelac2018-12-011-2/+4
|
* device_mapper: fix incorrect dm_strncpy usageZdenek Kabelac2018-12-011-6/+1
| | | | | | Patch 668c9d0762fc6736a1e9372785544eda6a939806 introduced regression, since the code here would actually always return failing result. Replace it with more simple call to strndup().
* makefiles: improving cleaning rulesZdenek Kabelac2018-11-291-5/+10
|
* makefiles: avoid dependency calcs for base dirZdenek Kabelac2018-11-291-1/+1
| | | | | | | For some targets we do not want to generate dependencies. Also add note about usage of such Makefile - it might be possibly better to rename it to different filename to avoid any confusion.
* libdm: add memory barrierZdenek Kabelac2018-11-171-0/+2
| | | | | | | | | Just for case ensure compiler is not able to optimize memset() away for resources that are released. This idea of using memory barrier is taken from openssl. Other options would be to check for 'explicit_bzero' function.
* libdm: print params only for ioctls using themZdenek Kabelac2018-11-171-8/+29
| | | | | | | When preparing ioctl buffer and flatting all parameters, add table parameters only to ioctl that do process them. Note: list of ioctl should be kept in sync with kernel code.
* libdm: add DM_DEVICE_ARM_POLLZdenek Kabelac2018-11-172-2/+7
| | | | Expose DM_DEVICE_ARM_POLL via standard API enum.
* libdm: do not add params for resume and removeZdenek Kabelac2018-11-171-0/+2
| | | | | | | | | | | | | | | | | | | DM_DEVICE_CREATE with table is doing several ioctl operations, however only some of then takes parameters. Since _create_and_load_v4() reused already existing dm task from DM_DEVICE_RELOAD it has also kept passing its table parameters to DM_DEVICE_RESUME ioctl - but this ioctl is supposed to not take any argument and thus there is no wiping of passed data - and since kernel returns buffer and shortens dmi->data_size accordingly, anything past returned data size remained uncleared in zfree() function. This has problem if the user used dm_task_secure_data (i.e. cryptsetup), as in this case binary expact secured data are erased from main memory after use, but they may have been left in place. This patch is also closing the possible hole for error path, which also reuse same dm task structure for DM_DEVICE_REMOVE.
* devicemapper: retry mirror leg deactivationZdenek Kabelac2018-11-121-1/+6
| | | | | | | | | | | | | | | | | | | | This could be seen as continuation of 6cee8f1b063dcf5d809e14de38ba489ce5b8f562. Some test maching with old udev system shows problem, where udev 'jumps on' leg device after mirror target releases its legs - since udev does not (in this old case) skips such device from scanning - it opens device - and this prevent leg device to be deactivated - effectively such device stays 'leaked' in DM table invisibly to lvm2 command. So to 'combat' this issue - if the device has '_mimage' in its name, the retry of deactivation is automatically assumed. NOTE: wider impact is unexpected - as it's touching only old mirror target which is nowadays replaced with 'raid'. In case there will be some problem identified - probably both patches should be reverted.
* devicemapper: retry remove even for subLVsZdenek Kabelac2018-11-081-1/+1
| | | | | | | | | | | | | | With older systems and udevs we don't have control over scanning of lvm2 internal devices - so far we set retry-removal only for top-level LVs, but in occasional cases udev can be 'fast enough' to open device for scanning and prevent removal of such device from DM table. So to combat this case - try to pass 'retry' flag also for removal of internal device so see how many races can go away with this simple patch. Note: patch is applied only to internal version of libdm so the external API remains working in the old way for now.
* Add dm-writecache supportDavid Teigland2018-11-063-0/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dm-writecache is used like dm-cache with a standard LV as the cache. $ lvcreate -n main -L 128M -an foo /dev/loop0 $ lvcreate -n fast -L 32M -an foo /dev/pmem0 $ lvconvert --type writecache --cachepool fast foo/main $ lvs -a foo -o+devices LV VG Attr LSize Origin Devices [fast] foo -wi------- 32.00m /dev/pmem0(0) main foo Cwi------- 128.00m [main_wcorig] main_wcorig(0) [main_wcorig] foo -wi------- 128.00m /dev/loop0(0) $ lvchange -ay foo/main $ dmsetup table foo-main_wcorig: 0 262144 linear 7:0 2048 foo-main: 0 262144 writecache p 253:4 253:3 4096 0 foo-fast: 0 65536 linear 259:0 2048 $ lvchange -an foo/main $ lvconvert --splitcache foo/main $ lvs -a foo -o+devices LV VG Attr LSize Devices fast foo -wi------- 32.00m /dev/pmem0(0) main foo -wi------- 128.00m /dev/loop0(0)
* Allow dm-cache cache device to be standard LVDavid Teigland2018-11-062-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a single, standard LV is specified as the cache, use it directly instead of converting it into a cache-pool object with two separate LVs (for data and metadata). With a single LV as the cache, lvm will use blocks at the beginning for metadata, and the rest for data. Separate dm linear devices are set up to point at the metadata and data areas of the LV. These dm devs are given to the dm-cache target to use. The single LV cache cannot be resized without recreating it. If the --poolmetadata option is used to specify an LV for metadata, then a cache pool will be created (with separate LVs for data and metadata.) Usage: $ lvcreate -n main -L 128M vg /dev/loop0 $ lvcreate -n fast -L 64M vg /dev/loop1 $ lvs -a vg LV VG Attr LSize Type Devices main vg -wi-a----- 128.00m linear /dev/loop0(0) fast vg -wi-a----- 64.00m linear /dev/loop1(0) $ lvconvert --type cache --cachepool fast vg/main $ lvs -a vg LV VG Attr LSize Origin Pool Type Devices [fast] vg Cwi---C--- 64.00m linear /dev/loop1(0) main vg Cwi---C--- 128.00m [main_corig] [fast] cache main_corig(0) [main_corig] vg owi---C--- 128.00m linear /dev/loop0(0) $ lvchange -ay vg/main $ dmsetup ls vg-fast_cdata (253:4) vg-fast_cmeta (253:5) vg-main_corig (253:6) vg-main (253:24) vg-fast (253:3) $ dmsetup table vg-fast_cdata: 0 98304 linear 253:3 32768 vg-fast_cmeta: 0 32768 linear 253:3 0 vg-main_corig: 0 262144 linear 7:0 2048 vg-main: 0 262144 cache 253:5 253:4 253:6 128 2 metadata2 writethrough mq 0 vg-fast: 0 131072 linear 7:1 2048 $ lvchange -an vg/min $ lvconvert --splitcache vg/main $ lvs -a vg LV VG Attr LSize Type Devices fast vg -wi------- 64.00m linear /dev/loop1(0) main vg -wi------- 128.00m linear /dev/loop0(0)
* cache: clean up segment line creationDavid Teigland2018-11-061-9/+13
|
* cleanup: move cast to det_t into MKDEV macroZdenek Kabelac2018-11-054-8/+8
|
* cov: mark warning as expected oneZdenek Kabelac2018-11-031-0/+2
|
* cov: drop uneeded header filesZdenek Kabelac2018-10-151-1/+0
|
* cov: ignore error of vsnprintfZdenek Kabelac2018-10-151-1/+1
|
* cov: check dm_strncpy resultZdenek Kabelac2018-10-151-1/+5
|
* cov: ensure vars are setZdenek Kabelac2018-10-151-1/+1
| | | | | Make sure, tmp_begin and tmp_end are always set, even for blind coverity.
* cov: dm node message fix missing initilizationZdenek Kabelac2018-10-151-1/+1
| | | | | In 2 teoretical error path the 'r' value has not been set to proper value before possible use in error path.
* cov: fix typoZdenek Kabelac2018-10-151-1/+1
| | | | Avoid double assing same value.
* cov: index off by oneZdenek Kabelac2018-10-151-1/+1
| | | | Basically apply stable patch fdb6ef8a85e9adc4805202b3200b17bd3b351982 to internal libdm version.
* device_mapper: basic support for vdo dm targetZdenek Kabelac2018-07-095-1/+335
|
* lib: new vdo segment configurable optionsZdenek Kabelac2018-07-091-0/+60
| | | | | Configurable for vdo segment with their default values. Also specify their ranges with minimal and maximal values.
* build: add vdo configuration option --with-vdo=Zdenek Kabelac2018-07-091-0/+3
| | | | | | | | | | | | | Checks whether VDO support is enabled. Detects presence of 'vdoformat' tool which is required for to format VDO pool. ATM build of VDO is NOT automatically enabled (None is default). To enable build of LVM with VDO support use: configure --with-vdo=internal TODO: Maybe future version may switch to link some small VDO library for formating (would require linking and package dependency).
* device_mapper: convert vdo to use dm_ prefixZdenek Kabelac2018-07-092-48/+49
| | | | Keep using DM_/dm_ prefixes for device_mapper code.
* vdo: fix parsing vdo statusZdenek Kabelac2018-07-091-2/+2
| | | | | Recent updates relay on zerod status structure memory (device ptr is NULL) and also dm_strncpy need to count with '\0'.
* vdo: enhance status parserZdenek Kabelac2018-07-022-104/+96
| | | | | | Add support for using mempool for allocations inside status parser. Convert some string pointers to arrays. Reindent tabs.
* device_mapper: relocate code for sending messagesZdenek Kabelac2018-07-021-11/+11
| | | | | To be able to send messages for recently resumed devices, move code into inner loop.
* device_mapper: deactive new nodes when load failsZdenek Kabelac2018-07-021-2/+8
| | | | | | | | | | | | When node loading fails, there is not much the caller can do, since there is 'unknown' set of devices preloaded. Only suspend during preload knows future precommitted 'metadata', so it's non-trivial to drop 'preloaded' entries with any later call. However dm tree tracks newly loaded entries - so in this case it may simplify the recovery path by dropping preloaded entries so they are not leaked in the DM table.
* build: avoid rebuild deps for top-level makefilesZdenek Kabelac2018-07-021-1/+6
|
* device_mapper: add new _dm_task_create_device_statusZdenek Kabelac2018-06-251-9/+23
| | | | | Introduce new function _dm_task_create_device_status for grabbing status of device for better code sharing.
* device_mapper: split code for sending messageZdenek Kabelac2018-06-251-26/+37
| | | | | Move message sending from _thin_pool_node_message to new _node_message for possible better code sharing.
* device_mapper: split _node_send_messageZdenek Kabelac2018-06-251-23/+33
| | | | | | | | For better code reuse split _node_send_messages into commont messaging part and separate _thin_pool_node_send_messages. Patch makes it possible to better reuse common code for messaging other targets.