Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 919119 Details for
Bug 905683
rd.luks.key is ignored
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch adding WantsMountsFor with typo fixed
crypt-fallabck-password.patch (text/plain), 18.09 KB, created by
Zbigniew Jędrzejewski-Szmek
on 2014-07-18 15:18:55 UTC
(
hide
)
Description:
patch adding WantsMountsFor with typo fixed
Filename:
MIME Type:
Creator:
Zbigniew Jędrzejewski-Szmek
Created:
2014-07-18 15:18:55 UTC
Size:
18.09 KB
patch
obsolete
>diff -uNr src/core/dbus-unit.c src-crypt-fallback-password/core/dbus-unit.c >--- src/core/dbus-unit.c 2014-04-20 21:42:07.000000000 +0100 >+++ src-crypt-fallback-password/core/dbus-unit.c 2014-04-20 21:51:30.561873719 +0100 >@@ -1049,6 +1049,7 @@ > { "PropagatesReloadTo", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_PROPAGATES_RELOAD_TO]), true }, > { "ReloadPropagatedFrom", bus_unit_append_dependencies, "as", offsetof(Unit, dependencies[UNIT_RELOAD_PROPAGATED_FROM]), true }, > { "RequiresMountsFor", bus_property_append_strv, "as", offsetof(Unit, requires_mounts_for), true }, >+ { "WantsMountsFor", bus_property_append_strv, "as", offsetof(Unit, wants_mounts_for), true }, > { "Documentation", bus_property_append_strv, "as", offsetof(Unit, documentation), true }, > { "Description", bus_unit_append_description, "s", 0 }, > { "LoadState", bus_unit_append_load_state, "s", offsetof(Unit, load_state) }, >diff -uNr src/core/dbus-unit.h src-crypt-fallback-password/core/dbus-unit.h >--- src/core/dbus-unit.h 2013-08-13 21:02:46.000000000 +0100 >+++ src-crypt-fallback-password/core/dbus-unit.h 2014-04-20 21:51:52.689012744 +0100 >@@ -90,6 +90,7 @@ > " <property name=\"PropagatesReloadTo\" type=\"as\" access=\"read\"/>\n" \ > " <property name=\"ReloadPropagatedFrom\" type=\"as\" access=\"read\"/>\n" \ > " <property name=\"RequiresMountsFor\" type=\"as\" access=\"read\"/>\n" \ >+ " <property name=\"WantsMountsFor\" type=\"as\" access=\"read\"/>\n" \ > " <property name=\"Description\" type=\"s\" access=\"read\"/>\n" \ > " <property name=\"SourcePath\" type=\"s\" access=\"read\"/>\n" \ > " <property name=\"DropInPaths\" type=\"as\" access=\"read\"/>\n" \ >diff -uNr src/core/load-fragment.c src-crypt-fallback-password/core/load-fragment.c >--- src/core/load-fragment.c 2014-04-20 21:42:10.000000000 +0100 >+++ src-crypt-fallback-password/core/load-fragment.c 2014-04-20 21:54:34.529993141 +0100 >@@ -1814,6 +1814,51 @@ > return 0; > } > >+int config_parse_unit_wants_mounts_for( >+ const char *unit, >+ const char *filename, >+ unsigned line, >+ const char *section, >+ const char *lvalue, >+ int ltype, >+ const char *rvalue, >+ void *data, >+ void *userdata) { >+ >+ Unit *u = userdata; >+ char *state; >+ size_t l; >+ char *w; >+ >+ assert(filename); >+ assert(lvalue); >+ assert(rvalue); >+ assert(data); >+ >+ FOREACH_WORD_QUOTED(w, l, rvalue, state) { >+ int r; >+ _cleanup_free_ char *n; >+ >+ n = strndup(w, l); >+ if (!n) >+ return log_oom(); >+ >+ if (!utf8_is_valid(n)) { >+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); >+ continue; >+ } >+ >+ r = unit_want_mounts_for(u, n); >+ if (r < 0) { >+ log_syntax(unit, LOG_ERR, filename, line, r, >+ "Failed to add wanted mount for, ignoring: %s", rvalue); >+ continue; >+ } >+ } >+ >+ return 0; >+} >+ > int config_parse_documentation(const char *unit, > const char *filename, > unsigned line, >@@ -2687,6 +2732,7 @@ > { config_parse_nsec, "NANOSECONDS" }, > { config_parse_path_strv, "PATH [...]" }, > { config_parse_unit_requires_mounts_for, "PATH [...]" }, >+ { config_parse_unit_wants_mounts_for, "PATH [...]" }, > { config_parse_exec_mount_flags, "MOUNTFLAG [...]" }, > { config_parse_unit_string_printf, "STRING" }, > { config_parse_trigger_unit, "UNIT" }, >diff -uNr src/core/load-fragment-gperf.gperf.m4 src-crypt-fallback-password/core/load-fragment-gperf.gperf.m4 >--- src/core/load-fragment-gperf.gperf.m4 2014-04-20 21:41:54.000000000 +0100 >+++ src-crypt-fallback-password/core/load-fragment-gperf.gperf.m4 2014-04-20 21:52:23.754205738 +0100 >@@ -117,6 +117,7 @@ > Unit.PropagateReloadFrom, config_parse_unit_deps, UNIT_RELOAD_PROPAGATED_FROM, 0 > Unit.PartOf, config_parse_unit_deps, UNIT_PART_OF, 0 > Unit.RequiresMountsFor, config_parse_unit_requires_mounts_for, 0, 0 >+Unit.WantsMountsFor, config_parse_unit_wants_mounts_for, 0, 0 > Unit.StopWhenUnneeded, config_parse_bool, 0, offsetof(Unit, stop_when_unneeded) > Unit.RefuseManualStart, config_parse_bool, 0, offsetof(Unit, refuse_manual_start) > Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Unit, refuse_manual_stop) >diff -uNr src/core/load-fragment.h src-crypt-fallback-password/core/load-fragment.h >--- src/core/load-fragment.h 2013-08-13 21:02:46.000000000 +0100 >+++ src-crypt-fallback-password/core/load-fragment.h 2014-04-20 21:54:54.331109229 +0100 >@@ -73,6 +73,7 @@ > int config_parse_notify_access(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); > int config_parse_start_limit_action(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); > int config_parse_unit_requires_mounts_for(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); >+int config_parse_unit_wants_mounts_for(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); > int config_parse_syscall_filter(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); > int config_parse_environ(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); > int config_parse_unit_slice(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); >diff -uNr src/core/manager.c src-crypt-fallback-password/core/manager.c >--- src/core/manager.c 2014-04-20 21:42:13.000000000 +0100 >+++ src-crypt-fallback-password/core/manager.c 2014-04-20 21:58:14.459245727 +0100 >@@ -777,6 +777,9 @@ > assert(hashmap_isempty(m->units_requiring_mounts_for)); > hashmap_free(m->units_requiring_mounts_for); > >+ assert(hashmap_isempty(m->units_want_mounts_for)); >+ hashmap_free(m->units_want_mounts_for); >+ > free(m); > } > >@@ -2837,6 +2840,18 @@ > return hashmap_get(m->units_requiring_mounts_for, streq(p, "/") ? "" : p); > } > >+Set *manager_get_units_want_mounts_for(Manager *m, const char *path) { >+ char p[strlen(path)+1]; >+ >+ assert(m); >+ assert(path); >+ >+ strcpy(p, path); >+ path_kill_slashes(p); >+ >+ return hashmap_get(m->units_want_mounts_for, streq(p, "/") ? "" : p); >+} >+ > void watch_init(Watch *w) { > assert(w); > >diff -uNr src/core/manager.h src-crypt-fallback-password/core/manager.h >--- src/core/manager.h 2014-04-20 21:42:11.000000000 +0100 >+++ src-crypt-fallback-password/core/manager.h 2014-04-20 21:58:45.962419451 +0100 >@@ -266,6 +266,11 @@ > * them. It's a hashmap with a path string as key and a Set as > * value where Unit objects are contained. */ > Hashmap *units_requiring_mounts_for; >+ >+ /* This maps all possible path prefixes to the units want >+ * them. It's a hashmap with a path string as key and a Set as >+ * value where Unit objects are contained. */ >+ Hashmap *units_want_mounts_for; > }; > > int manager_new(SystemdRunningAs running_as, bool reexecuting, Manager **m); >@@ -334,5 +339,6 @@ > void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_attr_(4,5); > > Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path); >+Set *manager_get_units_want_mounts_for(Manager *m, const char *path); > > void watch_init(Watch *w); >diff -uNr src/core/mount.c src-crypt-fallback-password/core/mount.c >--- src/core/mount.c 2014-04-20 21:42:09.000000000 +0100 >+++ src-crypt-fallback-password/core/mount.c 2014-04-20 22:00:12.137888789 +0100 >@@ -257,7 +257,7 @@ > return r; > } > >- /* Adds in links to other units that use this path or paths >+ /* Adds in links to other units that use (require) this path or paths > * further down in the hierarchy */ > s = manager_get_units_requiring_mounts_for(UNIT(m)->manager, m->where); > SET_FOREACH(other, s, i) { >@@ -278,6 +278,30 @@ > if (r < 0) > return r; > } >+ } >+ >+ >+ /* Adds in links to other units that use (want) this path or paths >+ * further down in the hierarchy */ >+ s = manager_get_units_want_mounts_for(UNIT(m)->manager, m->where); >+ SET_FOREACH(other, s, i) { >+ >+ if (other->load_state != UNIT_LOADED) >+ continue; >+ >+ if (other == UNIT(m)) >+ continue; >+ >+ r = unit_add_dependency(other, UNIT_AFTER, UNIT(m), true); >+ if (r < 0) >+ return r; >+ >+ if (UNIT(m)->fragment_path) { >+ /* If we have fragment configuration, then make this dependency wanted */ >+ r = unit_add_dependency(other, UNIT_WANTS, UNIT(m), true); >+ if (r < 0) >+ return r; >+ } > } > > return 0; >diff -uNr src/core/unit.c src-crypt-fallback-password/core/unit.c >--- src/core/unit.c 2014-04-20 21:42:11.000000000 +0100 >+++ src-crypt-fallback-password/core/unit.c 2014-04-20 22:02:36.380658202 +0100 >@@ -399,6 +399,35 @@ > u->requires_mounts_for = NULL; > } > >+ >+static void unit_free_wants_mounts_for(Unit *u) { >+ char **j; >+ >+ STRV_FOREACH(j, u->wants_mounts_for) { >+ char s[strlen(*j) + 1]; >+ >+ PATH_FOREACH_PREFIX_MORE(s, *j) { >+ char *y; >+ Set *x; >+ >+ x = hashmap_get2(u->manager->units_want_mounts_for, s, (void**) &y); >+ if (!x) >+ continue; >+ >+ set_remove(x, u); >+ >+ if (set_isempty(x)) { >+ hashmap_remove(u->manager->units_want_mounts_for, y); >+ free(y); >+ set_free(x); >+ } >+ } >+ } >+ >+ strv_free(u->wants_mounts_for); >+ u->wants_mounts_for = NULL; >+} >+ > void unit_free(Unit *u) { > UnitDependency d; > Iterator i; >@@ -416,7 +445,8 @@ > UNIT_VTABLE(u)->done(u); > > unit_free_requires_mounts_for(u); >- >+ unit_free_wants_mounts_for(u); >+ > SET_FOREACH(t, u->names, i) > hashmap_remove_value(u->manager->units, t, u); > >@@ -799,6 +829,16 @@ > fputs("\n", f); > } > >+ if (!strv_isempty(u->wants_mounts_for)) { >+ fprintf(f, >+ "%s\tWantsMountsFor:", prefix); >+ >+ STRV_FOREACH(j, u->wants_mounts_for) >+ fprintf(f, " %s", *j); >+ >+ fputs("\n", f); >+ } >+ > if (u->load_state == UNIT_LOADED) { > > fprintf(f, >@@ -2842,6 +2882,37 @@ > } > } > >+ STRV_FOREACH(i, u->wants_mounts_for) { >+ char prefix[strlen(*i) + 1]; >+ >+ PATH_FOREACH_PREFIX_MORE(prefix, *i) { >+ Unit *m; >+ >+ r = manager_get_unit_by_path(u->manager, prefix, ".mount", &m); >+ if (r < 0) >+ return r; >+ >+ if (r == 0) >+ continue; >+ >+ if (m == u) >+ continue; >+ >+ if (m->load_state != UNIT_LOADED) >+ continue; >+ >+ r = unit_add_dependency(u, UNIT_AFTER, m, true); >+ if (r < 0) >+ return r; >+ >+ if (m->fragment_path) { >+ r = unit_add_dependency(u, UNIT_WANTS, m, true); >+ if (r < 0) >+ return r; >+ } >+ } >+ } >+ > return 0; > } > >@@ -3229,6 +3300,91 @@ > if (r < 0) { > free(q); > set_free(x); >+ return r; >+ } >+ } >+ >+ r = set_put(x, u); >+ if (r < 0) >+ return r; >+ } >+ >+ return 0; >+} >+ >+int unit_want_mounts_for(Unit *u, const char *path) { >+ char prefix[strlen(path) + 1], *p; >+ int r; >+ >+ assert(u); >+ assert(path); >+ >+ /* Registers a unit for want a certain path and all its >+ * prefixes. We keep a simple array of these paths in the >+ * unit, since its usually short. However, we build a prefix >+ * table for all possible prefixes so that new appearing mount >+ * units can easily determine which units to make themselves a >+ * dependency of. */ >+ >+ p = strdup(path); >+ if (!p) >+ return -ENOMEM; >+ >+ path_kill_slashes(p); >+ >+ if (!path_is_absolute(p)) { >+ free(p); >+ return -EINVAL; >+ } >+ >+ if (!path_is_safe(p)) { >+ free(p); >+ return -EPERM; >+ } >+ >+ if (strv_contains(u->wants_mounts_for, p)) { >+ free(p); >+ return 0; >+ } >+ >+ /* No sense to filter out against requires_mounts_fo: >+ * - it should be properly configured not to use duplicates >+ * - in case of duplicates it will be filtered in runtime >+ */ >+ >+ r = strv_push(&u->wants_mounts_for, p); >+ if (r < 0) { >+ free(p); >+ return r; >+ } >+ >+ PATH_FOREACH_PREFIX_MORE(prefix, p) { >+ Set *x; >+ >+ x = hashmap_get(u->manager->units_want_mounts_for, prefix); >+ if (!x) { >+ char *q; >+ >+ if (!u->manager->units_want_mounts_for) { >+ u->manager->units_want_mounts_for = hashmap_new(string_hash_func, string_compare_func); >+ if (!u->manager->units_want_mounts_for) >+ return -ENOMEM; >+ } >+ >+ q = strdup(prefix); >+ if (!q) >+ return -ENOMEM; >+ >+ x = set_new(NULL, NULL); >+ if (!x) { >+ free(q); >+ return -ENOMEM; >+ } >+ >+ r = hashmap_put(u->manager->units_want_mounts_for, q, x); >+ if (r < 0) { >+ free(q); >+ set_free(x); > return r; > } > } >diff -uNr src/core/unit.h src-crypt-fallback-password/core/unit.h >--- src/core/unit.h 2014-04-20 21:42:10.000000000 +0100 >+++ src-crypt-fallback-password/core/unit.h 2014-04-20 22:03:04.082804013 +0100 >@@ -139,6 +139,7 @@ > Set *dependencies[_UNIT_DEPENDENCY_MAX]; > > char **requires_mounts_for; >+ char **wants_mounts_for; > > char *description; > char **documentation; >@@ -183,6 +184,9 @@ > /* All units which have requires_mounts_for set */ > LIST_FIELDS(Unit, has_requires_mounts_for); > >+ /* All units which have wants_mounts_for set */ >+ LIST_FIELDS(Unit, has_wants_mounts_for); >+ > /* Load queue */ > LIST_FIELDS(Unit, load_queue); > >@@ -619,6 +623,7 @@ > int unit_make_transient(Unit *u); > > int unit_require_mounts_for(Unit *u, const char *path); >+int unit_want_mounts_for(Unit *u, const char *path); > > const char *unit_active_state_to_string(UnitActiveState i) _const_; > UnitActiveState unit_active_state_from_string(const char *s) _pure_; >diff -uNr src/cryptsetup/cryptsetup-generator.c src-crypt-fallback-password/cryptsetup/cryptsetup-generator.c >--- src/cryptsetup/cryptsetup-generator.c 2014-04-20 21:42:05.000000000 +0100 >+++ src-crypt-fallback-password/cryptsetup/cryptsetup-generator.c 2014-04-20 21:50:43.642574322 +0100 >@@ -144,7 +144,8 @@ > > fprintf(f, "After=%1$s\nRequires=%1$s\n", dd); > } else >- fprintf(f, "RequiresMountsFor=%s\n", password); >+ /* Do not use 'RequiresMountsFor=' here to allow fallback to password in case the key device is not available */ >+ fprintf(f, "WantsMountsFor=%s\n", password); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 905683
:
745820
|
887979
| 919119