From nobody Thu May 16 06:51:32 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 1530618733328275.6254224978088; Tue, 3 Jul 2018 04:52:13 -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 D8C7381E07; Tue, 3 Jul 2018 11:52:11 +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 790CA60177; Tue, 3 Jul 2018 11:52:11 +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 0D3B03F7FA; Tue, 3 Jul 2018 11:52:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w63Bq9Oc002404 for ; Tue, 3 Jul 2018 07:52:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id B472018E2D; Tue, 3 Jul 2018 11:52:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA77E18E26 for ; Tue, 3 Jul 2018 11:52:06 +0000 (UTC) Received: from m50-112.126.com (m50-112.126.com [123.125.50.112]) by mx1.redhat.com (Postfix) with ESMTP id 40400308FBA0 for ; Tue, 3 Jul 2018 11:52:01 +0000 (UTC) Received: from localhost.localdomain (unknown [210.13.242.135]) by smtp6 (Coremail) with SMTP id j9KowAD3S4xIYztbljBaAA--.9454S4; Tue, 03 Jul 2018 19:51:55 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=XASpuXSwf6vPEsOmV6 mOwnPj7VkQzZrDoALiz/618o0=; b=mtHkKTTR4ZzqqSK6ppHdVm6ZyzatJGlI8u e01ZqxfnQsj7Kqe6zpLWAkacaJIRg+wX6btghfdj/XOoNde981AbI92w8kcKxDFD 6lQ+78/OvBmWqUhTJWalU3GgLY9hKZCH6ic4zLJg8eOr6F764Iw5FhNbtEXJV5lq KwrhlzItE= From: dubo163 To: libvir-list@redhat.com Date: Tue, 3 Jul 2018 07:51:34 -0400 Message-Id: <1530618694-10291-2-git-send-email-dubo163@126.com> In-Reply-To: <1530618694-10291-1-git-send-email-dubo163@126.com> References: <1530618694-10291-1-git-send-email-dubo163@126.com> X-CM-TRANSID: j9KowAD3S4xIYztbljBaAA--.9454S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKrW5tF47Wr45Xr43JFy7Jrb_yoWDArbEya 40qa1DG3yrtanrZwnxXrWrZ3sxKa1UJF13trZ5AFW0krW5JF1UCFWkW39Ygr4UArWUGr1D Ar4DuFW8Za15KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUqjg7UUUUU== X-Originating-IP: [210.13.242.135] X-CM-SenderInfo: 5gxe0iiwt6ij2wof0z/1tbi1Bt4MFpD5mhhWwAAsq X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 03 Jul 2018 11:52:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 03 Jul 2018 11:52:05 +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.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: dubo163 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.25]); Tue, 03 Jul 2018 11:52:12 +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: dubo163 --- 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