Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nGpcb-0001Hd-Q7 for mharc-grub-devel@gnu.org; Sun, 06 Feb 2022 17:03:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGpb1-00006l-R6 for grub-devel@gnu.org; Sun, 06 Feb 2022 17:01:26 -0500 Received: from [2607:f8b0:4864:20::f2a] (port=34412 helo=mail-qv1-xf2a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGpam-0000jG-2K for grub-devel@gnu.org; Sun, 06 Feb 2022 17:01:13 -0500 Received: by mail-qv1-xf2a.google.com with SMTP id fh9so2211711qvb.1 for ; Sun, 06 Feb 2022 14:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R7g2elUGl7fS2us1hNzFZAVI+1lSUATPFisdAM1aIPE=; b=NKvbnt2lb0EuW6Zp+srOvIZ2mL6VpcQF/PqVFanOMtoEyY9ETt38+4xgiTz3/335KW BOnyedG+XOMntW7SgDQnS16K/ewTPahRPovxlvkIgfaSEwLNPc+2e5EtNQ+O27Sogj/V sgrj01UCRr8h6h9KF4QzoY6ISuVM9Uv1M0IovOpQjG7H+at+sckgwg8S6Py6B9b1ye3Z ZYrajInOUzjVICjBNggZHCP3u4CzdTHkn4LnAadioeqo1e3UnWc1rNqBPBvWqgnlz8/2 pBh6dgmDY2I5gub73PkaNpTqdzYWnx7G53SzD4zy37XozpmxBbemYIXBmfYwnKf7/kKi vAdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R7g2elUGl7fS2us1hNzFZAVI+1lSUATPFisdAM1aIPE=; b=hJbfVXicc4EBGlKJbaaQirerrHOQH98jBFtLPqRcrz8GMxtGKMHQC/brRO+yv4ePKt P09UlqMn7QszP0RBYU8wTOtqr7/9vx8WnIVefy5a7JegaZVrM+zXF0hLmw6udvXKC4Fr Ys81sJmKFVQcsG3r/vvl9CpL23Wn2u15v9jev2xaXG5F1aRCLZBDSajPg2S67hQZsesl 8TRjpCTHndROETKlHR7+22CLWa3yZpbOcaElpUIwBWPVu/nzR5cR89V7QKKzxMJoALEu LWGSiCe7d56gfpcUZPsiDP6gmdjFao1n5v0zRzd1aD8EHWUrtOvO0o9jNUTpVN6ILdSm TgHA== X-Gm-Message-State: AOAM533xY7Yiz63kr5a7DEoonaZhE1WWcpssscDa5v/cr5bUHWlMgfz8 lBR+LePDPRas0Ca3aBNZyzie+7jjhNQ0Kg== X-Google-Smtp-Source: ABdhPJzSTlXkRqStw9NgMiiz/uuSdKIrV0+cQKAOzY0tvizCU0i77g0ZZqOxzHElvNkzrdgY73vOvg== X-Received: by 2002:ad4:5bc4:: with SMTP id t4mr8944607qvt.80.1644184856896; Sun, 06 Feb 2022 14:00:56 -0800 (PST) Received: from localhost.localdomain (garza.riseup.net. [198.252.153.109]) by smtp.gmail.com with ESMTPSA id u17sm4664220qkp.90.2022.02.06.14.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 14:00:56 -0800 (PST) From: Glenn Washburn To: Daniel Kiper , grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH v3 5/5] tests: Ensure that loopback devices and zfs devices are cleaned up Date: Sun, 6 Feb 2022 16:00:12 -0600 Message-Id: <8b05a80a1bf14843ae788ebff89c374436274b50.1644184605.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::f2a (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=development@efficientek.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 22:01:29 -0000 ZFS file systems are not unmounted using umount, but instead by exporting them. So export the ZFS file system that has the same label as the one that was created during the test, if such one exists. This is required to delete the loopback device that uses the ZFS image file. Otherwise the added code to delete all loopback devices setup during the test run will never be able to finish because the loopback device can not be deleted while in use. Signed-off-by: Glenn Washburn --- tests/util/grub-fs-tester.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in index 5c722209d..3bc3006de 100644 --- a/tests/util/grub-fs-tester.in +++ b/tests/util/grub-fs-tester.in @@ -14,10 +14,27 @@ tempdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || XORRISOFS_CHARSET="-input-charset UTF-8 -output-charset UTF-8" MOUNTS= +LODEVICES= cleanup() { + if [ -n "$fs" -a -z "${fs##*zfs*}" -a -n "$FSLABEL" ]; then + zpool list "$FSLABEL" 2>/dev/null && + while ! zpool export "$FSLABEL" ; do + sleep 1; + done + fi + for i in $MOUNTS; do umount "$i" || : done + + for lodev in $LODEVICES; do + local i=600 + while losetup -l -O NAME | grep -q "^$lodev\$"; do + losetup -d "$lodev" || sleep 1 + [ "$((i--))" = "0" ] && break + done + done + return 0 } trap cleanup EXIT INT # This is for bash, dash and ash do not recognize ERR -- 2.27.0