]> git.ozlabs.org Git - petitboot/commit
discover/devmapper: Retry dm-device remove if busy v1.7.4
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 4 Dec 2018 01:49:28 +0000 (12:49 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 8 Jan 2019 23:38:49 +0000 (10:38 +1100)
commit8b9d8bf7c9837832347dd8018b9910cc7d2b4371
treec65a434ec45ac87754c9b661788d664f9374142c
parent017aada974ef9c322cad412a9832fa1df265267b
discover/devmapper: Retry dm-device remove if busy

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>
(cherry picked from commit 89cde533356d47b34a80679602c3900572b2dca6)
discover/devmapper.c