X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fzpool-config%2Flo-raidz2.sh;h=53a032ec5f433bda20e5d8ceb26d32f86bf8e568;hb=76659dc110ef2ada13bcb8e4e2ec60d8216c6836;hp=6e61293c0b9c93e3c68f6aaa0c6744357396f67f;hpb=c9c0d073da561bcbefbdf09c87fc75b227415619;p=zfs.git diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh index 6e61293..53a032e 100644 --- a/scripts/zpool-config/lo-raidz2.sh +++ b/scripts/zpool-config/lo-raidz2.sh @@ -10,6 +10,8 @@ FILES="/tmp/zpool-vdev0 \ DEVICES="" zpool_create() { + check_loop_utils + for FILE in ${FILES}; do DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" @@ -29,6 +31,9 @@ zpool_destroy() { msg ${ZPOOL} destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME} + # Delay to ensure device is closed before removing loop device + sleep 1 + for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` msg "Removing ${FILE} using loopback device ${DEVICE}"