summaryrefslogtreecommitdiffstats
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-05-13 05:30:04 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-08-04 18:35:38 +0200
commitb9e6d23dfc93b0eab8762c6fbe4fddc9eeb0c04f (patch)
tree8f4c713696db3da01ca1c772c953696f14dbd877 /src/core/mount.c
parentcore: unit_name_from_path() does not return -ENAMETOOLONG anymore (diff)
downloadsystemd-b9e6d23dfc93b0eab8762c6fbe4fddc9eeb0c04f.tar.xz
systemd-b9e6d23dfc93b0eab8762c6fbe4fddc9eeb0c04f.zip
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.
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 4263610e82..229b3de4fd 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -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);