From patchwork Wed Oct 7 17:59:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 11821499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6919417CF for ; Wed, 7 Oct 2020 18:28:04 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E8062173E for ; Wed, 7 Oct 2020 18:28:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E8062173E Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=xenproject.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.3680.10727 (Exim 4.92) (envelope-from ) id 1kQE9N-00013R-Ma; Wed, 07 Oct 2020 18:26:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 3680.10727; Wed, 07 Oct 2020 18:26:53 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQE9N-00012c-6T; Wed, 07 Oct 2020 18:26:53 +0000 Received: by outflank-mailman (input) for mailman id 3680; Wed, 07 Oct 2020 18:26:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQE3F-00072Q-JI for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 18:20:33 +0000 Received: from chiark.greenend.org.uk (unknown [2001:ba8:1e3::]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a795a7b0-ab03-49c3-846d-640a676d8665; Wed, 07 Oct 2020 18:19:42 +0000 (UTC) Received: from [172.18.45.5] (helo=zealot.relativity.greenend.org.uk) by chiark.greenend.org.uk (Debian Exim 4.84_2 #1) with esmtp (return-path ijackson@chiark.greenend.org.uk) id 1kQDjx-0007CF-CF; Wed, 07 Oct 2020 19:00:37 +0100 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kQE3F-00072Q-JI for xen-devel@lists.xenproject.org; Wed, 07 Oct 2020 18:20:33 +0000 X-Inumbo-ID: a795a7b0-ab03-49c3-846d-640a676d8665 Received: from chiark.greenend.org.uk (unknown [2001:ba8:1e3::]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a795a7b0-ab03-49c3-846d-640a676d8665; Wed, 07 Oct 2020 18:19:42 +0000 (UTC) Received: from [172.18.45.5] (helo=zealot.relativity.greenend.org.uk) by chiark.greenend.org.uk (Debian Exim 4.84_2 #1) with esmtp (return-path ijackson@chiark.greenend.org.uk) id 1kQDjx-0007CF-CF; Wed, 07 Oct 2020 19:00:37 +0100 From: Ian Jackson To: xen-devel@lists.xenproject.org Cc: Ian Jackson Subject: [OSSTEST PATCH 17/82] Debian: osstest-erase-other-disks: Slightly guard against races Date: Wed, 7 Oct 2020 18:59:19 +0100 Message-Id: <20201007180024.7932-18-iwj@xenproject.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201007180024.7932-1-iwj@xenproject.org> References: <20201007180024.7932-1-iwj@xenproject.org> MIME-Version: 1.0 From: Ian Jackson Apparently it can happen that something decides to rescan a partition table, removing a partition block device, while it is being zeroed: osstest-erase-other-disks-6081: hd devices present after: /dev/hd* osstest-erase-other-disks-6081: Erasing /dev/sda osstest-erase-other-disks-6081: Erasing /dev/sda1 osstest-erase-other-disks-6081: /dev/sda1 is no longer a block device! To try to narrow the window during which this race occurs, do not care if the thing we just zeroed no longer exists after we zeroed it. We still bomb out if it exists but is not a block device - that would probably mean we had written it out as a file. This is all quite unfortunate. Signed-off-by: Ian Jackson --- Osstest/Debian.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 85fd16da..3fa26e45 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -1211,8 +1211,8 @@ zero () { if test -b \$dev; then log "Erasing \$dev" dd if=/dev/zero of=\$dev count=64 ||: - if ! test -b \$dev; then - log "\$dev is no longer a block device!" + if test -e \$dev && ! test -b \$dev; then + log "\$dev still exists but is no longer a block device!" exit 1 fi else