Merge pull request #14040 from poettering/root-mount-deps

root mount dep fixes
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-11-18 15:29:35 +01:00 committed by GitHub
commit 0b15d12204
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,9 +409,13 @@ static bool mount_is_extrinsic(Mount *m) {
if (!MANAGER_IS_SYSTEM(UNIT(m)->manager)) /* We only automatically manage mounts if we are in system mode */
return true;
if (UNIT(m)->perpetual) /* All perpetual units never change state */
return true;
if (PATH_IN_SET(m->where, /* Don't bother with the OS data itself */
"/",
"/usr"))
"/", /* (strictly speaking redundant: should already be covered by the perpetual flag check above) */
"/usr",
"/etc"))
return true;
if (PATH_STARTSWITH_SET(m->where,
@ -546,6 +550,32 @@ static int mount_verify(Mount *m) {
return 0;
}
static int mount_add_non_exec_dependencies(Mount *m) {
int r;
assert(m);
/* Adds in all dependencies directly responsible for ordering the mount, as opposed to dependencies
* resulting from the ExecContext and such. */
r = mount_add_device_dependencies(m);
if (r < 0)
return r;
r = mount_add_mount_dependencies(m);
if (r < 0)
return r;
r = mount_add_quota_dependencies(m);
if (r < 0)
return r;
r = mount_add_default_dependencies(m);
if (r < 0)
return r;
return 0;
}
static int mount_add_extras(Mount *m) {
Unit *u = UNIT(m);
int r;
@ -573,18 +603,6 @@ static int mount_add_extras(Mount *m) {
return r;
}
r = mount_add_device_dependencies(m);
if (r < 0)
return r;
r = mount_add_mount_dependencies(m);
if (r < 0)
return r;
r = mount_add_quota_dependencies(m);
if (r < 0)
return r;
r = unit_patch_contexts(u);
if (r < 0)
return r;
@ -597,7 +615,7 @@ static int mount_add_extras(Mount *m) {
if (r < 0)
return r;
r = mount_add_default_dependencies(m);
r = mount_add_non_exec_dependencies(m);
if (r < 0)
return r;
@ -1570,7 +1588,7 @@ static int mount_setup_existing_unit(
unit_remove_dependencies(u, UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT);
r = mount_add_extras(MOUNT(u));
r = mount_add_non_exec_dependencies(MOUNT(u));
if (r < 0)
return r;
}