From faf0f1fbdee796d89a313172e7bb3ce5dd73c411 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 10 Jun 2014 16:56:44 +0200 Subject: Handle errors when destroying file systems for zfs jail --- ezjail-admin | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ezjail-admin') diff --git a/ezjail-admin b/ezjail-admin index fb3fc1f..d18bb79 100755 --- a/ezjail-admin +++ b/ezjail-admin @@ -923,7 +923,14 @@ delete) [ "${ezjail_image}" ] && rm -f "${ezjail_image}" "${ezjail_image%.img}.device" ;; zfs) - /sbin/zfs destroy -r ${ezjail_parentzfs}/${ezjail_hostname} + if ! /sbin/zfs destroy -r ${ezjail_parentzfs}/${ezjail_hostname}; then + [ "${ezjail_forcestop}" ] || exerr "Error: Could not destroy file system ${ezjail_parentzfs}/${ezjail_hostname} for jail ${ezjail_name}." + echo "Warning: Could not destroy file system ${ezjail_parentzfs}/${ezjail_hostname} for jail ${ezjail_name}." + echo " Sleeping 5 seconds before retrying forcefully." + sleep 5 + /sbin/zfs destroy -rf ${ezjail_parentzfs}/${ezjail_hostname} || exerr "Error: Failed to destroy file system." + echo "Success." + fi ;; *) chflags -R noschg "${ezjail_rootdir}" -- cgit v1.2.3