From nobody Thu May 16 06:01:08 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 1530676649042633.8924924458664; Tue, 3 Jul 2018 20:57:29 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A479D30001DE; Wed, 4 Jul 2018 03:57:27 +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 B22BB3844; Wed, 4 Jul 2018 03:57:26 +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 64A374A463; Wed, 4 Jul 2018 03:57:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w643uDlY024214 for ; Tue, 3 Jul 2018 23:56:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id E23B630012DB; Wed, 4 Jul 2018 03:56:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA7DA3001933 for ; Wed, 4 Jul 2018 03:56:12 +0000 (UTC) Received: from m50-112.126.com (m50-112.126.com [123.125.50.112]) by mx1.redhat.com (Postfix) with ESMTP id 9ACA33DD47 for ; Wed, 4 Jul 2018 03:56:09 +0000 (UTC) Received: from localhost.localdomain (unknown [210.13.242.135]) by smtp6 (Coremail) with SMTP id j9KowAAnf1NJRTxbwWmUAA--.28198S4; Wed, 04 Jul 2018 11:56:00 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=9Sn48SBlFgRt0GWVTg yQkkZfg855exh3ZE6WdEzaZR8=; b=I1v9ORkr2aKHbmXyMcIoYfV5yKGa6MTtxu uNAd8oRBff8tvhEjqZwe5RmGMSicNWLvaPOaWDGm9adau6B9b2zaebTXOQAGn9be qoeh51zfIvALS0mb2DYk0ZO7WF22pl838lKZC+iitvzqNCxDqh+8Y9/i4iJOansO 93r0KTkrs= From: Bobo Du To: libvir-list@redhat.com Date: Tue, 3 Jul 2018 23:55:51 -0400 Message-Id: <1530676551-60739-2-git-send-email-dubo163@126.com> In-Reply-To: <1530676551-60739-1-git-send-email-dubo163@126.com> References: <1530676551-60739-1-git-send-email-dubo163@126.com> X-CM-TRANSID: j9KowAAnf1NJRTxbwWmUAA--.28198S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKrW5tF47Wr45Xr4xZw45trb_yoWDWwcEya 4Iqa1DG3y5tFs7ZwnxXrW8Z3sxGa1UAF13trZ5AFW0krW5JF1UCFWkW39Ygr4UArWUGryD Jr4DuFW8Z3W5KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUU6uWJUUUUU== X-Originating-IP: [210.13.242.135] X-CM-SenderInfo: 5gxe0iiwt6ij2wof0z/1tbiew95MFpD5B7hZwABsZ X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 04 Jul 2018 03:56:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 04 Jul 2018 03:56:11 +0000 (UTC) for IP:'123.125.50.112' DOMAIN:'m50-112.126.com' HELO:'m50-112.126.com' FROM:'dubo163@126.com' RCPT:'' X-RedHat-Spam-Warning: 5.505 (*****) DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_ANBREP_L4, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L4, SPF_PASS X-RedHat-Spam-Score: 5.505 ***** (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_ANBREP_L4, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L4, SPF_PASS) 123.125.50.112 m50-112.126.com 123.125.50.112 m50-112.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Bobo Du 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 04 Jul 2018 03:57:28 +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: Bobo Du --- 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