From nobody Fri May 3 22:40:45 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524664641261590.4355612431538; Wed, 25 Apr 2018 06:57:21 -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 00B993188CC8; Wed, 25 Apr 2018 13:57:19 +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 4F1A47A25E; Wed, 25 Apr 2018 13:57:17 +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 1E3AB180596E; Wed, 25 Apr 2018 13:57:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PDvBiq008613 for ; Wed, 25 Apr 2018 09:57:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id AADBF202342F; Wed, 25 Apr 2018 13:57:11 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C6C12024CA4 for ; Wed, 25 Apr 2018 13:57:11 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id 69E4D12001E for ; Wed, 25 Apr 2018 15:57:10 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 15:57:05 +0200 Message-Id: <23b3de5a3adc3d4081dbd33acbfc2b193541371d.1524664625.git.mkletzan@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] logging: Don't inhibit shutdown 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.41]); Wed, 25 Apr 2018 13:57:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" That is a job of libvirtd and virtlogd has a dependency on it, so that will prevent it properly. Doing it one extra time in virtlogd might also cause = AVC denials because it is not allowed to call that dbus method. This basically reverts df34363d58bbf424d5c8170a93d3ad5dcd4afb26, but manual= ly due to the numerous changes since that was merged. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1547250 Signed-off-by: Martin Kletzander --- src/logging/log_daemon.c | 19 ++----------------- src/logging/log_handler.c | 28 ++++------------------------ src/logging/log_handler.h | 11 ++--------- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 35d7ebb6d2bb..9cf3fd4dbb5f 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -123,17 +123,6 @@ virLogDaemonFree(virLogDaemonPtr logd) } =20 =20 -static void -virLogDaemonInhibitor(bool inhibit, void *opaque) -{ - virLogDaemonPtr dmn =3D opaque; - - if (inhibit) - virNetDaemonAddShutdownInhibition(dmn->dmn); - else - virNetDaemonRemoveShutdownInhibition(dmn->dmn); -} - static virLogDaemonPtr virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged) { @@ -185,9 +174,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool priv= ileged) =20 if (!(logd->handler =3D virLogHandlerNew(privileged, config->max_size, - config->max_backups, - virLogDaemonInhibitor, - logd))) + config->max_backups))) goto error; =20 return logd; @@ -277,9 +264,7 @@ virLogDaemonNewPostExecRestart(virJSONValuePtr object, = bool privileged, if (!(logd->handler =3D virLogHandlerNewPostExecRestart(child, privileged, config->max_size, - config->max_back= ups, - virLogDaemonInhi= bitor, - logd))) + config->max_back= ups))) goto error; =20 return logd; diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c index 40dfa8ecaebe..6d4e539f078e 100644 --- a/src/logging/log_handler.c +++ b/src/logging/log_handler.c @@ -65,9 +65,6 @@ struct _virLogHandler { =20 virLogHandlerLogFilePtr *files; size_t nfiles; - - virLogHandlerShutdownInhibitor inhibitor; - void *opaque; }; =20 static virClassPtr virLogHandlerClass; @@ -174,7 +171,6 @@ virLogHandlerDomainLogFileEvent(int watch, return; =20 error: - handler->inhibitor(false, handler->opaque); virLogHandlerLogFileClose(handler, logfile); virObjectUnlock(handler); } @@ -183,9 +179,7 @@ virLogHandlerDomainLogFileEvent(int watch, virLogHandlerPtr virLogHandlerNew(bool privileged, size_t max_size, - size_t max_backups, - virLogHandlerShutdownInhibitor inhibitor, - void *opaque) + size_t max_backups) { virLogHandlerPtr handler; =20 @@ -198,8 +192,6 @@ virLogHandlerNew(bool privileged, handler->privileged =3D privileged; handler->max_size =3D max_size; handler->max_backups =3D max_backups; - handler->inhibitor =3D inhibitor; - handler->opaque =3D opaque; =20 return handler; =20 @@ -220,8 +212,6 @@ virLogHandlerLogFilePostExecRestart(virLogHandlerPtr ha= ndler, if (VIR_ALLOC(file) < 0) return NULL; =20 - handler->inhibitor(true, handler->opaque); - if ((path =3D virJSONValueObjectGetString(object, "path")) =3D=3D NULL= ) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'path' field in JSON document")); @@ -276,7 +266,6 @@ virLogHandlerLogFilePostExecRestart(virLogHandlerPtr ha= ndler, return file; =20 error: - handler->inhibitor(false, handler->opaque); virLogHandlerLogFileFree(file); return NULL; } @@ -286,9 +275,7 @@ virLogHandlerPtr virLogHandlerNewPostExecRestart(virJSONValuePtr object, bool privileged, size_t max_size, - size_t max_backups, - virLogHandlerShutdownInhibitor inhibitor, - void *opaque) + size_t max_backups) { virLogHandlerPtr handler; virJSONValuePtr files; @@ -297,9 +284,7 @@ virLogHandlerNewPostExecRestart(virJSONValuePtr object, =20 if (!(handler =3D virLogHandlerNew(privileged, max_size, - max_backups, - inhibitor, - opaque))) + max_backups))) return NULL; =20 if (!(files =3D virJSONValueObjectGet(object, "files"))) { @@ -349,10 +334,8 @@ virLogHandlerDispose(void *obj) virLogHandlerPtr handler =3D obj; size_t i; =20 - for (i =3D 0; i < handler->nfiles; i++) { - handler->inhibitor(false, handler->opaque); + for (i =3D 0; i < handler->nfiles; i++) virLogHandlerLogFileFree(handler->files[i]); - } VIR_FREE(handler->files); } =20 @@ -373,8 +356,6 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler, =20 virObjectLock(handler); =20 - handler->inhibitor(true, handler->opaque); - for (i =3D 0; i < handler->nfiles; i++) { if (STREQ(virRotatingFileWriterGetPath(handler->files[i]->file), path)) { @@ -429,7 +410,6 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler, error: VIR_FORCE_CLOSE(pipefd[0]); VIR_FORCE_CLOSE(pipefd[1]); - handler->inhibitor(false, handler->opaque); virLogHandlerLogFileFree(file); virObjectUnlock(handler); return -1; diff --git a/src/logging/log_handler.h b/src/logging/log_handler.h index 70be567ccc37..76df55c55e57 100644 --- a/src/logging/log_handler.h +++ b/src/logging/log_handler.h @@ -30,20 +30,13 @@ typedef struct _virLogHandler virLogHandler; typedef virLogHandler *virLogHandlerPtr; =20 =20 -typedef void (*virLogHandlerShutdownInhibitor)(bool inhibit, - void *opaque); - virLogHandlerPtr virLogHandlerNew(bool privileged, size_t max_size, - size_t max_backups, - virLogHandlerShutdownInhibitor inhibitor, - void *opaque); + size_t max_backups); virLogHandlerPtr virLogHandlerNewPostExecRestart(virJSONValuePtr child, bool privileged, size_t max_size, - size_t max_backups, - virLogHandlerShutdownInhi= bitor inhibitor, - void *opaque); + size_t max_backups); =20 void virLogHandlerFree(virLogHandlerPtr handler); =20 --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list