summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* spec: Rename vdoimport to lvm_import_vdo.dev-mcsontos-rename-vdoimportMarian Csontos2021-08-261-2/+2
|
* vdo: Rename vdoimport to lvm_import_vdo.Marian Csontos2021-08-2610-22/+23
|
* devices: restrict device id types to specific major numbersDavid Teigland2021-08-232-9/+65
| | | | | | Some device id types can only be used with specific device major numbers, so use this restriction to avoid some comparisions. This is more efficient, and can avoid some incorrect matches.
* add missing sys/file.h includeAlex Xu (Hello71)2021-08-232-0/+3
| | | | required for LOCK_EX etc on musl
* vgimportclone: fix when duplicates are both in the devices fileDavid Teigland2021-08-202-2/+23
| | | | | Fix case where duplicate PVs are created (e.g. with dd) from devices that are both already in the devices file.
* devices file: recognize old locking_type 0David Teigland2021-08-201-8/+6
| | | | | if the old locking_type is 0, set cmd->nolocking so that it will be applied to the devices file lock.
* logging: messages for found metadataDavid Teigland2021-08-202-20/+11
|
* devices: apply ignorelockingfailure to devices file lockDavid Teigland2021-08-203-3/+6
|
* tests: adjust for check_devicesfileDavid Teigland2021-08-2021-49/+209
|
* lvmdevices: check yes option for adding duplicateDavid Teigland2021-08-193-1/+5
|
* cov: clean up pvid and vgid usageDavid Teigland2021-08-1619-204/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pvid and vgid are sometimes a null-terminated string, and other times a 'struct id', and the two types were often cast between each other. When a struct id was cast to a char pointer, the resulting string would not necessarily be null terminated. Casting a null-terminated string id to a struct id is fine, but is still avoided when possible. A struct id is: int8_t uuid[ID_LEN] A string id is: char pvid[ID_LEN + 1] A convention is introduced to help distinguish them: - variables and struct fields named "pvid" or "vgid" should be null-terminated strings. - variables and struct fields named "pv_id" or "vg_id" should be struct id's. - examples: char pvid[ID_LEN + 1]; char vgid[ID_LEN + 1]; struct id pv_id; struct id vg_id; Function names also attempt to follow this convention. Avoid casting between the two types as much as possible, with limited exceptions when known to be safe and clearly commented. Avoid using variations of strcpy and strcmp, and instead use memcpy/memcmp with ID_LEN (with similar limited exceptions possible.)
* cov: lvmlockd: rewrite string copies to avoid warningsDavid Teigland2021-08-161-31/+45
| | | | | | | | | - Use a new function for all instances of copying a null-terminated string into a fixed size struct field that is not null-terminated. - use memcpy when copying between struct fields of the same size
* lvchange: fix lvchange refresh failed for dm suspend or resume failedYi Wang2021-08-161-1/+1
| | | | | | | | | | | When multiple lvchange refresh processes executed at the same time, suspend/resume ioctl on the same dm, some of these commands will be failed for dm aready change status, and ioctl will return EINVAL in _do_dm_ioctl function. to avoid this problem, add READ_FOR_ACTIVATE flags in lvchange refresh process, it will hold LCK_WRITE lock and avoid suspend/resume dm at the same time. Signed-off-by: Long YunJian <long.yunjian@zte.com.cn> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
* toolcontext.h: use bit field in structDavid Teigland2021-08-121-2/+2
| | | | | Two recent additions should have used a bit instead of an entire int.
* post-releaseMarian Csontos2021-08-114-2/+8
|
* pre-releasev2_03_13Marian Csontos2021-08-114-6/+6
|
* WHATS_NEW: updateMarian Csontos2021-08-101-0/+9
|
* make: generateroot2021-08-051-17/+11
|
* pvscan: only match devices file for command argsDavid Teigland2021-08-054-5/+65
| | | | | Avoid matching all devices with the devices file to avoid delays during startup.
* devices file: avoid updating entry dev names in some casesDavid Teigland2021-08-055-0/+18
| | | | | | Avoid thrashing changes to devices file device names by some commands that are run during startup when devnames are still being set up.
* devices file: limit warnings about devices file entries not foundDavid Teigland2021-08-057-12/+23
| | | | | | All commands were printing a warning if a devices file entry was not found. Limit this to commands that report/display lvm state.
* cov: lvmlockd path copyDavid Teigland2021-08-021-2/+2
|
* debug: stack tracing on error pathZdenek Kabelac2021-07-281-10/+10
|
* cov: add initilizerZdenek Kabelac2021-07-281-1/+1
|
* cov: add explicit check for vg existenceZdenek Kabelac2021-07-281-1/+1
| | | | Since we check !vg - add check before accessing ->status.
* cov: raid: no more checks with missing areasZdenek Kabelac2021-07-281-1/+3
| | | | | Since ->areas is directly dereferenced we need to stop validation right here.
* cov: dev-mpath: check config_wwids_fileZdenek Kabelac2021-07-281-1/+2
| | | | | | Since config_wwids_file is checked for NULL, test is also before calling _read_wwid_file() that is directly dereferencing it.
* cov: guard indexZdenek Kabelac2021-07-281-1/+1
| | | | Analyzer wants explicit protect to not underflow index.
* cov: ensure bufffe size is at least 5Zdenek Kabelac2021-07-282-2/+2
| | | | | Analyzer can now see, the buffer size will have at least 5 chars on succefull path.
* cov: add internal error for missing argZdenek Kabelac2021-07-281-0/+5
| | | | Analyzer is happier.
* cov: remove unneeded includesZdenek Kabelac2021-07-283-4/+0
|
* cov: memleak dir descriptorZdenek Kabelac2021-07-281-0/+3
| | | | opendir() missed closedir().
* pvck: ensure buffer is 0 terminatedZdenek Kabelac2021-07-281-1/+1
| | | | | Since readed metadata buffer is passed to printf(), ensure the buffer is '\0' terminated.
* cov: pvck fix memleakZdenek Kabelac2021-07-281-14/+9
| | | | | | | | | | Fix memory leaks on error paths for allocated path and backup_file name by converting allocation to dm_pool_alloc and also change devicefile structure to contain embeded path as last struct member - so we could allocate only needed string size instead of PATH_MAX from pool. TODO: still to be fixed 'mf' struct.
* tests: extend vgmerge testingZdenek Kabelac2021-07-231-0/+42
|
* vgmerge: support option --poolmetadataspareZdenek Kabelac2021-07-234-2/+17
|
* vgmerge: remove one of merge pmspare LVsZdenek Kabelac2021-07-231-0/+14
| | | | | When merging 2 VG, where both of them have pmspare volume, select the bigger one and remove the other.
* writecache: use block size 512 for thin pool dataDavid Teigland2021-07-211-0/+17
| | | | | | | | | | | | Recent commit 84bd394cf9aaa581b4bf980f764544dda26a0305 "writecache: use block size 4096 when no fs is found" failed to account for the case where writecache is attached to thin pool data. Checking fs block size on the thin pool data LV is wrong, and checking the fs block on each thin LV would be impractical, so default to 512 which cannot break any existing file systems, and require the user to specify 4k when appropriate.
* writecache: fix missing sync_dev_names when attaching cacheDavid Teigland2021-07-211-0/+6
| | | | | When activating an LV to check the fs block size, wait for the LV dev to be accessible before running blkid on it.
* spec: Add vdoimport man pageMarian Csontos2021-07-211-1/+6
|
* testZdenek Kabelac2021-07-211-0/+47
|
* vgsplit: add support for option --poolmetadataspareZdenek Kabelac2021-07-215-1/+30
| | | | | | | When splitting VG with thin/cache pool volume, handle pmspare during such split and allocate new pmspare in new VG or extend existing pmspare there and eventually drop pmspare in original VG if is no longer needed there.
* vgremove: remove forgotten pmspareZdenek Kabelac2021-07-211-0/+4
| | | | | | | | | As pmspare is an invisible LV it's not getting automatically removed since vgremove removes only visible LVs and it depending LVs. If there was no other thin/cache pool volume, such pmspare stayed undeleted and caused command failure. So handle explicitelly such forgotten pmspare and remove it.
* thin: fix component detection of external originZdenek Kabelac2021-07-143-1/+27
| | | | | | When check active componet of thinLV with external origin, we need to check if the external origin isn't already active. For this however we need to use layered check for -real device.
* pvscan: narrow the previous commit slightlyDavid Teigland2021-07-131-5/+13
| | | | to avoid change to pvscan-autoactivate.sh
* pvscan: do nothing for device removal and event_activation=0David Teigland2021-07-131-6/+5
| | | | | | | | | The lvm2-pvscan service runs pvscan --cache -aay <dev> for device addition, and pvscan --cache <dev> on device removal. For event_activation=0, the addition does nothing. Fix device removal to also do nothing for event_activation=0. Device removal was previously doing some work to process the removal which slowed down stopping lvm2-pvscan services.
* fix multipath component detection for multiple holdersDavid Teigland2021-07-131-86/+83
| | | | | | sysfs-based multipath component detection quit if a device had multiple holders, and in this case would fail to detect a device was an mpath component.
* filter-usable: remove udev dev size checkDavid Teigland2021-07-131-73/+4
| | | | | | | For the pv_min_size check, always use dev_get_size() which is commonly used elsewhere, and don't bother asking libudev for the device size when external_device_info_source=udev.
* devices: rework libudev usageDavid Teigland2021-07-1322-683/+659
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | related to config settings: obtain_device_info_from_udev (controls if lvm gets a list of devices from readdir /dev or from libudev) external_device_info_source (controls if lvm asks libudev for device information) . Make the obtain_device_list_from_udev setting affect only the choice of readdir /dev vs libudev. The setting no longer controls if udev is used for device type checks. . Change obtain_device_list_from_udev default to 0. This helps avoid boot timeouts due to slow libudev queries, avoids reported failures from udev_enumerate_scan_devices, and avoids delays from "device not initialized in udev database" errors. Even without errors, for a system booting with 1024 PVs, lvm2-pvscan times improve from about 100 sec to 15 sec, and the pvscan command from about 64 sec to about 4 sec. . For external_device_info_source="none", remove all libudev device info queries, and use only lvm native device info. . For external_device_info_source="udev", first check lvm native device info, then check libudev info. . Remove sleep/retry loop when attempting libudev queries for device info. udev info will simply be skipped if it's not immediately available. . Only set up a libdev connection if it will be used by obtain_device_list_from_udev/external_device_info_source. . For native multipath component detection, use /etc/multipath/wwids. If a device has a wwid matching an entry in the wwids file, then it's considered a multipath component. This is necessary to natively detect multipath components when the mpath device is not set up.
* toolcontext: fix double free (core dumped) issueHeming Zhao2021-07-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How to trigger: ``` ~ # export LVM_SYSTEM_DIR=_ ~ # pvscan No matching physical volumes found double free or corruption (!prev) Aborted (core dumped) ``` when LVM_SYSTEM_DIR is empty, _load_config_file() won't be called. when LVM_SYSTEM_DIR is not empty, cfl->cft links into cmd->config_files by _load_config_file()@lib/commands/toolcontext.c core dumped code: _destroy_config()@lib/commands/toolcontext.c ``` /* CONFIG_FILE/CONFIG_MERGED_FILES */ if ((cft = remove_config_tree_by_source(cmd, CONFIG_MERGED_FILES))) config_destroy(cft); else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE))) config_destroy(cft); <=== first free the cft dm_list_iterate_items(cfl, &cmd->config_files) config_destroy(cfl->cft); <=== double free the cft ``` Fixes: c43f2f8ae08ed0555a300764c8644ea56f4f41e2 Signed-off-by: Heming Zhao <heming.zhao@suse.com>