From nobody Sat Feb 7 05:48:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1584117369; cv=none; d=zohomail.com; s=zohoarc; b=Mgo8N/+EUxRv60YwadIrqmYLphAcaqLox682tDn5iiQfY6HhypIt5e8nRVuUL1vo33S6hDgErD+ErMTWwacAmnO7vsbgu4jOcvoePZbqOhrpD4bQfHmnMiL/Jl8Z2fmfah/ZhQPsKny0ao5m+ORvLtAuBx3zgBczzjoys/B5OVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584117369; 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=TjY0Y3l2JT59pBqVcUFtpa7NoTG1ze1pdxr7jch7oOU=; b=hCX0FaLJEA6P4/KD8y6kXpkmhMSr4INmW8h8xhIzDhRYJ1N039Cukh39cqryN352jdYxNBvIxrYXERgGB9bW/3bfs0Z3e2ndHYd0sler+BsGtNA6bnqRbdt+3QMDNGDg3wDWk8ISb1dxVGIVj1DClIcLNEYUIoh2U6jSxswsick= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1584117369383592.9395888866314; Fri, 13 Mar 2020 09:36:09 -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-37-VIRVq2b2MB6KcQJoorZdLw-1; Fri, 13 Mar 2020 12:29:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB6BA802569; Fri, 13 Mar 2020 16:29:28 +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 BAC1919757; Fri, 13 Mar 2020 16:29:28 +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 5B5B918089D5; Fri, 13 Mar 2020 16:29:28 +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 02DGT1s1010892 for ; Fri, 13 Mar 2020 12:29:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id B45741001902; Fri, 13 Mar 2020 16:29:01 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A926100164D for ; Fri, 13 Mar 2020 16:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584117368; 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=TjY0Y3l2JT59pBqVcUFtpa7NoTG1ze1pdxr7jch7oOU=; b=HQ66By7Oorvte87RTGmcqLaefPK+Pf/fCrWeA+KhEjUtTp5xSYadbol95kYKsO+ynwjD/Y m4vzRqXY97hnHHmKlDB6OeyxrU+NRUzYot74ivuLunV+v9HVt7siIMmldAKideCT0EnNZd D9nwKEO1QZaDgaMWt5XtqCPxj5rdmyo= X-MC-Unique: VIRVq2b2MB6KcQJoorZdLw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/5] qemuVirtioFSStop: Simplify daemon kill Date: Fri, 13 Mar 2020 17:28:52 +0100 Message-Id: In-Reply-To: References: 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.84 on 10.5.11.23 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" Now, that we know that the virtiofsd will have the pidfile open and locked we can use virPidFileForceCleanupPath() to kill it and unlink the pidfile. Signed-off-by: Michal Privoznik --- src/qemu/qemu_virtiofs.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index d579ce1d33..bbe93e0186 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -36,6 +36,8 @@ =20 #define VIR_FROM_THIS VIR_FROM_QEMU =20 +VIR_LOG_INIT("qemu.virtiofs"); + =20 char * qemuVirtioFSCreatePidFilename(virDomainObjPtr vm, @@ -275,28 +277,19 @@ qemuVirtioFSStop(virQEMUDriverPtr driver G_GNUC_UNUSE= D, { g_autofree char *pidfile =3D NULL; virErrorPtr orig_err; - pid_t pid =3D -1; - int rc; =20 virErrorPreserveLast(&orig_err); =20 if (!(pidfile =3D qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) goto cleanup; =20 - rc =3D virPidFileReadPathIfAlive(pidfile, &pid, NULL); - if (rc >=3D 0 && pid !=3D (pid_t) -1) - virProcessKillPainfully(pid, true); - - if (unlink(pidfile) < 0 && - errno !=3D ENOENT) { - virReportSystemError(errno, - _("Unable to remove stale pidfile %s"), - pidfile); + if (virPidFileForceCleanupPath(pidfile) < 0) { + VIR_WARN("Unable to kill virtiofsd process"); + } else { + if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) + unlink(QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock); } =20 - if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) - unlink(QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock); - cleanup: virErrorRestore(&orig_err); } --=20 2.24.1