diff --git a/1509-fix-journal-file-descriptors-leak-problems.patch b/1509-fix-journal-file-descriptors-leak-problems.patch deleted file mode 100644 index 59e89df219096e02fa1d3bc9c77a600eeeb87abb..0000000000000000000000000000000000000000 --- a/1509-fix-journal-file-descriptors-leak-problems.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 4f8cec1924bf00532f5350d9a4d7af8e853241fe Mon Sep 17 00:00:00 2001 -From: huangkaibin -Date: Thu, 28 Jun 2018 20:23:45 +0800 -Subject: [PATCH] systemd-journald: Fix journal file descriptors leak problems. - -Journal files opened and then be removed by external programs(for example, the journal rotation -of systemd-journald will removed jounal files) before journal directory notify watching is added -will not be closed properly. This patch fix this problem by removing and closing these deleted journal files -after notify watching is added. ---- - src/journal/sd-journal.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c -index 80cd80f356..de2ad4607d 100644 ---- a/src/journal/sd-journal.c -+++ b/src/journal/sd-journal.c -@@ -1578,6 +1578,18 @@ fail: - log_debug_errno(errno, "Failed to enumerate directory %s, ignoring: %m", m->path); - } - -+static void remove_nonexistent_journal_files(sd_journal *j) { -+ Iterator i; -+ JournalFile *f = NULL; -+ ORDERED_HASHMAP_FOREACH(f, j->files, i) { -+ if(f->path && access(f->path, F_OK) < 0) { -+ log_debug("Remove not-existed file from the journal map: %s", f->path); -+ /*Its OK to remove entry from the hashmap although we are iterating on it.*/ -+ remove_file_real(j, f); -+ } -+ } -+} -+ - static void directory_watch(sd_journal *j, Directory *m, int fd, uint32_t mask) { - int r; - -@@ -1606,6 +1618,14 @@ static void directory_watch(sd_journal *j, Directory *m, int fd, uint32_t mask) - (void) inotify_rm_watch(j->inotify_fd, m->wd); - m->wd = -1; - } -+ -+ /* -+ * Before event watching, there were some files opened and if some of these opened files were -+ * deleted due to the journal rotation of systemd-jounald, they will become leaking files and will -+ * never be closed until the process exited. -+ * So here we remove these deleted files from the journal after event watching. -+ */ -+ remove_nonexistent_journal_files(j); - } - - static int add_directory( --- -2.23.0 - diff --git a/1602-activation-service-must-be-restarted-when-reactivated.patch b/1602-activation-service-must-be-restarted-when-reactivated.patch deleted file mode 100644 index a71eaa857c33af7dab199596c44a4fe2d848992f..0000000000000000000000000000000000000000 --- a/1602-activation-service-must-be-restarted-when-reactivated.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 4acc8a3168e5f11b5308cf8558d68bf2a0503444 Mon Sep 17 00:00:00 2001 -From: huangkaibin -Date: Mon, 7 Aug 2017 17:06:30 +0800 -Subject: [PATCH] systemd: Activation service must be restarted when it is already started and re-actived -by dbus - -When dbus-daemon service is killed, every activation service must be restarted -to reestblished dbus connection between dbus-daemon and the service. -Otherwise, there will be problem on the dbus connection. This patch fix this -problem by set JobType to JOB_RESTART when it is re-actived in signal_activation_request function. ---- - src/core/dbus.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/src/core/dbus.c b/src/core/dbus.c -index 29524d4..38940ef 100644 ---- a/src/core/dbus.c -+++ b/src/core/dbus.c -@@ -152,6 +152,8 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd - const char *name; - Unit *u; - int r; -+ int jobtype; -+ Service *s = NULL; - - assert(message); - assert(m); -@@ -177,7 +179,13 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd - goto failed; - } - -- r = manager_add_job(m, JOB_START, u, JOB_REPLACE, NULL, &error, NULL); -+ jobtype = JOB_START; -+ s = SERVICE(u); -+ if(s && s->state != SERVICE_DEAD) { -+ jobtype = JOB_RESTART; -+ log_unit_info(u, "Service '%s' will be restarted to activate the service. The current service state is %d.", u->id, s->state); -+ } -+ r = manager_add_job(m, jobtype, u, JOB_REPLACE, NULL, &error, NULL); - if (r < 0) - goto failed; - --- -1.8.3.1 diff --git a/1605-systemd-core-fix-problem-of-dbus-service-can-not-be-started.patch b/1605-systemd-core-fix-problem-of-dbus-service-can-not-be-started.patch deleted file mode 100644 index 5075453c38dba1b068dff70f09c0254bfaf09855..0000000000000000000000000000000000000000 --- a/1605-systemd-core-fix-problem-of-dbus-service-can-not-be-started.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bf589755bd5b084f1b5dd099ea3e4917ac9911fd Mon Sep 17 00:00:00 2001 -From: huangkaibin -Date: Thu, 14 Sep 2017 12:54:01 +0800 -Subject: [PATCH] systemd-core: fix problem of dbus service can not be started - when dbus is dead and state of system dbus of systemd stay in - BUS_AUTHENTICATING. - -When systemd starts a dbus communication, it will first authenticate the bus by communicating with polkitd service, and then enter running state. -But if authenticating can not be establised within 25s(default timeout seconds) since authenticating starts -(maybe caused by polkitd service or dbus service can not be activated in time), the dbus state in systemd side will stays in BUS_AUTHENTICATING state, -and systemd will enter a mad state that it will handle authenticating(in bus_process_internal function) very frequently and will have no any change to -service for events of restarting services(by systemctl restart dbus.service --no-ask-password --no-block). So that the dbus service will never be restarted successfully. -systemd will enter such a state is caused by the timeout setting in sd_bus_get_timeout function. When in BUS_AUTHENTICATING state, the timeout is set -to a fix value of bus->auth_timeout(authenticating start time + 25s), if auth_timeout is an expired time, but not a furture time, systemd will always service -for the callback of function of dbus(time_callback) with no any delay when it got its chance, and leave no chance for events of restarting services. -This patch fix this problem by fixing the timeout to a furture time when bus->auth_timeout is expired. ---- - src/libsystemd/sd-bus/sd-bus.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c -index b0a3237..ca626d3 100644 ---- a/src/libsystemd/sd-bus/sd-bus.c -+++ b/src/libsystemd/sd-bus/sd-bus.c -@@ -2267,7 +2267,11 @@ _public_ int sd_bus_get_timeout(sd_bus *bus, uint64_t *timeout_usec) { - switch (bus->state) { - - case BUS_AUTHENTICATING: -- *timeout_usec = bus->auth_timeout; -+ //delay 1 second to ensure it is a furture time but not an expired time -+ if(bus->auth_timeout <= now(CLOCK_MONOTONIC)) -+ *timeout_usec = now(CLOCK_MONOTONIC) + USEC_PER_SEC; -+ else -+ *timeout_usec = bus->auth_timeout; - return 1; - - case BUS_RUNNING: --- -1.8.3.1 - diff --git a/1610-add-new-rules-for-lower-priority-events-to-preempt.patch b/1610-add-new-rules-for-lower-priority-events-to-preempt.patch deleted file mode 100644 index 8715946f1fc36d41d6ed338bdce9ce4b2765216b..0000000000000000000000000000000000000000 --- a/1610-add-new-rules-for-lower-priority-events-to-preempt.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 49f6a75e648c113fa9985675f47f78a4cd57c084 Mon Sep 17 00:00:00 2001 -From: yangbin -Date: Fri, 26 Jul 2019 10:02:58 +0800 -Subject: [PATCH] systemd-core: Add new rules for lower priority events to - preempt over higher priority events - -1. When a high priority event happenes very frequent, and this event takes long time for execution,systemd will get into busy for handling this event only, and lower priority events will have no any change to dispatch and run. - -2. One example is the event for /proc/self/mountinfo, which have a very high priority with -10. -When there are many mountpoints in mountinfo(for example, there may be many netns mountpoints),this event will take long time to finish. -Then if now there are mountpoints in repeating mounting and unmounting(for example, /run/user/uid mountpoint will be mounted then unmounted when for one su command), -this event will take all time of systemd, and lower priority lower events will not be dispatched anyway. -This will case a very severity problem that zombie process will not be reaped, for the evnet for reaping zombies has a lower priority of -6. - -3. This patch fix this problem by add the following rules to allow lower priority events to preempt over higher priority events. -a) If a higher priority event has already been execute for a certain count in consecutive, it can be preempted by lower priority events. The default value for this count is 10, and can be configured through 'sd_event_source_set_preempt_dispatch_count'. -b) If a lower priority gets into pending for 10 times in consecutive, it can preempt over higher priority events. -c) If a lower priority is in pending, and is not dispatched over 50 iteration, it can preempt over higher priority events. -d) The above rules only works for events with priority equal or higher than 'SD_EVENT_PRIORITY_NORMAL' or evnets with type of SOURCE_DEFER, since SOURCE_DEFER events is used for job running queues. ---- - src/core/mount.c | 4 ++ - src/libsystemd/sd-event/sd-event.c | 87 ++++++++++++++++++++++++++++++ - src/systemd/sd-event.h | 1 + - 3 files changed, 92 insertions(+) - -diff --git a/src/core/mount.c b/src/core/mount.c -index 1b94ab4..78b6e30 100644 ---- a/src/core/mount.c -+++ b/src/core/mount.c -@@ -1742,6 +1742,10 @@ static void mount_enumerate(Manager *m) { - goto fail; - } - -+ r = sd_event_source_set_preempt_dispatch_count(m->mount_event_source, 5); -+ if (r < 0) -+ goto fail; -+ - (void) sd_event_source_set_description(m->mount_event_source, "mount-monitor-dispatch"); - } - -diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c -index d53b9a7..7e33061 100644 ---- a/src/libsystemd/sd-event/sd-event.c -+++ b/src/libsystemd/sd-event/sd-event.c -@@ -26,6 +26,11 @@ - #include "time-util.h" - #include "util.h" - -+#define DEFAULT_PREEMPTED_ITERATION_COUNT (3) -+#define DEFAULT_PREEMPT_DISPATCH_COUNT (10) -+#define DEFAULT_PREEMPT_PENDING_COUNT (10) -+#define DEFAULT_PREEMPT_ITERATION_COUNT (30) -+ - #define DEFAULT_ACCURACY_USEC (250 * USEC_PER_MSEC) - - typedef enum EventSourceType { -@@ -103,6 +108,11 @@ struct sd_event_source { - uint64_t pending_iteration; - uint64_t prepare_iteration; - -+ uint64_t preempted_iteration; /*The iteration that dispatched_count is greater than preempt_dispatch_count*/ -+ unsigned pending_count; /*times of pending not dispatched*/ -+ unsigned dispatched_count; /*consecutive dispatched count*/ -+ unsigned preempt_dispatch_count; /*Will be preempted by lower priority if dispatched count reaches to this*/ -+ - sd_event_destroy_t destroy_callback; - - LIST_FIELDS(sd_event_source, sources); -@@ -301,6 +311,11 @@ struct sd_event { - - LIST_HEAD(sd_event_source, sources); - -+ /*last dispatched source, its type is sd_event_source, -+ * here use void to avoid accessing its members, -+ * for it may have been freed already.*/ -+ void *last_source; -+ - usec_t last_run, last_log; - unsigned delays[sizeof(usec_t) * 8]; - }; -@@ -314,8 +329,42 @@ static sd_event *event_resolve(sd_event *e) { - return e == SD_EVENT_DEFAULT ? default_event : e; - } - -+static int preempt_prioq_compare(const sd_event_source *x, const sd_event_source *y) { -+ if((x->priority > SD_EVENT_PRIORITY_NORMAL && x->type != SOURCE_DEFER) -+ || (y->priority > SD_EVENT_PRIORITY_NORMAL && y->type != SOURCE_DEFER)) { -+ return 0; /*only high priority evnets can preempt*/ -+ } -+ -+ if(x->priority <= y->priority) { -+ if(x->dispatched_count >= x->preempt_dispatch_count) -+ return 1; -+ if(y->type != SOURCE_DEFER) { /*pending state for defer event is always true*/ -+ /*y has lower priority, but its pending count is greater than x, so y wins*/ -+ if(y->pending_count >= (x->pending_count + DEFAULT_PREEMPT_PENDING_COUNT)) -+ return 1; -+ /*y has lower priority, but is in pending longer than x, so y wins*/ -+ if(x->pending_iteration >= (y->pending_iteration + DEFAULT_PREEMPT_ITERATION_COUNT)) -+ return 1; -+ } -+ } else { -+ if(y->dispatched_count >= y->preempt_dispatch_count) -+ return -1; -+ if(x->type != SOURCE_DEFER) { /*pending state for defer event is always true*/ -+ /*x has lower priority, but its pending count is greater than y, so x wins*/ -+ if(x->pending_count >= (y->pending_count + DEFAULT_PREEMPT_PENDING_COUNT)) -+ return -1; -+ /*x has lower priority, but is in pending longer than y, so x wins*/ -+ if(y->pending_iteration >= (x->pending_iteration + DEFAULT_PREEMPT_ITERATION_COUNT)) -+ return -1; -+ } -+ } -+ -+ return 0; -+} -+ - static int pending_prioq_compare(const void *a, const void *b) { - const sd_event_source *x = a, *y = b; -+ int r; - - assert(x->pending); - assert(y->pending); -@@ -326,6 +375,10 @@ static int pending_prioq_compare(const void *a, const void *b) { - if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF) - return 1; - -+ r = preempt_prioq_compare(a, b); -+ if(r) -+ return r; -+ - /* Lower priority values first */ - if (x->priority < y->priority) - return -1; -@@ -1030,6 +1083,17 @@ static int source_set_pending(sd_event_source *s, bool b) { - assert(s); - assert(s->type != SOURCE_EXIT); - -+ if (b && s->pending == b) -+ s->pending_count++; -+ else -+ s->pending_count = (b ? 1 : 0); -+ if (b && s->preempted_iteration && -+ (s->pending_count >= DEFAULT_PREEMPTED_ITERATION_COUNT || -+ s->event->iteration >= (s->preempted_iteration + DEFAULT_PREEMPTED_ITERATION_COUNT)) ) { -+ s->dispatched_count = 0; -+ s->preempted_iteration = 0; -+ } -+ - if (s->pending == b) - return 0; - -@@ -1097,6 +1161,7 @@ static sd_event_source *source_new(sd_event *e, bool floating, EventSourceType t - .type = type, - .pending_index = PRIOQ_IDX_NULL, - .prepare_index = PRIOQ_IDX_NULL, -+ .preempt_dispatch_count = DEFAULT_PREEMPT_DISPATCH_COUNT, - }; - - if (!floating) -@@ -2263,6 +2328,7 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) { - return r; - } - -+ s->pending_count = 0; - switch (s->type) { - - case SOURCE_IO: -@@ -3055,6 +3121,19 @@ static int process_inotify(sd_event *e) { - return done; - } - -+static void source_dispatch_pre(sd_event_source *s) { -+ if(s->event->last_source == s) { -+ s->dispatched_count++; -+ if(s->dispatched_count >= s->preempt_dispatch_count) -+ s->preempted_iteration = s->event->iteration; -+ } else { -+ s->preempted_iteration = 0; -+ s->dispatched_count = 0; -+ } -+ s->event->last_source = s; -+ s->pending_count = 0; -+} -+ - static int source_dispatch(sd_event_source *s) { - EventSourceType saved_type; - int r = 0; -@@ -3095,6 +3174,7 @@ static int source_dispatch(sd_event_source *s) { - return r; - } - -+ source_dispatch_pre(s); - s->dispatching = true; - - switch (s->type) { -@@ -3793,3 +3873,10 @@ _public_ int sd_event_source_get_destroy_callback(sd_event_source *s, sd_event_d - - return !!s->destroy_callback; - } -+ -+_public_ int sd_event_source_set_preempt_dispatch_count(sd_event_source *s, unsigned count) { -+ assert_return(s, -EINVAL); -+ -+ s->preempt_dispatch_count = count; -+ return 0; -+} -diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h -index 7fcae4a..fdf9108 100644 ---- a/src/systemd/sd-event.h -+++ b/src/systemd/sd-event.h -@@ -143,6 +143,7 @@ int sd_event_source_get_child_pid(sd_event_source *s, pid_t *pid); - int sd_event_source_get_inotify_mask(sd_event_source *s, uint32_t *ret); - int sd_event_source_set_destroy_callback(sd_event_source *s, sd_event_destroy_t callback); - int sd_event_source_get_destroy_callback(sd_event_source *s, sd_event_destroy_t *ret); -+int sd_event_source_set_preempt_dispatch_count(sd_event_source *s, unsigned count); - - /* Define helpers so that __attribute__((cleanup(sd_event_unrefp))) and similar may be used. */ - _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_event, sd_event_unref); --- -2.17.1 - diff --git a/1619-delay-to-restart-when-a-service-can-not-be-auto-restarted.patch b/1619-delay-to-restart-when-a-service-can-not-be-auto-restarted.patch deleted file mode 100644 index c362dde60230cf90eaa8cf7c8aa74315c1096c93..0000000000000000000000000000000000000000 --- a/1619-delay-to-restart-when-a-service-can-not-be-auto-restarted.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 9315c29e4fdfa19c90bb483a364b017881f5cef7 Mon Sep 17 00:00:00 2001 -From: huangkaibin -Date: Sat, 21 Apr 2018 17:18:19 +0800 -Subject: [PATCH] systemd-core: Delay to restart when a service can not be - auto-restarted when there is one STOP_JOB for the service - -When a service current has a STOP job has not scheduled yet, -and also if the service is already scheduled with an auto-restart -with restart-second configured as 0, the service will not be restarted successfully, -and systemd will go into an endless loop to restart the service. -This is because restart-second is 0 and timer task has higher priority than IO tasks when there priority -is same(both with 0), so the STOP job has no chance to be scheduled, and systemd will go into the endless loop -to handle the time task. -This patch fix this problem by delaying 1 second to restart the service to cause STOP job to be scheduled. ---- - src/core/service.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/core/service.c b/src/core/service.c -index 340b655059..fba3b3a3f1 100644 ---- a/src/core/service.c -+++ b/src/core/service.c -@@ -2264,6 +2264,7 @@ fail: - static void service_enter_restart(Service *s) { - _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; - int r; -+ int restart_usec; - - assert(s); - -@@ -2271,7 +2272,8 @@ static void service_enter_restart(Service *s) { - /* Don't restart things if we are going down anyway */ - log_unit_info(UNIT(s), "Stop job pending for unit, delaying automatic restart."); - -- r = service_arm_timer(s, usec_add(now(CLOCK_MONOTONIC), s->restart_usec)); -+ restart_usec = (s->restart_usec == 0) ? 1*USEC_PER_SEC : s->restart_usec; -+ r = service_arm_timer(s, usec_add(now(CLOCK_MONOTONIC), restart_usec)); - if (r < 0) - goto fail; - --- -2.23.0 - diff --git a/systemd.spec b/systemd.spec index 71fb4e2d2a69c0a05da3025bd14da24f46952358..f29df0c39e4220f4bea05e3c2e791ee8d9441587 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 246 -Release: 5 +Release: 6 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -66,10 +66,6 @@ Patch0015: journal-don-t-enable-systemd-journald-audit.socket-b.patch Patch0016: sd-bus-fix-error-handling-on-readv.patch #openEuler -Patch9001: 1509-fix-journal-file-descriptors-leak-problems.patch -Patch9002: 1602-activation-service-must-be-restarted-when-reactivated.patch -Patch9003: 1605-systemd-core-fix-problem-of-dbus-service-can-not-be-started.patch -Patch9004: 1619-delay-to-restart-when-a-service-can-not-be-auto-restarted.patch Patch9005: systemd-change-time-log-level.patch Patch9006: fix-capsh-drop-but-ping-success.patch Patch9007: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch @@ -278,7 +274,11 @@ CONFIGURE_OPTS=( -Db_ndebug=false -Dman=true -Dversion-tag=v%{version}-%{release} - -Ddefault-hierarchy=legacy + -Ddefault-hierarchy=legacy + -Ddefault-dnssec=no + # https://bugzilla.redhat.com/show_bug.cgi?id=1867830 + -Ddefault-mdns=no + -Ddefault-llmnr=resolve ) %meson "${CONFIGURE_OPTS[@]}" @@ -549,7 +549,7 @@ setfacl -Rnm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal/ &>/de # This will fix up enablement of any preset services that got installed # before systemd due to rpm ordering problems: # https://bugzilla.redhat.com/show_bug.cgi?id=1647172 -echo "DefaultTasksMax=85%" >> /etc/systemd/system.conf +echo "DefaultTasksMax=80%" >> /etc/systemd/system.conf if [ $1 -eq 1 ] ; then systemctl preset-all &>/dev/null || : @@ -1491,6 +1491,12 @@ fi %exclude /usr/share/man/man3/* %changelog +* Fri Sep 11 2020 openEuler Buildteam - 246-6 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:delete unneed patches + * Wed Sep 9 2020 openEuler Buildteam - 246-5 - Type:enhancement - ID:NA