summaryrefslogtreecommitdiff
path: root/device_mapper
Commit message (Collapse)AuthorAgeFilesLines
* cov: avoid using strcpyZdenek Kabelac2023-02-171-16/+25
| | | | | | | Coverity is complaining about unchecked strcpy here, which is irelevant as we preallocate buffer to fit in copied string, however we could actually reuse these size and use just memcpy(). So lets make some simple conversions.
* libdm: improve parallel create of control nodeZdenek Kabelac2023-02-131-2/+7
| | | | | | | | | | | When two parallel commands would have tried to create our /dev/mapper/control node at the same time, one of them could actually fail even if the 2nd. command actually mknod() this control node correctly. So for EEXIST case add detection if the control node is ok. This may possibly help with some race case in early boot.
* device_mapper: reactivate siblings for snapshotZdenek Kabelac2023-02-011-0/+89
| | | | | | | | | When activating origin and its thick snapshots, ensure the origin's LV udev processing is finished first and after this reactivate its snapshot so the udev can scan them afterwards. This should fix the problems for users using UUID of such device in their fstab and occasionaly mounted snapshot instead of origin LV.
* device_mapper: reduce unnecessary looping passedZdenek Kabelac2023-02-011-3/+9
| | | | | While looping through the list of nodes, check if there is higher priority present and another iteration is still needed.
* libdm: correcting ifdef possitionZdenek Kabelac2023-01-161-1/+3
| | | | Fix building without ioctl support.
* vdo: fix reader error pathZdenek Kabelac2022-12-201-1/+1
| | | | Nothing to be closed on this error path.
* writecache: support settings metadata_only and pause_writebackDavid Teigland2022-12-082-1/+17
| | | | Two new settings for tuning dm-writecache.
* vdo: improve validation messageZdenek Kabelac2022-11-081-3/+3
| | | | Rephrase.
* vdo: enhance detection of virtual sizeZdenek Kabelac2022-11-081-13/+31
| | | | | | | | | | Improve detection of VDO virtual size - so it's not reading VDO metadata when VDO device is already active and instead we reuse existing table line for knowing existing metadata size. NOTE: if there is ever going to be added support for reduction of VDO virtual size - this method will need to be reworked to allow size difference only within 'extent_size' alignment.
* vdo: replace errors with debugZdenek Kabelac2022-11-081-16/+16
| | | | | | As we actully use reading of VDO metadata only as extra 'information' source, and not error command - switch to 'log_debug()' severity with messages out of parser code.
* device_mapper: vdo V4 avoid messagingZdenek Kabelac2022-11-021-3/+7
| | | | | | With V4 format build table line with compression and deduplication and skip sending any messages to set up these parameters.
* device_mapper: add parser for vdo metadataZdenek Kabelac2022-11-024-1/+298
| | | | | | | | | Add very simplistic parser of vdo metadata to be able to obtain logical_blocks stored within vdo metadata - as lvm2 may submit smaller value due to internal aligment rules. To avoid creation of mismatching table line - use this number instead the one provided by lvm2.
* libdm: report: fix escaping of JSON quote char in reported fieldsPeter Rajnoha2022-08-241-8/+3
| | | | | | | | | | | | | | | | | | Commit 73ec3c954b21522352b6f5cce9a700d6bf30ccf4 added a way to print only a part of the report string (repstr) to support decoding individual string list items out of repstr. The repstr is normally printed through _safe_repstr_output so that any JSON_QUOTE character ('"') found within the repstr is escaped to not interfere with value quoting in JSON format. However, the commit 73ec3c954b21522352b6f5cce9a700d6bf30ccf4 missed checking the 'len' argument passed to _safe_repstr_output function when adding the rest of the repstr after all previous JSON_QUOTE characters were escaped (when calling the last dm_pool_grow_object). When 'len' is 0, we need to calculate the 'len' ourselves in the function by simply calling strlen. This is because 'len' is passed to the function only if we're taking a part of repstr, not as a whole.
* libdm: report: use proper JSON array for string list output in JSON_STD formatPeter Rajnoha2022-08-111-4/+84
| | | | | | | | | | In JSON format, we print string list this way: "key" = "item1,item2,...,itemN" while in JSON_STD format, we print string list this way: "key" = ["item1","item2",...,"itemN"]
* libdm: report: separate basic and JSON+JSON_STD format in _output_fieldPeter Rajnoha2022-08-111-71/+94
| | | | | Use separate functions to handle basic and JSON+JSON_STD format. It's clearer this way than interleaving both in the same function.
* libdm: report: enhance the way string list is stored internallyPeter Rajnoha2022-08-111-116/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we stored only the report string itself for a string list in field->report_string. The field->report_string has either sorted items or not, depending on what we need for a field - some report fields have sorted output, some don't... The field->sort_value.value then contains pointer to the exact field->report_string. The field->sort_value.items ALWAYS keeps sorted array of individual items, represented as '[position,length]' pairs pointing to the field->sort_value.value string. This approach was fine as far as we didn't need to apply further formatting to field->report_string. However, if we need to apply further formatting to field->report_string content, taking into account individual items, we also need to know where each item starts and what is its length. Before, we only knew this when items in report string were sorted, but not in the unsorted version. We can't rely on the delimiter (default ",") only to separate items back out of report string, because that delimiter can be contained in the item value itself. So this patch enhances the field->report_string for a string list so it also contains '[position,length]' pairs for each individual item inside field->report_string. We store this array right beyond the string itself and we encode it in the same manner we already did for field->sort_value.items before. If field->report_string has sorted items, the field->sort_value.items just points to the array of items we store beyond the report string. If field->report_string has unsorted items, we store separate array of items for both field->report_string and field->sort_value. This patch also cleans up the _report_field_string_list function a bit so it's easier and more straightforward to follow than the original version. Example. If we have "abc", "xy", "defgh" as list on input with "," as delimiter, then: - field->report_string will have: - if we need field->report_string unsorted: abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - if we need field->report_string sorted: repstr_extra | V abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - field->sort_value will have: - if field->report_string is unsorted: field->sort_value.value = field->report_string field->sort_value.items = {[0,3],[0,3],[7,5],[4,2]} (that is 'abc,defgh,xy') - if field->report_string is sorted already: field->sort_value.value = field->report_string field->sort_value.items = repstr_extra (that is also 'abc,defgh,xy')
* libdm: report: use 'null' for undefined numeric values in JSON_STD outputPeter Rajnoha2022-08-111-1/+7
| | | | | | | | | | | | | | | For JSON_STD format, use 'null' if a field has no value at all. In JSON format, we print undefined numeric values this way: "key" = "" while in JSON_STD format, we print undefined numeric values this way: "key" = null (Keep in mind that 'null' is different from 0 (zero value) which is a defined value.)
* libdm: report: remove double quotes around numeric values in JSON_STD outputPeter Rajnoha2022-08-111-7/+20
| | | | | | | | | | | | In JSON format, we print numeric values this way: "key" = "N" while in JSON_STD format, we print numeric value this way: "key" = N (Where N is a numeric value.)
* libdm: report: add DM_REPORT_GROUP_JSON_STD groupPeter Rajnoha2022-08-112-3/+13
| | | | | | | The original JSON formatting will be still available using the original DM_REPORT_GROUP_JSON identifier. Subsequent patches will add enhancements to JSON formatting code so that it adheres more to JSON standard - this will be identified by new DM_REPORT_GROUP_JSON_STD identifier.
* vdo: support v4 kernel target lineZdenek Kabelac2022-07-112-12/+26
| | | | Check and use new available table line v4, if kernel supports it.
* vdo: report supported range in error pathZdenek Kabelac2022-07-111-18/+45
|
* vdo: use defines also for configuration definesZdenek Kabelac2022-07-112-31/+35
| | | | | | | | | | | | | Keep single source for most of values printed in lvm.conf (still needs some conversion) Correct max for logical threads to 60 (we may refuse some older configuration which might eventually user higher numbers - but so far let's assume no user have ever set this as it's been non-trivial and if would complicate code unnecessarily.) Accept maximum of 4PiB for virtual size of VDO LV (lvm2 will drop 'header borders to 0 for this case').
* vdo: use single validatorZdenek Kabelac2022-07-111-1/+8
| | | | | Add era lenght validation into dm_vdo_validate_target_params() and reuse this validator also for _check_lv_segment().
* vdo: support --vdosettingsZdenek Kabelac2022-05-031-2/+4
| | | | | | | | Allow to use --vdosettings with lvcreate,lvconvert,lvchange. Support settings currenly only configurable via lvm.conf. With lvchange we require inactivate LV for changes to be applied. Settings block_map_era_length has supported alias block_map_period.
* devicemapper: add dm_task_get_device_listZdenek Kabelac2021-12-202-0/+157
| | | | | | | | | | | | | | | | New API extension (internal ATM) for getting a list of active DM device with extra features like i.e. uuid. To easily lookout for existing UUID in device list, there is: dm_device_list_find_by_uuid() Once the returned structure is no longer usable call: dm_device_list_destroy() Struct dm_active_device {} holds all the info, but is always allocated and destroyed within library. TODO: once it's stable, copy to libdm
* libdm: unmangling UUID for DM_DEVICE_LISTZdenek Kabelac2021-12-201-8/+44
| | | | | Properly unmangle UUID if they are provided as result of DM_DEVICE_LIST ioctl on newer linux kernels.
* libdm: correct version checkZdenek Kabelac2021-12-201-4/+2
| | | | | If there ever would be API version 5, these check would give incorrect results.
* make: replace legacy use rindex with strrchrZdenek Kabelac2021-09-271-1/+1
| | | | | | Seems already dropped by some systems. Reported-by: adamboardman of gemian
* devicemapper: in sync with libdmZdenek Kabelac2021-09-235-4/+31
|
* devicemapper: add DM_NAME_LIST_FLAGZdenek Kabelac2021-09-231-0/+14
| | | | Match libdm part
* gcc: match typesZdenek Kabelac2021-09-221-1/+2
|
* gcc: use more zero length arraysZdenek Kabelac2021-09-222-5/+5
| | | | Define last array struct member with zero size.
* cov: hide false positive warningZdenek Kabelac2021-09-131-0/+2
| | | | | | Here we have valid use case of strncpy() which just need to fill precise buffer size - so no explicit \0 on buffer end is needed.
* cov: add some initializersZdenek Kabelac2021-09-131-4/+4
|
* libdm: enhance tracking of activated LVsZdenek Kabelac2021-09-131-29/+21
| | | | | | Existing mechanism was not able to trace root volume issue. Simplify the functionality by using simply using activated flag and trace the dtree in reverse order.
* cache: fix parentheses for migration_thresholdZdenek Kabelac2021-09-131-1/+1
| | | | | | | | | | | When generating table line for cache target line, the estimation of added arguments was incorrectly calculated as the evaluation order of "?" is made after "+". However the result was 'masked' by the Reported-by: Jian Cai jcai19
* vdo: add support for auto-unsafe writePolicyZdenek Kabelac2021-09-063-2/+5
| | | | This vdoWritePolicy policy missed matching support in lvm2.
* cov: ensure bufffe size is at least 5Zdenek Kabelac2021-07-281-1/+1
| | | | | Analyzer can now see, the buffer size will have at least 5 chars on succefull path.
* clang: always initialized valuesZdenek Kabelac2021-04-231-1/+1
|
* libdm: replace deprecated security_context_tZdenek Kabelac2021-04-121-3/+3
| | | | | | | Use 'char *' instead of deprecated security_context_t. In more details i.e.: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1776
* device_mapper: remove unused linesZdenek Kabelac2021-03-303-119/+0
| | | | No need for versioning history in internal version.
* cov: mask uninitialized valueZdenek Kabelac2021-03-101-1/+1
| | | | Coverity doesn't track ioctl() too well, so let's just make it quiet.
* debug: change sys_error to sys_debugZdenek Kabelac2021-03-103-3/+3
| | | | | These messages do not cause command error - so changing logging level to just 'sys_debug' (so visible only with -vvvv)
* lvm-file: remove duplication of dm_is_empty_dirZdenek Kabelac2021-03-101-1/+1
|
* device_mapper: keep bigger size for most ioctlsZdenek Kabelac2021-03-101-1/+1
| | | | | Actually the idea was to keep 2K ioctl only for certain command, so keep 16 for them.
* libdm-config: replace check for 0Zdenek Kabelac2021-03-081-1/+1
| | | | No need to call strlen() when checking for zero length string.
* hash: use individual hint sizesZdenek Kabelac2021-03-082-3/+3
| | | | | | | | | | | | | | Use different 'hint' size for dm_hash_create() call - so when debug info about hash is printed we can recognize which hash was in use. This patch doesn't change actual used size since that is always rounded to be power of 2 and >=16 - so as such is only a help to developer. We could eventually use 'name' arg, but since this would have changed API and this patchset will be routed to libdm & stable - we will just use this small trick.
* debug: use enclusing "" for debugZdenek Kabelac2021-03-021-1/+1
|
* integrity: mark as user of secure_dataZdenek Kabelac2021-03-021-0/+3
| | | | | Use the secure_data with integrity target. Not so big difference, as the secure feature of the integrity target is not used by lvm2.
* device_mapper: reduce min_size for flattenZdenek Kabelac2021-03-021-1/+13
| | | | | For most ioctl() we do not need to pass so big buffers and we can reduce amount of zeroed memory blocks.