summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* vdo: read live vdo size configurationZdenek Kabelac2023-01-165-0/+107
| | | | | | | | Introduce struct vdo_pool_size_config usable to calculate necessary memory size for active VDO volume. Function lv_vdo_pool_size_config() is able to read out this configuration out of runtime DM table line.
* vdo: check memory only in non critical sectionZdenek Kabelac2023-01-161-1/+3
| | | | | When we are actually resizing VDO device - we need to check size only in non-critical section - otherwise we are checking
* lvresize: use standard extent conversion functionZdenek Kabelac2023-01-161-1/+2
| | | | | We need to validate whether the requested resizing size can be expressed with given extent_size.
* fix typolilinjie2023-01-111-3/+3
| | | | | Signed-off-by: lilinjie <lilinjie@uniontech.com> (cherry picked from commit 81b1f5bc3bac0e2e9099b67162da7d1a4995c5f4)
* lvmlockd: Fix syntax error in previous commitMarian Csontos2023-01-111-1/+1
|
* lvmlockd: fix report of lv_active_exclusively for special lv typesDavid Teigland2023-01-103-23/+44
| | | | | | | | | | | | Cover a case missed by the recent commit e0ea0706d "report: query lvmlockd for lv_active_exclusively" Fix the lv_active_exclusively value reported for thin LVs. It's the thin pool that is locked in lvmlockd, and the thin LV state was mistakenly being queried and not found. Certain LV types like thin can only be activated exclusively, so always report lv_active_exclusively true for these when active.
* cov: remove unused header filesZdenek Kabelac2022-12-203-3/+0
|
* lvextend: fix overprovisioning check for thin lvsDavid Teigland2022-12-151-2/+3
| | | | | | | | 18722dfdf4d3 lvresize: restructure code mistakenly changed the overprovisioning check from applying to all lv_is_thin_type lvs to only lv_is_thin_pool lvs, so it no longer applied when extending thin lvs. The result was missing warning messages when extending thin lvs.
* writecache: support settings metadata_only and pause_writebackDavid Teigland2022-12-082-0/+28
| | | | Two new settings for tuning dm-writecache.
* device_id: fix segfault verifying serial for non-pvDavid Teigland2022-12-021-2/+4
| | | | | | | The recent change that verifies sys_serial system.devices entries using the PVID did not exclude non-PV devices from being checked. The verification code would attempt to use du->pvid which was null for the non-PVs causing a segfault.
* device_id: check return value of label_read_pvidDavid Teigland2022-12-011-2/+3
| | | | for covscan
* device_id: _get_devs_with_serial_numbers add missing freeDavid Teigland2022-12-011-7/+9
| | | | on malloc failure path
* device_id: add null id->name null checkDavid Teigland2022-12-011-2/+2
| | | | for covscan
* lvmcache: fix strncpy len for wwidDavid Teigland2022-12-011-5/+5
|
* report: query lvmlockd for lv_active_exclusivelycorubba2022-11-113-5/+28
| | | | | | | | Query LV lock state in lvmlockd to report lv_active_exclusively for active LVs in a shared VGs. As with all lvmlockd state, it is from the perspective of the local node. Signed-off-by: corubba <corubba@gmx.de>
* report: adjust lv_active_remotely for shared VGscorubba2022-11-111-1/+2
| | | | | | | | | | | Add a note to the manpage that lvmlockd is unable to determine accurately and without side-effects whether a LV is remotely active. Also change the value of the lv_active_remotely option from false to undefined for shared VGs to distinctly communicate that inability to users. Only for local VGs it can be definitely stated that they are not remotely active. Signed-off-by: corubba <corubba@gmx.de>
* devices: factor common list functionsDavid Teigland2022-11-077-57/+95
| | | | which were duplicated in various places
* device_id: handle duplicate serial numbersDavid Teigland2022-11-075-0/+400
| | | | | | | | | Handle multiple devices using the same serial number as their device id. After matching devices to devices file entries, if there is a discrepency between the ondisk PVID and the devices file PVID, then rematch devices to devices file entries using PVID, looking at all disks on the system with the same serial number.
* device_id: look for serial number in other locationsDavid Teigland2022-11-073-2/+105
| | | | | | | | Only /sys/dev/block/major:minor/device/serial was read to find a disk serial number, but a serial number seems to be reported more often in other locations, so check these also: /sys/dev/block/major:minor/device/vpd_pg80 /sys/class/block/vda/serial (for virtio disks only)
* dev_manager: accept misalined vdo pools.Zdenek Kabelac2022-11-022-11/+7
| | | | | Since lvm2 may create VDO pool virtual size aligned only on extent size while VDO itself is just 4K aligned - we need to support such misalign.
* device_id: remove debug traceDavid Teigland2022-10-241-1/+1
| | | | for common case where a device id type is not used.
* cmd: save device_id_sysfs_dirDavid Teigland2022-10-243-3/+3
| | | | | read and save device_id_sysfs_dir to avoid spamming debug output from find_config_tree_str.
* lvmnotify.c: Check to see if dbus daemon is runningTony Asleson2022-10-191-0/+68
| | | | | | | | | | | | The lvm dbus daemon will auto activate on dbus API calls. To prevent the dbus daemon starting when lvm command line tools are being used we will check to see if the daemon is running first. If the daemon is not running, we will not notify the daemon. For this check to work it requires the changes done previously with commit: 3fdf4493481ff8baae2ac5416dce6d05b69e6b28 Reviewed-by: David Teigland <teigland@redhat.com>
* lvreduce: change error message about --fs optionsDavid Teigland2022-10-121-1/+1
|
* lvmlockd: Fix sanlock lvmlock lv size calculationcorubba2022-10-121-1/+3
| | | | | | | | | | | | | | | | | | | | | The number of extents for the sanlock lvmlock lv is calculated using integer division, which rounds towards zero. With a physical extent size of 129M, instead of the requested 256M the lv is only 129M (1 extent). With any physical extent size greater than 256M the lv creation fails because the number of extents is zero. This is fixed by replacing the integer division with a division macro that rounds up and thus guarantees that the size of the lv will always be equal or greater than the requested size. Using the examples above, a pes of 129M will result in a 258M lv (2 extents), pes of 300M in a 300M lv (1 extent). The re-calculation of the lv size in bytes and megabytes is only so the debug output shows the correct values. The size in mb there is still not byte-perfect-accurate, but good enough for a human-readable estimate; and the exact size in bytes and extents is right next to it. Signed-off-by: corubba <corubba@gmx.de>
* toollib: do not process just created historical LVPeter Rajnoha2022-10-122-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When executing process_each_lv_in_vg, we process live LVs first and after that, we process any historical LVs. In case we have just removed an LV, which also means we have just made it "historical" and so it appears as fresh item in vg->historical_lvs list, we have to skip it when we get to processing historical LVs inside the same process_each_lv_in_vg call. The simplest approach here, without introducing another LV list, is to simply mark such historical LVs as "fresh" directly in struct historical_logical_volume when we have just removed the original LV and created the historical LV for it. Then, we just need to check the flag when processing historical LVs and skip it if it is "fresh". When we read historical LVs out of metadata, they are marked as "not fresh" and so they can be processed as usual. This was mainly an issue in conjuction with -S|--select use: # lvmconfig --type diff metadata { record_lvs_history=1 } (In this example, a thin pool with lvol1 thin LV and lvol2 and lvol3 snapshots.) # lvs -H vg -o name,pool_lv,full_ancestors,full_descendants LV Pool FAncestors FDescendants lvol1 pool lvol2,lvol3 lvol2 pool lvol1 lvol3 lvol3 pool lvol2,lvol1 pool # lvremove -S 'name=lvol2' Logical volume "lvol2" successfully removed. Historical logical volume "lvol2" successfully removed. ...here, the historical LV lvol2 should not have been removed because we have just removed its original non-historical lvol2 and the fresh historical lvol2 must not be included in the same processing spree.
* lvreduce: require active LV when no fs option is usedDavid Teigland2022-10-111-0/+4
| | | | | Without an --fs option set, make lvreduce of an inactive LV fail and report that the LV must be active.
* lvmdevices: use deviceidtype option strictlyDavid Teigland2022-10-102-4/+13
| | | | | Only use the device id type specified by --deviceidtype, and fail if that type is not available for the device.
* device id: add new types using values from vpd_pg83David Teigland2022-10-105-2/+112
| | | | | | | | | | | | | | | | | | | | | | | | | The new device_id types are: wwid_naa, wwid_eui, wwid_t10. The new types use the specific wwid type in their name. lvm currently gets the values for these types by reading the device's vpd_pg83 sysfs file (this could change in the future if better methods become available for reading the values.) If a device is added to the devices file using one of these types, prior versions of lvm will not recognize the types and will be unable to use the devices. When adding a new device, lvm continues to first use sys_wwid from the sysfs wwid file. If the device has no sysfs wwid file, lvm now attempts to use one of the new types from vpd_pg83. If a devices file entry with type sys_wwid does not match a given device's sysfs wwid file, the sys_wwid value will also be compared to that device's other wwids from its vpd_pg83 file. If the kernel changes the wwid type reported from the sysfs wwid file, e.g. from a device's t10 id to its naa id, then lvm should still be able to match it correctly using the vpd_pg83 data which will include both ids.
* device id: change space handling in t10 wwidDavid Teigland2022-10-101-3/+58
| | | | | | | t10 wwids are now edited in the same way that multipath does, which is replacing a series of spaces with one _. Previously lvm replaced every space with one _. Devices file entries with the old form will be converted to the new shorter form.
* device id wwid adjustmentsDavid Teigland2022-10-105-192/+244
| | | | | | | | | | | | | | | Move the functions handling dev wwids. Add dev flags indicating that wwids have been read from sysfs wwid file or sysfs vpd_pg83 file. This can be used to avoid rereading these. Improve filter-mpath search for a device's wwid in /etc/multipath/wwids, to avoid unnecessary rereading of wwids from sysfs files. Type 8 wwids from vpd_pg83 with naa or eui names should be saved as those types.
* lvresize: move the lockd_lv earlierDavid Teigland2022-10-031-7/+7
| | | | | the lock should cover any potential activation, not just the resizing changes
* blkid: fix BLKID_SUBLKS_FSINFO usageDavid Teigland2022-09-291-7/+8
| | | | | Use this flag for all fs info lookups, including BLOCK_SIZE, if it is defined in blkid.h.
* lvresize: give special advice to reiserfs usersDavid Teigland2022-09-281-1/+11
|
* lvresize: let env var set lvresize_fs_helper_pathDavid Teigland2022-09-271-3/+16
|
* remove unused variablesDavid Teigland2022-09-271-7/+0
|
* change messages about libblkid featuresDavid Teigland2022-09-272-10/+1
| | | | | | | remove message about missing libblkid features change message recommending resize_fsadm when libblkid features are not available.
* lvreduce: use temporary flag when activating lv to check for fsDavid Teigland2022-09-271-0/+2
| | | | This flag is meant to suppress udev processing of the LV.
* make: move cmds.hDavid Teigland2022-09-271-2/+2
| | | | | generate the header in the include dir so it can be easily used from both lib and tools dirs.
* covscan: free wwid strings in lvmcacheDavid Teigland2022-09-211-15/+31
|
* vgremove: remove online files in run dirDavid Teigland2022-09-142-0/+58
| | | | | | | | | | | These files are automatically cleared on reboot given that /run is tmpfs, and that remains the primary way of clearing online files. But, if there's extreme use of vgcreate+pvscan+vgremove between reboots, then removing online files in vgremove will limit the number of unused online files using space in /run.
* lvresize: add new options and defaults for fs handlingDavid Teigland2022-09-1311-70/+1327
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option "--fs String" for lvresize/lvreduce/lvextend controls the handling of file systems before/after resizing the LV. --resizefs is the same as --fs resize. The new option "--fsmode String" can be used to control mounting and unmounting of the fs during resizing. Possible --fs values: checksize Only applies to reducing size; does nothing for extend. Check the fs size and reduce the LV if the fs is not using the affected space, i.e. the fs does not need to be shrunk. Fail the command without reducing the fs or LV if the fs is using the affected space. resize Resize the fs using the fs-specific resize command. This may include mounting, unmounting, or running fsck. See --fsmode to control mounting behavior, and --nofsck to disable fsck. resize_fsadm Use the old method of calling fsadm to handle the fs (deprecated.) Warning: this option does not prevent lvreduce from destroying file systems that are unmounted (or mounted if prompts are skipped.) ignore Resize the LV without checking for or handling a file system. Warning: using ignore when reducing the LV size may destroy the file system. Possible --fsmode values: manage Mount or unmount the fs as needed to resize the fs, and attempt to restore the original mount state at the end. nochange Do not mount or unmount the fs. If mounting or unmounting is required to resize the fs, then do not resize the fs or the LV and fail the command. offline Unmount the fs if it is mounted, and resize the fs while it is unmounted. If mounting is required to resize the fs, then do not resize the fs or the LV and fail the command. Notes on lvreduce: When no --fs or --resizefs option is specified: . lvextend default behavior is fs ignore. . lvreduce default behavior is fs checksize (includes activating the LV.) With the exception of --fs resize_fsadm|ignore, lvreduce requires the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE. FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV, which determines if reducing the fs is necessary.
* lvresize: restructure codeDavid Teigland2022-09-097-399/+624
| | | | | Rewrite top level resize function to prepare for adding new fs resizing.
* remove libblkid flag BLKID_SUBLKS_FSINFODavid Teigland2022-09-091-1/+1
| | | | | This flag is not needed in fs_block_size_and_type() added in the previous commit.
* fix fs block size detectionDavid Teigland2022-09-093-15/+57
| | | | | blkid_get_tag_value() is not a reliable way to query the fs BLOCK_SIZE, so use the "probe" functions instead.
* gcc: eliminate warningsZdenek Kabelac2022-09-071-1/+1
| | | | | Gcc starts to show new warning - although unlikely to be able to hit initialize variables to 0.
* report: fix lv_active column type from STR to BINPeter Rajnoha2022-09-063-7/+9
| | | | | | | | Fix lv_active to be of BIN type instead of STR. This allows lv_active to follow the report/binary_values_as_numeric setting as well as --binary cmd line switch. Also, it makes it possible to use -S|--select with either textual or numeric representation of the value, like 'lvs -S active=active' but also 'lvs -S active=1'.
* vgimportdevices: fix locking when creating devices fileDavid Teigland2022-08-302-4/+4
| | | | | | | Take the devices file lock before creating a new devices file. (Was missed by the change to preemptively create the devices file prior to setup_devices(), which was done to improve the error path.)
* mm: use mallinfo2 when availableZdenek Kabelac2022-08-301-3/+10
| | | | | Switch to mallinfo2() from a deprecated mallinfo() glibc call since struct size members where to small for 64b CPUs.
* mm: preallocate memory only with glibcZdenek Kabelac2022-08-301-1/+6
| | | | Use mallinfo() only with glibc.