From aa86d39d94be37016cd4404761a6850b925858c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 4 Jun 2024 23:54:44 +0200 Subject: [PATCH] Use 'dmsetup remove --retry' destroy-snapshot sometimes fails with "Device or resource busy" error, retry a few times in case of udev or other process still accessing the device. Suggested-by: @rustybird Fixes QubesOS/qubes-issues#9283 --- linux/system-config/destroy-snapshot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/system-config/destroy-snapshot b/linux/system-config/destroy-snapshot index f6071e643..1dfd87ace 100755 --- a/linux/system-config/destroy-snapshot +++ b/linux/system-config/destroy-snapshot @@ -43,7 +43,7 @@ case $node in if is_unused "$snap"; then # unused snapshot - remove it deps+=" $(deps "$snap")" - dmsetup -- remove "$snap" + dmsetup remove --retry -- "$snap" else has_snapshot=true fi @@ -55,7 +55,7 @@ case $node in esac if [[ "$has_snapshot" = 'false' ]] && [[ -e "$node" ]]; then - dmsetup -- remove "$node" + dmsetup remove --retry -- "$node" fi # try to free unused devices @@ -66,7 +66,7 @@ for dev in $deps; do losetup -d "$dev" 2> /dev/null || true ;; /dev/dm-*) - dmsetup remove "$dev" 2> /dev/null || true + dmsetup remove --retry -- "$dev" 2> /dev/null || true ;; esac fi