From nobody Wed May 15 15:21:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530669537672280.43319716199596; Tue, 3 Jul 2018 18:58:57 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id E78A9820E7; Wed, 4 Jul 2018 01:58:55 +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 0BCF960177; Wed, 4 Jul 2018 01:58:54 +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 C026E4A463; Wed, 4 Jul 2018 01:58:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w641wl8s009863 for ; Tue, 3 Jul 2018 21:58:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 544F160177; Wed, 4 Jul 2018 01:58:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CF1660175 for ; Wed, 4 Jul 2018 01:58:44 +0000 (UTC) Received: from m50-110.126.com (m50-110.126.com [123.125.50.110]) by mx1.redhat.com (Postfix) with ESMTP id 28BAC5F729 for ; Wed, 4 Jul 2018 01:58:41 +0000 (UTC) Received: from localhost.localdomain (unknown [210.13.242.135]) by smtp4 (Coremail) with SMTP id jdKowACXRCmTKTxbmxy8AQ--.36S4; Wed, 04 Jul 2018 09:58:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=sv9FHP9Gl6at4ZX+8j 6sFWJqIyxrURND07IRj8tp1/0=; b=DG5ue1qDoc0SRWlMgE0UuxMY8APPytEAAH UalvAHiQMfFGjXyLm81f9UKXcOxSBx3v/zxQnjbg4niXwKYEs/5cx6UXY4w3AG/3 5a4p7aZrKYZOMMX8GlaOJbChGMCTp0lHLGi+vguabunomciV69QvMc6Eq0aR5JdC P79/XfiFw= From: dubobo To: libvir-list@redhat.com Date: Tue, 3 Jul 2018 21:57:37 -0400 Message-Id: <1530669457-32992-2-git-send-email-dubo163@126.com> In-Reply-To: <1530669457-32992-1-git-send-email-dubo163@126.com> References: <1530669457-32992-1-git-send-email-dubo163@126.com> X-CM-TRANSID: jdKowACXRCmTKTxbmxy8AQ--.36S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKrW5tF47Wr45Xr43Gr1fCrg_yoWDWwcEya 40va1DK3yrtanrZwnxXrW8Z3sxKa15JF13trZ5AFW0krW5JF1UCFWkW39Ygr4UCrWUGr1D Ar4DuFW8Z3W5KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUU6uWJUUUUU== X-Originating-IP: [210.13.242.135] X-CM-SenderInfo: 5gxe0iiwt6ij2wof0z/1tbieg55MFpD5Bn9DwAAsr X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Jul 2018 01:58:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 04 Jul 2018 01:58:43 +0000 (UTC) for IP:'123.125.50.110' DOMAIN:'m50-110.126.com' HELO:'m50-110.126.com' FROM:'dubo163@126.com' RCPT:'' X-RedHat-Spam-Score: 5.305 ***** (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_ANBREP_L3, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L3, SPF_PASS) 123.125.50.110 m50-110.126.com 123.125.50.110 m50-110.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: dubobo Subject: [libvirt] [PATCH] util:Fix with process number and pid file do not match 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Jul 2018 01:58:56 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" the libvirtd pid file is not match the os process pid number which is smaller than before. this would be exist if the libvirtd process coredump or the os process was killed which the next pid number is smaller. you can be also edit the pid file to write the longer number than before,then restart the libvirtd service. Signed-off-by: dubobo --- src/util/virpidfile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 58ab29f..1a85d43 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -446,6 +446,14 @@ int virPidFileAcquirePath(const char *path, =20 snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid); =20 + if (ftruncate(fd, 0) < 0) { + virReportSystemError(errno, + _("Failed to truncate pid file '%s'"), + path); + VIR_FORCE_CLOSE(fd); + return -1; + } + if (safewrite(fd, pidstr, strlen(pidstr)) < 0) { virReportSystemError(errno, _("Failed to write to pid file '%s'"), --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list