From nobody Mon May 13 00:43:29 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 1530529871632481.3632319799384; Mon, 2 Jul 2018 04:11:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 512A26FAA3; Mon, 2 Jul 2018 11:11:09 +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 594052010CA4; Mon, 2 Jul 2018 11:11:08 +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 202C218037ED; Mon, 2 Jul 2018 11:11:06 +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 w62B8nEh013686 for ; Mon, 2 Jul 2018 07:08:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 41FDF6147; Mon, 2 Jul 2018 11:08:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39E5316D23 for ; Mon, 2 Jul 2018 11:08:46 +0000 (UTC) Received: from m50-111.126.com (m50-111.126.com [123.125.50.111]) by mx1.redhat.com (Postfix) with ESMTP id 3422F356C0 for ; Mon, 2 Jul 2018 11:08:44 +0000 (UTC) Received: from localhost.localdomain (unknown [210.13.242.135]) by smtp5 (Coremail) with SMTP id jtKowADX2jyvBzpb6qnjAA--.247S4; Mon, 02 Jul 2018 19:08:41 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=U2fLN5uh+qA4EPvr3X sXGV/aEMOkQSB1HOk0FcFbRZ8=; b=KzZIi/ZRWGpd2/V+6ML2Gdwz3onXfHXMk+ 1HCCZ4/BA+NPLIsKL219gh6vCXsN/b0FpydRreGH7A+W1mMSn9IanUu5Zt/PQlBs 5SLR7e54RJD/4PXdoUwIDHSHFzzt+fkplxF43dWwOBPSrxlvWaGHZW+i2x4Y8ZNN V5sy98eHU= From: dubo163 To: libvir-list@redhat.com Date: Mon, 2 Jul 2018 07:08:15 -0400 Message-Id: <1530529695-36951-2-git-send-email-dubo163@126.com> In-Reply-To: <1530529695-36951-1-git-send-email-dubo163@126.com> References: <1530529695-36951-1-git-send-email-dubo163@126.com> X-CM-TRANSID: jtKowADX2jyvBzpb6qnjAA--.247S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKrWrZF4Utr4ktw4rXry7KFg_yoWDJrcEya 4vvF4DK3y5tan2y3sIqF4fZ3sxKayrZFy3trn3AFW0krW5JF1UAayku395WrWUurWUGr1D Jan8uFW8Zan8KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU0ov3UUUUUU== X-Originating-IP: [210.13.242.135] X-CM-SenderInfo: 5gxe0iiwt6ij2wof0z/1tbikBV3MFpD5BrOdwABsd X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Jul 2018 11:08:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Jul 2018 11:08:45 +0000 (UTC) for IP:'123.125.50.111' DOMAIN:'m50-111.126.com' HELO:'m50-111.126.com' FROM:'dubo163@126.com' RCPT:'' X-RedHat-Spam-Score: 4.259 **** (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_ANBREP_L4, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L4, SPF_PASS) 123.125.50.111 m50-111.126.com 123.125.50.111 m50-111.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 02 Jul 2018 07:10:19 -0400 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 02 Jul 2018 11:11:10 +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" From: dubobo 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 58ab29f..8b0ff99 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -445,6 +445,12 @@ int virPidFileAcquirePath(const char *path, } =20 snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid); + if (ftruncate(fd, 0) < 0) { + VIR_FORCE_CLOSE(fd); + return -1; + } + + lseek(fd, 0, SEEK_SET); =20 if (safewrite(fd, pidstr, strlen(pidstr)) < 0) { virReportSystemError(errno, --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list