qcow2 umount changed

Force fs sync on umount and reverse kpartx/qemu-nbd unloading
pull/349/head
Holger Pandel 2019-11-20 14:19:59 +01:00 committed by GitHub
parent 04201efcc1
commit 0bca0f15ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -38,6 +38,7 @@ export -f mount_qimage
# umount qcow2 image: umount_image <current mountpoint> # umount qcow2 image: umount_image <current mountpoint>
umount_qimage() { umount_qimage() {
sync
while mount | grep -q "$1"; do while mount | grep -q "$1"; do
local LOCS local LOCS
LOCS=$(mount | grep "$1" | cut -f 3 -d ' ' | sort -r) LOCS=$(mount | grep "$1" | cut -f 3 -d ' ' | sort -r)
@ -46,8 +47,8 @@ umount_qimage() {
umount "$loc" umount "$loc"
done done
done done
qemu-nbd -d $NBD_DEV
kpartx -d $NBD_DEV kpartx -d $NBD_DEV
qemu-nbd -d $NBD_DEV
} }
export -f umount_qimage export -f umount_qimage