Merge ~slyon/ubuntu/+source/systemd:slyon/lp1949089-fail-mount-uc18 into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-bionic

Proposed by Lukas Märdian
Status: Rejected
Rejected by: Dan Streetman
Proposed branch: ~slyon/ubuntu/+source/systemd:slyon/lp1949089-fail-mount-uc18
Merge into: ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-bionic
Diff against target: 300 lines (+13/-35)
3 files modified
debian/changelog (+13/-0)
debian/patches/series (+0/-3)
dev/null (+0/-32)
Reviewer Review Type Date Requested Status
Dan Streetman Disapprove
Review via email: mp+411528@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dan Streetman (ddstreet) wrote :

Sorry, this is a NAK from me - the patches fix an important bug that we don't want to reintroduce. Instead let's figure out what the new problem is with snapd's mount units and fix that properly.

review: Disapprove

Unmerged commits

cbf7a31... by Lukas Märdian

update changelog

35bfac7... by Lukas Märdian

Revert "Catch up on cgroup empty inotify after reexec/reload"

This reverts commit 5ef61bd930612a90ce3ed9105cbadc5ff97b6ffc.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 5e2e2aa..4ca8597 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,16 @@
6+systemd (237-3ubuntu10.53) bionic; urgency=medium
7+
8+ * Fix activation of mount units in UC18 (LP: #1949089)
9+ Revert "Catch up on cgroup empty inotify after reexec/reload"
10+ This reverts commit 5ef61bd930612a90ce3ed9105cbadc5ff97b6ffc.
11+ Files:
12+ - debian/patches/lp1934147/0001-core-add-a-new-unit-method-catchup.patch
13+ - debian/patches/lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch
14+ - debian/patches/lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch
15+ https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=35bfac79163f39979267724644d3f725f8e9f12c
16+
17+ -- Lukas Märdian <slyon@ubuntu.com> Mon, 08 Nov 2021 16:28:03 +0100
18+
19 systemd (237-3ubuntu10.52) bionic; urgency=medium
20
21 * d/extra/dhclient-enter-resolved-hook:
22diff --git a/debian/patches/lp1934147/0001-core-add-a-new-unit-method-catchup.patch b/debian/patches/lp1934147/0001-core-add-a-new-unit-method-catchup.patch
23deleted file mode 100644
24index 487588d..0000000
25--- a/debian/patches/lp1934147/0001-core-add-a-new-unit-method-catchup.patch
26+++ /dev/null
27@@ -1,158 +0,0 @@
28-From f0831ed2a03fcef582660be1c3b1a9f3e267e656 Mon Sep 17 00:00:00 2001
29-From: Lennart Poettering <lennart@poettering.net>
30-Date: Tue, 5 Jun 2018 16:53:22 +0200
31-Subject: [PATCH] core: add a new unit method "catchup()"
32-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934147
33-Origin: upstream, https://github.com/systemd/systemd/commit/f0831ed2a03fcef582660be1c3b1a9f3e267e656
34-
35-This is very similar to the existing unit method coldplug() but is
36-called a bit later. The idea is that that coldplug() restores the unit
37-state from before any prior reload/restart, i.e. puts the deserialized
38-state in effect. The catchup() call is then called a bit later, to
39-catch up with the system state for which we missed notifications while
40-we were reloading. This is only really useful for mount, swap and device
41-mount points were we should be careful to generate all missing unit
42-state change events (i.e. call unit_notify() appropriately) for
43-everything that happened while we were reloading.
44----
45- src/core/manager.c | 30 +++++++++++++++++++++++++++++-
46- src/core/unit.c | 11 ++++++++---
47- src/core/unit.h | 17 ++++++++++-------
48- 3 files changed, 47 insertions(+), 11 deletions(-)
49-
50---- a/src/core/manager.c
51-+++ b/src/core/manager.c
52-@@ -1290,7 +1290,9 @@ static void manager_coldplug(Manager *m)
53-
54- assert(m);
55-
56-- /* Then, let's set up their initial state. */
57-+ log_debug("Invoking unit coldplug() handlers…");
58-+
59-+ /* Let's place the units back into their deserialized state */
60- HASHMAP_FOREACH_KEY(u, k, m->units, i) {
61-
62- /* ignore aliases */
63-@@ -1303,6 +1305,26 @@ static void manager_coldplug(Manager *m)
64- }
65- }
66-
67-+static void manager_catchup(Manager *m) {
68-+ Iterator i;
69-+ Unit *u;
70-+ char *k;
71-+
72-+ assert(m);
73-+
74-+ log_debug("Invoking unit catchup() handlers…");
75-+
76-+ /* Let's catch up on any state changes that happened while we were reloading/reexecing */
77-+ HASHMAP_FOREACH_KEY(u, k, m->units, i) {
78-+
79-+ /* ignore aliases */
80-+ if (u->id != k)
81-+ continue;
82-+
83-+ unit_catchup(u);
84-+ }
85-+}
86-+
87- static void manager_build_unit_path_cache(Manager *m) {
88- char **i;
89- int r;
90-@@ -1477,6 +1499,9 @@ int manager_startup(Manager *m, FILE *se
91- m->send_reloading_done = true;
92- }
93-
94-+ /* Let's finally catch up with any changes that took place while we were reloading/reexecing */
95-+ manager_catchup(m);
96-+
97- return 0;
98- }
99-
100-@@ -3139,6 +3164,9 @@ int manager_reload(Manager *m) {
101- /* It might be safe to log to the journal now. */
102- manager_recheck_journal(m);
103-
104-+ /* Let's finally catch up with any changes that took place while we were reloading/reexecing */
105-+ manager_catchup(m);
106-+
107- /* Sync current state of bus names with our set of listening units */
108- if (m->api_bus)
109- manager_sync_bus_names(m, m->api_bus);
110---- a/src/core/unit.c
111-+++ b/src/core/unit.c
112-@@ -2331,7 +2331,6 @@ static void unit_update_on_console(Unit
113- manager_ref_console(u->manager);
114- else
115- manager_unref_console(u->manager);
116--
117- }
118-
119- static bool unit_process_job(Job *j, UnitActiveState ns, UnitNotifyFlags flags) {
120-@@ -3788,8 +3787,7 @@ int unit_coldplug(Unit *u) {
121-
122- assert(u);
123-
124-- /* Make sure we don't enter a loop, when coldplugging
125-- * recursively. */
126-+ /* Make sure we don't enter a loop, when coldplugging recursively. */
127- if (u->coldplugged)
128- return 0;
129-
130-@@ -3817,6 +3815,13 @@ int unit_coldplug(Unit *u) {
131- return r;
132- }
133-
134-+void unit_catchup(Unit *u) {
135-+ assert(u);
136-+
137-+ if (UNIT_VTABLE(u)->catchup)
138-+ UNIT_VTABLE(u)->catchup(u);
139-+}
140-+
141- static bool fragment_mtime_newer(const char *path, usec_t mtime, bool path_masked) {
142- struct stat st;
143-
144---- a/src/core/unit.h
145-+++ b/src/core/unit.h
146-@@ -454,10 +454,14 @@ struct UnitVTable {
147- * UNIT_STUB if no configuration could be found. */
148- int (*load)(Unit *u);
149-
150-- /* If a lot of units got created via enumerate(), this is
151-- * where to actually set the state and call unit_notify(). */
152-+ /* During deserialization we only record the intended state to return to. With coldplug() we actually put the
153-+ * deserialized state in effect. This is where unit_notify() should be called to start things up. */
154- int (*coldplug)(Unit *u);
155-
156-+ /* This is called shortly after all units' coldplug() call was invoked. It's supposed to catch up state changes
157-+ * we missed so far (for example because they took place while we were reloading/reexecing) */
158-+ void (*catchup)(Unit *u);
159-+
160- void (*dump)(Unit *u, FILE *f, const char *prefix);
161-
162- int (*start)(Unit *u);
163-@@ -546,11 +550,9 @@ struct UnitVTable {
164- /* Returns true if the unit currently needs access to the console */
165- bool (*needs_console)(Unit *u);
166-
167-- /* This is called for each unit type and should be used to
168-- * enumerate existing devices and load them. However,
169-- * everything that is loaded here should still stay in
170-- * inactive state. It is the job of the coldplug() call above
171-- * to put the units into the initial state. */
172-+ /* This is called for each unit type and should be used to enumerate units already existing in the system
173-+ * internally and load them. However, everything that is loaded here should still stay in inactive state. It is
174-+ * the job of the coldplug() call above to put the units into the initial state. */
175- void (*enumerate)(Manager *m);
176-
177- /* Type specific cleanups. */
178-@@ -705,6 +707,7 @@ void unit_serialize_item_format(Unit *u,
179- int unit_add_node_dependency(Unit *u, const char *what, bool wants, UnitDependency d, UnitDependencyMask mask);
180-
181- int unit_coldplug(Unit *u);
182-+void unit_catchup(Unit *u);
183-
184- void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_(3, 0);
185- void unit_status_emit_starting_stopping_reloading(Unit *u, JobType t);
186diff --git a/debian/patches/lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch b/debian/patches/lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch
187deleted file mode 100644
188index b9e4c43..0000000
189--- a/debian/patches/lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch
190+++ /dev/null
191@@ -1,59 +0,0 @@
192-From 869f52f21831b611160c4937bef822ca94c802ba Mon Sep 17 00:00:00 2001
193-From: Dan Streetman <ddstreet@canonical.com>
194-Date: Sun, 11 Jul 2021 16:59:27 -0400
195-Subject: [PATCH 1/2] cgroup: do 'catchup' for unit cgroup inotify watch files
196-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934147
197-Origin: upstream, https://github.com/systemd/systemd/pull/20199
198-
199-While reexec/reload, we drop the inotify watch on cgroup file(s), so
200-we need to re-check them in case they changed and we missed the event.
201-
202-Fixes: #20198
203----
204- src/core/cgroup.c | 18 ++++++++++++++++++
205- src/core/cgroup.h | 2 ++
206- src/core/unit.c | 2 ++
207- 3 files changed, 22 insertions(+)
208-
209---- a/src/core/cgroup.c
210-+++ b/src/core/cgroup.c
211-@@ -2563,6 +2563,20 @@ void unit_invalidate_cgroup_bpf(Unit *u)
212- }
213- }
214-
215-+void unit_cgroup_catchup(Unit *u) {
216-+ assert(u);
217-+
218-+ if (!UNIT_HAS_CGROUP_CONTEXT(u))
219-+ return;
220-+
221-+ /* We dropped the inotify watch during reexec/reload, so we need to
222-+ * check these as they may have changed.
223-+ * Note that (currently) the kernel doesn't actually update cgroup
224-+ * file modification times, so we can't just serialize and then check
225-+ * the mtime for file(s) we are interested in. */
226-+ unit_add_to_cgroup_empty_queue(u);
227-+}
228-+
229- void manager_invalidate_startup_units(Manager *m) {
230- Iterator i;
231- Unit *u;
232---- a/src/core/cgroup.h
233-+++ b/src/core/cgroup.h
234-@@ -219,3 +219,5 @@ void manager_invalidate_startup_units(Ma
235-
236- const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_;
237- CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;
238-+
239-+void unit_cgroup_catchup(Unit *u);
240---- a/src/core/unit.c
241-+++ b/src/core/unit.c
242-@@ -3820,6 +3820,8 @@ void unit_catchup(Unit *u) {
243-
244- if (UNIT_VTABLE(u)->catchup)
245- UNIT_VTABLE(u)->catchup(u);
246-+
247-+ unit_cgroup_catchup(u);
248- }
249-
250- static bool fragment_mtime_newer(const char *path, usec_t mtime, bool path_masked) {
251diff --git a/debian/patches/lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch b/debian/patches/lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch
252deleted file mode 100644
253index 17c2cfa..0000000
254--- a/debian/patches/lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch
255+++ /dev/null
256@@ -1,32 +0,0 @@
257-From 13e721036bf4ba15eb255d8f0a14800f969ac0d7 Mon Sep 17 00:00:00 2001
258-From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
259-Date: Wed, 4 Aug 2021 18:59:35 +0200
260-Subject: [PATCH 2/2] core: Make sure cgroup_oom_queue is flushed on manager
261- exit
262-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934147
263-Origin: upstream, https://github.com/systemd/systemd/pull/20199
264-
265-The unit queues are not serialized/deserialized (they are recreated
266-after reexec/reload instead). The destroyed units are not removed from
267-the cgroup_oom_queue. That means the queue may contain possibly invalid
268-pointers to released units.
269-
270-Fix this by removing the units from cgroup_oom_queue as we do for
271-others. When at it, sync assert checks with currently existing queues
272-and put them in order in the manager cleanup code.
273----
274- src/core/manager.c | 4 ++++
275- src/core/unit.c | 7 +++++--
276- 2 files changed, 9 insertions(+), 2 deletions(-)
277-
278---- a/src/core/manager.c
279-+++ b/src/core/manager.c
280-@@ -1171,6 +1171,8 @@ static void manager_clear_jobs_and_units
281- assert(!m->cleanup_queue);
282- assert(!m->gc_unit_queue);
283- assert(!m->gc_job_queue);
284-+ assert(!m->cgroup_realize_queue);
285-+ assert(!m->cgroup_empty_queue);
286-
287- assert(hashmap_isempty(m->jobs));
288- assert(hashmap_isempty(m->units));
289diff --git a/debian/patches/series b/debian/patches/series
290index 093231f..e4a9aec 100644
291--- a/debian/patches/series
292+++ b/debian/patches/series
293@@ -259,7 +259,4 @@ lp1815101-0004-networkd-stop-clients-when-networkd-shuts-down.patch
294 lp1815101-0005-network-add-KeepConfiguration-dhcp-on-stop.patch
295 lp1815101-0006-network-make-KeepConfiguration-static-drop-DHCP-addr.patch
296 lp1815101-0007-man-add-documentation-about-KeepConfiguration.patch
297-lp1934147/0001-core-add-a-new-unit-method-catchup.patch
298-lp1934147/0002-cgroup-do-catchup-for-unit-cgroup-inotify-watch-file.patch
299-lp1934147/0003-core-Make-sure-cgroup_oom_queue-is-flushed-on-manage.patch
300 lp1934981-correct-suspend-then-sleep-string.patch

Subscribers

People subscribed via source and target branches