diff options
author | Randy Witt <randy.e.witt@linux.intel.com> | 2015-03-04 19:01:05 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-10 10:47:50 +0000 |
commit | 1662423b8a8dc4907638a5717720d2911363e71a (patch) | |
tree | db2128854c1c1424e472eec57462dd2315f379b0 | |
parent | 56f010f7acaf09e450644e159c13470eada972c6 (diff) | |
download | poky-1662423b8a8dc4907638a5717720d2911363e71a.tar.gz |
systemd: Fix runtime failures in systemd-tmpfiles-setup.service.
There were failures at boot from systemd-tmpfiles-setup.service due to
tmpfiles.d not honoring the ordering of entries in the files.
The patch here fixes the ordering issue which subsequently fixes the
failures on boot.
[Yocto #7393]
(From OE-Core rev: f6da978c5685393c4b6ef14690fe869a80836ba2)
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch | 185 | ||||
-rw-r--r-- | meta/recipes-core/systemd/systemd_219.bb | 1 |
2 files changed, 186 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch new file mode 100644 index 0000000000..ccd675798c --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch | |||
@@ -0,0 +1,185 @@ | |||
1 | From 2abf886295b979bce6d3f0a240f6f5ecfd70ba37 Mon Sep 17 00:00:00 2001 | ||
2 | From: Randy Witt <randy.e.witt@linux.intel.com> | ||
3 | Date: Wed, 4 Mar 2015 18:32:40 -0800 | ||
4 | Subject: [PATCH] tmpfiles.c: Honor ordering within files as the docs say. | ||
5 | |||
6 | Previously, globs would always get processed first followed by any other | ||
7 | items in arbitrary order. This is contrary to the documentation which | ||
8 | states "Otherwise, the files/directories are processed in the order they | ||
9 | are listed." | ||
10 | |||
11 | To fix this, remove the separate "globs" hashmap, and instead use only one | ||
12 | marking each entry as a glob or not. There should be little overhead | ||
13 | from doing this, considering the only time nested processing will occur | ||
14 | is for processing of globs which are not of type "X". | ||
15 | |||
16 | Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> | ||
17 | --- | ||
18 | src/tmpfiles/tmpfiles.c | 53 ++++++++++++++++++++++--------------------------- | ||
19 | 1 file changed, 24 insertions(+), 29 deletions(-) | ||
20 | |||
21 | diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c | ||
22 | index 917bb3c..0b6d226 100644 | ||
23 | --- a/src/tmpfiles/tmpfiles.c | ||
24 | +++ b/src/tmpfiles/tmpfiles.c | ||
25 | @@ -116,6 +116,7 @@ typedef struct Item { | ||
26 | bool force:1; | ||
27 | |||
28 | bool done:1; | ||
29 | + bool glob:1; | ||
30 | } Item; | ||
31 | |||
32 | typedef struct ItemArray { | ||
33 | @@ -137,7 +138,7 @@ static const char conf_file_dirs[] = CONF_DIRS_NULSTR("tmpfiles"); | ||
34 | |||
35 | #define MAX_DEPTH 256 | ||
36 | |||
37 | -static Hashmap *items = NULL, *globs = NULL; | ||
38 | +static OrderedHashmap *items = NULL; | ||
39 | static Set *unix_sockets = NULL; | ||
40 | |||
41 | static bool needs_glob(ItemType t) { | ||
42 | @@ -176,17 +177,17 @@ static bool takes_ownership(ItemType t) { | ||
43 | RECURSIVE_REMOVE_PATH); | ||
44 | } | ||
45 | |||
46 | -static struct Item* find_glob(Hashmap *h, const char *match) { | ||
47 | +static struct Item* find_glob(OrderedHashmap *h, const char *match) { | ||
48 | ItemArray *j; | ||
49 | Iterator i; | ||
50 | |||
51 | - HASHMAP_FOREACH(j, h, i) { | ||
52 | + ORDERED_HASHMAP_FOREACH(j, h, i) { | ||
53 | unsigned n; | ||
54 | |||
55 | for (n = 0; n < j->count; n++) { | ||
56 | Item *item = j->items + n; | ||
57 | |||
58 | - if (fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0) | ||
59 | + if (item->glob && fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0) | ||
60 | return item; | ||
61 | } | ||
62 | } | ||
63 | @@ -391,12 +392,12 @@ static int dir_cleanup( | ||
64 | } | ||
65 | |||
66 | /* Is there an item configured for this path? */ | ||
67 | - if (hashmap_get(items, sub_path)) { | ||
68 | + if (ordered_hashmap_get(items, sub_path)) { | ||
69 | log_debug("Ignoring \"%s\": a separate entry exists.", sub_path); | ||
70 | continue; | ||
71 | } | ||
72 | |||
73 | - if (find_glob(globs, sub_path)) { | ||
74 | + if (find_glob(items, sub_path)) { | ||
75 | log_debug("Ignoring \"%s\": a separate glob exists.", sub_path); | ||
76 | continue; | ||
77 | } | ||
78 | @@ -1378,7 +1379,7 @@ static int process_item(Item *i) { | ||
79 | PATH_FOREACH_PREFIX(prefix, i->path) { | ||
80 | ItemArray *j; | ||
81 | |||
82 | - j = hashmap_get(items, prefix); | ||
83 | + j = ordered_hashmap_get(items, prefix); | ||
84 | if (j) { | ||
85 | int s; | ||
86 | |||
87 | @@ -1505,7 +1506,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { | ||
88 | _cleanup_free_ char *action = NULL, *mode = NULL, *user = NULL, *group = NULL, *age = NULL, *path = NULL; | ||
89 | _cleanup_(item_free_contents) Item i = {}; | ||
90 | ItemArray *existing; | ||
91 | - Hashmap *h; | ||
92 | int r, c = -1, pos; | ||
93 | bool force = false, boot = false; | ||
94 | |||
95 | @@ -1739,9 +1739,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { | ||
96 | i.age_set = true; | ||
97 | } | ||
98 | |||
99 | - h = needs_glob(i.type) ? globs : items; | ||
100 | + i.glob = needs_glob(i.type); | ||
101 | |||
102 | - existing = hashmap_get(h, i.path); | ||
103 | + existing = ordered_hashmap_get(items, i.path); | ||
104 | if (existing) { | ||
105 | unsigned n; | ||
106 | |||
107 | @@ -1752,7 +1752,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { | ||
108 | } | ||
109 | } else { | ||
110 | existing = new0(ItemArray, 1); | ||
111 | - r = hashmap_put(h, i.path, existing); | ||
112 | + r = ordered_hashmap_put(items, i.path, existing); | ||
113 | if (r < 0) | ||
114 | return log_oom(); | ||
115 | } | ||
116 | @@ -1911,14 +1911,20 @@ static int read_config_file(const char *fn, bool ignore_enoent) { | ||
117 | } | ||
118 | |||
119 | /* we have to determine age parameter for each entry of type X */ | ||
120 | - HASHMAP_FOREACH(i, globs, iterator) { | ||
121 | + ORDERED_HASHMAP_FOREACH(i, items, iterator) { | ||
122 | Iterator iter; | ||
123 | Item *j, *candidate_item = NULL; | ||
124 | + int number = 0; | ||
125 | |||
126 | + if (!i->glob) | ||
127 | + continue; | ||
128 | if (i->type != IGNORE_DIRECTORY_PATH) | ||
129 | continue; | ||
130 | |||
131 | - HASHMAP_FOREACH(j, items, iter) { | ||
132 | + ORDERED_HASHMAP_FOREACH(j, items, iter) { | ||
133 | + number++; | ||
134 | + if (j == i) | ||
135 | + continue; | ||
136 | if (j->type != CREATE_DIRECTORY && j->type != TRUNCATE_DIRECTORY && j->type != CREATE_SUBVOLUME) | ||
137 | continue; | ||
138 | |||
139 | @@ -1964,10 +1970,9 @@ int main(int argc, char *argv[]) { | ||
140 | |||
141 | mac_selinux_init(NULL); | ||
142 | |||
143 | - items = hashmap_new(&string_hash_ops); | ||
144 | - globs = hashmap_new(&string_hash_ops); | ||
145 | + items = ordered_hashmap_new(&string_hash_ops); | ||
146 | |||
147 | - if (!items || !globs) { | ||
148 | + if (!items) { | ||
149 | r = log_oom(); | ||
150 | goto finish; | ||
151 | } | ||
152 | @@ -2000,27 +2005,17 @@ int main(int argc, char *argv[]) { | ||
153 | } | ||
154 | } | ||
155 | |||
156 | - HASHMAP_FOREACH(a, globs, iterator) { | ||
157 | - k = process_item_array(a); | ||
158 | - if (k < 0 && r == 0) | ||
159 | - r = k; | ||
160 | - } | ||
161 | - | ||
162 | - HASHMAP_FOREACH(a, items, iterator) { | ||
163 | + ORDERED_HASHMAP_FOREACH(a, items, iterator) { | ||
164 | k = process_item_array(a); | ||
165 | if (k < 0 && r == 0) | ||
166 | r = k; | ||
167 | } | ||
168 | |||
169 | finish: | ||
170 | - while ((a = hashmap_steal_first(items))) | ||
171 | - item_array_free(a); | ||
172 | - | ||
173 | - while ((a = hashmap_steal_first(globs))) | ||
174 | + while ((a = ordered_hashmap_steal_first(items))) | ||
175 | item_array_free(a); | ||
176 | |||
177 | - hashmap_free(items); | ||
178 | - hashmap_free(globs); | ||
179 | + ordered_hashmap_free(items); | ||
180 | |||
181 | free(arg_include_prefixes); | ||
182 | free(arg_exclude_prefixes); | ||
183 | -- | ||
184 | 1.9.3 | ||
185 | |||
diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb index 454268a33a..5f58f409f4 100644 --- a/meta/recipes-core/systemd/systemd_219.bb +++ b/meta/recipes-core/systemd/systemd_219.bb | |||
@@ -42,6 +42,7 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol= | |||
42 | file://0011-systemd-user-avoid-using-system-auth.patch \ | 42 | file://0011-systemd-user-avoid-using-system-auth.patch \ |
43 | file://0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch \ | 43 | file://0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch \ |
44 | file://0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch \ | 44 | file://0002-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch \ |
45 | file://0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch \ | ||
45 | file://tmpfiles-pam.patch \ | 46 | file://tmpfiles-pam.patch \ |
46 | file://touchscreen.rules \ | 47 | file://touchscreen.rules \ |
47 | file://00-create-volatile.conf \ | 48 | file://00-create-volatile.conf \ |