From patchwork Mon Oct 21 13:32:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 11202201 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 EFD8F1515 for ; Mon, 21 Oct 2019 13:33:45 +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 CBF7820873 for ; Mon, 21 Oct 2019 13:33:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="EntdHUGv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBF7820873 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=eu.citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMXnP-0003cA-5P; Mon, 21 Oct 2019 13:32:27 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iMXnO-0003c5-Ni for xen-devel@lists.xenproject.org; Mon, 21 Oct 2019 13:32:26 +0000 X-Inumbo-ID: 358f54e6-f407-11e9-9452-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 358f54e6-f407-11e9-9452-12813bfff9fa; Mon, 21 Oct 2019 13:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571664741; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vvz+gMyWe9EIqHjEnqLGp304xsjSkwAR2HZxiTAJeXc=; b=EntdHUGvf4SSWlYzBERUa6zEoTw4U787SpBt0PeS1H6SooARo367S2oj P2NhXfxZ9gDx0ixgPQFTognSdeYdNjySik5rnTsYrm9tZRKFOx72DAG9a 8AWQoKkOz1vUGlgwqKmH1J550ZO/6wlpj/NfdExsQYxE+6eJOLnjRzbxF A=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Wj1j5+BIJVxqEkw3aWvN0zm5sTcZ1STcCMemoS5GxHGJk07C4jW+/SF2mrunMXsEZOmIps6C7R CQHr483hfxpvm4HI7PEBIN9mWbFxnpvDJ0SOsixojLv4VUyudAt5XrT73Y2ap2S73mMIfPy5tO UBrIS6RcTseYdYz3Fg/UbskSUz7FN2VW/0q+y8twrlE6YFPYf97PP6iy7G/fv/GwdqUrFwIgke 4HUIKTnHN2XVXPeTU7SpGfYUGOrclflncpurgpbspygHs2EyFQXY+hus6wgOMP4nQ/ggOAgHqd dHU= X-SBRS: 2.7 X-MesageID: 7496062 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,323,1566878400"; d="scan'208";a="7496062" From: Ian Jackson To: Date: Mon, 21 Oct 2019 14:32:15 +0100 Message-ID: <20191021133215.26518-1-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [OSSTEST PATCH] guest_prepare_disk: Only do the umount if we set an env var X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= , Ian Jackson , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This call to guest_umount_lv is here for the benefit of ad-hoc reruns of (eg) ts-guest-start tidy up any ad-hoc messing about (eg from earlier runs of ts-debian-fixup or something). It is not needed in production runs. Serendipitously, this osstest code discovered a bug in the Linux blkback: when tearing down, it sets the backend state to 6 before it has closed the underlying block devices. This ultimately means that after "xl destroy" or "xl shutdown -w" there is a period when the guest's open handle onto its storage is still open. This is wrong. This detection depends on us winning a tricky race. So it shows up in osstest as a very low probability heisenbug. The bug is currently in all versions of Linux and causing a bit of a nuisance. It would be best to add a proper check for this bug. However, this is quite fiddly: really, it ought to be done as close to the xl command completion as possible, in the same ssh invocation. That would involve a fair bit of plumbing and ad-hocery. I don't think that would be proportionate for such a low-impact bug. So instead in this patch I just disable this cleanup code in the troublesome case, unless it is explicitly requested by the user setting OSSTEST_GUEST_DISK_MOUNT_CLEANUP to a trueish value. (This would be reasonably convenient for the ad-hoc testing that this call serves.) Thanks to Roger for diagnosing the Linux kernel bug. CC: Roger Pau Monne CC: Jürgen Groß Signed-off-by: Ian Jackson Reviewed-by: Roger Pau Monné --- Osstest/TestSupport.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 78f47480..6b0ee7a2 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -1938,7 +1938,8 @@ sub guest_create_paused ($) { sub guest_prepare_disk ($) { my ($gho) = @_; - guest_umount_lv($gho->{Host}, $gho); + guest_umount_lv($gho->{Host}, $gho) + if $ENV{'OSSTEST_GUEST_DISK_MOUNT_CLEANUP'}; return if ($gho->{Diskfmt} // 'none') eq "none";