summaryrefslogtreecommitdiffstats
path: root/discover/devmapper.c
Commit message (Collapse)AuthorAgeFilesLines
* discover/devmapper: Retry dm-device remove if busyv1.10.0Samuel Mendoza-Jonas2018-12-131-5/+19
| | | | | | | | | | | | | | | | | | | | Buildroot's libdm is not built with --enable-udev_sync, so device-mapper actions are not able to sync or wait for udev events. (see 185676316, "discover/devmapper: Disable libdm udev sync support") This can cause an issue when tearing down a snapshot in devmapper_destroy_snapshot() which performs a DM_DEVICE_REMOVE task against the snapshot, origin, and base devices one after the other. In some cases if the interval between these actions is too short the action can fail as the preceding device hasn't disappeared yet and the device being removed is still busy. Since we don't yet have a way to tell exactly when the device is ready, pause for a short time and retry the action, letting devmapper_destroy_snapshot() continue and, for example, letting mount_device() fall back to the physical device. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* lib/log: Switch to pb_log_fnGeoff Levand2018-08-071-7/+7
| | | | | | | | The only functional change should be an additional '/n' to a few log messagees that seemed to be missing it. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* printf: Fix format type warningsGeoff Levand2018-01-101-1/+2
| | | | | | | | | Fixes build warnings like these when building 32 bit programs: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument has type ‘uint64_t’ Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/devmapper: Add prefix to devmapper device namesSamuel Mendoza-Jonas2017-07-111-6/+9
| | | | | | | | | Add a 'pb-' prefix to all device mapper devices created by Petitboot. Beyond helping to identify Petitboot-related devices, this avoids naming collisions if we create snapshots of LVM logical volumes which also exist in /dev/mapper. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/devmapper: Read device size from sysfsSamuel Mendoza-Jonas2016-04-081-9/+77
| | | | | | | | | | | | | If udev doesn't export the ID_PART_ENTRY_SIZE variable for a device we skip creating a snapshot for it. However in most cases the sysfs attribute which udev reads to find ID_PART_ENTRY_SIZE is still available. Therefore if we don't have access to ID_PART_ENTRY_SIZE try to find the size in sysfs directly. This allows us to create snapshots for devices which often don't have this udev variable set, such as software raid (md) devices and NVMe devices. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/devmapper: Use explicit 64-bit types for sector countsJeremy Kerr2015-09-301-11/+13
| | | | | | | | | We currently have a bug where the return value from get_block_sectors may overflow an unsigned int, so we create a snapshot that is too small. This change uses uint64_t types for the sector counts. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add disable param for dm-snapshotsSamuel Mendoza-Jonas2015-08-181-0/+4
| | | | | | | Add a debug-style nvram parameter to disallow the use of device-mapper snapshots. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover/devmapper: Disable libdm udev sync supportSamuel Mendoza-Jonas2015-08-181-3/+12
| | | | | | | | | | | Certain userspace environments that Petitboot is packaged with include a libdm built with udev sync support which hung with the previous approach. Relying on udev to properly process dm device creation makes some assumptions about the flavour of udev available - until that is certain disable udev sync support and have device-mapper control device creation itself. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Support creation of device-mapper devicesSamuel Mendoza-Jonas2015-08-061-0/+540
Add discover/dm-snapshot that allows the creation of device-mapper snapshots that support merging changes back to disk. Device-mapper snapshots are a CoW device backed by a ramdisk, mirroring the contents of a source device. No changes are made to the original disk unless an explicit merge action is performed. This guarantees read-only mounting of host disks even when writes could implicitly occur, eg. when performing recovering a journaled filesystem. In the event that writing back to the disk is desired, such as when updating grubenv, the changes made to the snapshot can be merged back to the source disk. This patch adds support but does not change functionality. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
OpenPOWER on IntegriCloud