core/mount: set Mount.from_proc_self_mountinfo flag before adding default dependencies

When the function mount_setup_new_unit() is called, the corresponding
.mount unit file is not loaded. Hence, Mount.from_fragment is false.
To add default dependencies to e.g. .device units, it is necessary that
the Mount.from_proc_self_mountinfo flag is set. However, the flag was
not set even the unit has information from /proc/self/mountinfo.

Partially fixes #19983.
This commit is contained in:
Yu Watanabe
2022-08-05 01:35:38 +09:00
parent 03e52e8cc3
commit b9e6d23dfc
+4 -4
View File
@@ -1600,15 +1600,15 @@ static int mount_setup_new_unit(
if (r < 0)
return r;
r = mount_add_non_exec_dependencies(MOUNT(u));
if (r < 0)
return r;
/* This unit was generated because /proc/self/mountinfo reported it. Remember this, so that by the
* time we load the unit file for it (and thus add in extra deps right after) we know what source to
* attributes the deps to. */
MOUNT(u)->from_proc_self_mountinfo = true;
r = mount_add_non_exec_dependencies(MOUNT(u));
if (r < 0)
return r;
/* We have only allocated the stub now, let's enqueue this unit for loading now, so that everything
* else is loaded in now. */
unit_add_to_load_queue(u);