From nobody Sun May 5 02:15:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598158347; cv=none; d=zohomail.com; s=zohoarc; b=Tc02AqEhgh5WhyYG4W5dtJ1OS5qUWYIg8q3pQV0zeer30r3QXn7+cO1sOzb9pRgzFWcVyo59PIEJ7L/CEsMKG+9bPY1V+vVmVjsYL6J1NAZNcNLHmnLxbD+R9/XvxGfN3ZBSVURGQMdPyjJDE8xibXoD07hu/86B97HP4mLbvnE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598158347; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=aBAOtyqEmGXTE6xH26qSWR9qp3suALo+/AChVsKGswE=; b=c/acPsonIHjElqmmf4luwHPfTJvREN8abc+m/WFA1TX/GpbmF9yugqxNF64e4Bml48hX/uaUfy6iXFnZyPGk12ZjdOIdY3FEL8HdOTFQXVPQGfyr90ZnmvrFMZBhdAHVFJ/C0AeVNcK1L+57lM+nrxsaRxQzvnP+S72U1BtX4FQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 159815834667962.272372734569785; Sat, 22 Aug 2020 21:52:26 -0700 (PDT) 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-456-MweU3az-MDqXav7xjl6TWA-1; Sun, 23 Aug 2020 00:52:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E45712FD05; Sun, 23 Aug 2020 04:52:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D92A05DA85; Sun, 23 Aug 2020 04:52:12 +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 C01F06037E; Sun, 23 Aug 2020 04:52:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07N4q3Sm032169 for ; Sun, 23 Aug 2020 00:52:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 341E71014176; Sun, 23 Aug 2020 04:52:03 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-64.phx2.redhat.com [10.3.113.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1A55100AE5C for ; Sun, 23 Aug 2020 04:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598158345; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aBAOtyqEmGXTE6xH26qSWR9qp3suALo+/AChVsKGswE=; b=NzFTjO2GEh3CLzJ/dI6+20SGFK9VcEREv+L2DCXOr92W+84c+Tg1jcZ87sYmADMVAyvl1y Cyc5lCI3TLe2m15ThWlWd0sYtVbN/E25KiiOf+xy4vJ9EfzBx60/qmJJL8NGVuDszKOcGG 1tDKexdtSQOpI8G6kRal9YtyUcXY9aU= X-MC-Unique: MweU3az-MDqXav7xjl6TWA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: remove unreachable code in qemuProcessStart() Date: Sun, 23 Aug 2020 00:51:57 -0400 Message-Id: <20200823045157.588217-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Back when the original version of this chunk of code was added (commit 41b087198 in libvirt-0.8.1 in April 2010), we used virExecDaemonize() to start the qemu process, and would continue on in the function (which at that time was called qemudStartVMDaemon()) even if a -1 was returned. So it was possible to get to this code with rv =3D=3D -1 (it was called "ret" in that version of the code). In modern libvirt code, qemu is started with virCommandRun(); then we call virPidFileReadPath(); those are the only two ways of setting "rv" prior to this code being removed, and in either case if the new value of rv < 0, then we immediately skip over the rest of the code to the cleanup: label. This means that the code being removed by this patch is unreachable. (NB: anyway, attempting to fend off accidental removal of some other guest's nwfilter rules by carefully ordering all nwfilter teardowns to happen "before tap device deletion" is a fruitless pursuit, because a tap device could be deleted by the qemu process being terminated external to libvirt, i.e. we must instead avoid re-using tap device names. That is coming.) Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 126fabf5ef..832b2e6870 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6907,12 +6907,6 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; VIR_DEBUG("Handshake complete, child running"); =20 - if (rv =3D=3D -1) { - /* The VM failed to start; tear filters before taps */ - virDomainConfVMNWFilterTeardown(vm); - goto cleanup; - } - if (qemuDomainObjStartWorker(vm) < 0) goto cleanup; =20 --=20 2.26.2