From nobody Mon Feb 9 00:55:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1595411104; cv=none; d=zohomail.com; s=zohoarc; b=Ohz1LBBdw+8pPjNOSwNq/+CWZrXQTIwH5ROd5s8NwYjZo7ZArnfMzHWBNiVjeachgZyu2jg3MFrXU9SWkIBV0/dzrxGqE4Hne8V62e+GK4xA8bQtuJaScuhNcMVz9iFvMWpeifzo7ecK6gXwgAFqkWyCdFL74ez5HTxLTkmKXcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595411104; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qJ4z+zjRK1voU+HL1qGjSLnvXfdv5TyTPRWjJaMcgtY=; b=hHi60LsnZgrl+3uUlPE6KsfCvS6DuRzOiJJHzI1NgWGZiKfyWPNnFCaXqNC7+vgT7FvOhB9oZ1WZUteztd4s0I3H5/WsZiFqIfQxaDFYaJ1J0TavdO8V/5lw/Mke9Alfr518/YMaWTSi5P0GnFGoR/jhKEISjY/7s13oIZB+hu4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159541110480727.141880977023106; Wed, 22 Jul 2020 02:45:04 -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-321-_a6_8RvzOYaD9szzc1AV6Q-1; Wed, 22 Jul 2020 05:44:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CCB318C63C9; Wed, 22 Jul 2020 09:44:14 +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 2FE5469327; Wed, 22 Jul 2020 09:44:14 +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 F2661730EB; Wed, 22 Jul 2020 09:44:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06M9fEQf001140 for ; Wed, 22 Jul 2020 05:41:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id C88512DE7F; Wed, 22 Jul 2020 09:41:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 481822DE81 for ; Wed, 22 Jul 2020 09:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595411103; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qJ4z+zjRK1voU+HL1qGjSLnvXfdv5TyTPRWjJaMcgtY=; b=T6DHXG9110p60cnQZiz7Ezwj0ZqrGNvqxvtnOTj0NO6chXgm56ke3x9GRuB9ErZ7c9prNp sLx6X4vffwSF6iHbV5RsvrksZUzj9M+Sb2ijzQ8MSsSusfSR2tZlUtV0GATRUE/VbWIbPg JCZPxq4bcf3ix28jaWueO+nGO0afvSo= X-MC-Unique: _a6_8RvzOYaD9szzc1AV6Q-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 30/34] qemuDomainNamespaceTeardownHostdev: Unlink paths in one go Date: Wed, 22 Jul 2020 11:40:24 +0200 Message-Id: <07c4b024d25b1cfd4dc32289e45e657f81a29b03.1595410402.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In my attempt to deduplicate the code, we can use qemuDomainSetupHostdev() to obtain the list of paths to unlink and then pass it to qemuDomainNamespaceUnlinkPaths() to unlink them in a single fork. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_namespace.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namesp= ace.c index 135842e212..8251554e73 100644 --- a/src/qemu/qemu_domain_namespace.c +++ b/src/qemu/qemu_domain_namespace.c @@ -1451,20 +1451,18 @@ int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - g_autofree char *path =3D NULL; + VIR_AUTOSTRINGLIST paths =3D NULL; =20 if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; =20 - if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0) + if (qemuDomainSetupHostdev(vm, + hostdev, + true, + &paths) < 0) return -1; =20 - if (path && qemuDomainNamespaceUnlinkPath(vm, path) < 0) - return -1; - - if (qemuHostdevNeedsVFIO(hostdev) && - !qemuDomainNeedsVFIO(vm->def) && - qemuDomainNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0) + if (qemuDomainNamespaceUnlinkPaths(vm, (const char **) paths) < 0) return -1; =20 return 0; --=20 2.26.2