From nobody Tue May 7 23:18:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1605101755; cv=none; d=zohomail.com; s=zohoarc; b=ZkZakSe2rgccc++k56hCVlGjMbLdZf8HtKe6OBbYE0EjjxmiT6CPqD9T0U+Y69U1HGFcZcswHtXQ4wj5nKUcGOOgnEfZxL8ys3U+ly2c3sopwdnEfZdcgmoytFaZYOAH3lS6PKg3eSkcOpthtm5fhM41542WDlWSdSzcVwMhDaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605101755; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=Lk9TcTD5lCNzjATys5qDirp8X8hIulmz621MaQ3unEw=; b=Nm56BhEcj5KY5I947PKzJMxH8Qx507dlrU0NEviNXbxgd46estkYW9t6RGULVdYZ797yixjmwTOZXBsimjE4Otpy02DQE+6GJEz0ddK7QJyabD2mVHYQE1tY50g4Dc3Jq+5T/bRZTAg++isrHDWMzivQUpzRP+KsXmXUbILDa5E= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605101755917993.2230255711133; Wed, 11 Nov 2020 05:35:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-5-6u5hIbPu2OVmY-WzjOVg-1; Wed, 11 Nov 2020 08:35:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B880A86ABD0; Wed, 11 Nov 2020 13:35:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CB4F5B4D0; Wed, 11 Nov 2020 13:35:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 79EED183D020; Wed, 11 Nov 2020 13:35:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ABDZdWE008841 for ; Wed, 11 Nov 2020 08:35:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 197DA2156A3A; Wed, 11 Nov 2020 13:35:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14E032157F45 for ; Wed, 11 Nov 2020 13:35:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B74D58007A4 for ; Wed, 11 Nov 2020 13:35:36 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-v_O3VgP9OQmVt9-mOQGdnw-1; Wed, 11 Nov 2020 08:35:34 -0500 Received: by mail-qk1-f193.google.com with SMTP id t191so1611800qka.4 for ; Wed, 11 Nov 2020 05:35:34 -0800 (PST) Received: from localhost (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id h4sm2093073qkh.93.2020.11.11.05.35.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2020 05:35:33 -0800 (PST) X-MC-Unique: 5-6u5hIbPu2OVmY-WzjOVg-1 X-MC-Unique: v_O3VgP9OQmVt9-mOQGdnw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Lk9TcTD5lCNzjATys5qDirp8X8hIulmz621MaQ3unEw=; b=BvUcoedBLAepJ8lbXaaG7Da0FesIgk9thMh30Teug/ebhPM7vum8Fit7hCE6Jz2vXZ KStxC8nw0HAjzoTDaH9EGYqwmqznRRQ18XLFKKuoZvDo5DHXSydTsixVlYkyPsTInH2X a0/s3UK7zNZ31YL8TptCIqBUxRFB9K5erOwbHbfH9qIlwcFGT1rCr/UXlDRCTF7WZ64i DzXDVlwpcYo4hxddfm96kj75Fo57RabBjL3fd96Wr4SXsIcE6dLEXp1T4WcYEzNVxS35 vkzgvQrlCeP+0aURYlB6xhaG/48P2SblISpuEnJkzrgqk1hcs/f8gXYgYj08O7y+Nn7T bwsQ== X-Gm-Message-State: AOAM530CPoki2Kw1KcuvP3pAANltnqBsH4ii+3IGTFtnNmbnvujFOZIf AhccLd+GtjsUbGDR1QBd9kiTKhkaxQ== X-Google-Smtp-Source: ABdhPJzWXluz+zvVG06hLe62QymvQ6uMkQMLawHmX0M8iYlx6DX+DKeY1p0xG+7np3XG+Xjqd5mN0w== X-Received: by 2002:a05:620a:1647:: with SMTP id c7mr16268079qko.455.1605101733862; Wed, 11 Nov 2020 05:35:33 -0800 (PST) From: Masayoshi Mizuma To: libvir-list@redhat.com Subject: [PATCH v2] qemu: Move qemuExtDevicesStop() before removing the pidfiles Date: Wed, 11 Nov 2020 08:35:24 -0500 Message-Id: <20201111133524.31076-1-msys.mizuma@gmail.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Masayoshi Mizuma , Masayoshi Mizuma X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Masayoshi Mizuma A qemu guest which has virtiofs config fails to start if the previous starting failed because of invalid option or something. That's because the virtiofsd isn't killed by virPidFileForceCleanupPath() on the former failure because the pidfile was already removed by virFileDeleteTree(priv->libDir) in qemuProcessStop(), so virPidFileForceCleanupPath() just returned. Move qemuExtDevicesStop() before virFileDeleteTree(priv->libDir) so that virPidFileForceCleanupPath() can kill virtiofsd correctly. For example of the reproduction: # virsh start guest error: Failed to start domain guest error: internal error: process exited while connecting to monitor: qemu-s= ystem-x86_64: -foo: invalid option ... fix the option ... # virsh start guest error: Failed to start domain guest error: Cannot open log file: '/var/log/libvirt/qemu/guest-fs0-virtiofsd.l= og': Device or resource busy # Signed-off-by: Masayoshi Mizuma Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0a36b49c85..1963de9fb8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7638,6 +7638,8 @@ void qemuProcessStop(virQEMUDriverPtr driver, /* Do this before we delete the tree and remove pidfile. */ qemuProcessKillManagedPRDaemon(vm); =20 + qemuExtDevicesStop(driver, vm); + virFileDeleteTree(priv->libDir); virFileDeleteTree(priv->channelTargetDir); =20 @@ -7654,8 +7656,6 @@ void qemuProcessStop(virQEMUDriverPtr driver, =20 qemuDomainCleanupRun(driver, vm); =20 - qemuExtDevicesStop(driver, vm); - qemuDBusStop(driver, vm); =20 vm->def->id =3D -1; --=20 2.27.0