]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: report accurate can_start and can_reload
authorMike Yuan <me@yhndnzj.com>
Mon, 10 Feb 2025 19:22:09 +0000 (20:22 +0100)
committerMike Yuan <me@yhndnzj.com>
Wed, 12 Feb 2025 14:33:11 +0000 (15:33 +0100)
src/core/mount.c

index 6998f02d5a434a08a59cc4b2adc1104af9541c01..9632a12ca679a4cd9a29393e900662a43a2f05d9 100644 (file)
@@ -1424,6 +1424,12 @@ static int mount_reload(Unit *u) {
         return 1;
 }
 
+static bool mount_can_reload(Unit *u) {
+        Mount *m = ASSERT_PTR(MOUNT(u));
+
+        return get_mount_parameters_fragment(m);
+}
+
 static int mount_serialize(Unit *u, FILE *f, FDSet *fds) {
         Mount *m = ASSERT_PTR(MOUNT(u));
 
@@ -2361,6 +2367,9 @@ static int mount_can_start(Unit *u) {
                 return r;
         }
 
+        if (!get_mount_parameters_fragment(m))
+                return -ENOENT;
+
         return 1;
 }
 
@@ -2475,7 +2484,9 @@ const UnitVTable mount_vtable = {
 
         .start = mount_start,
         .stop = mount_stop,
+
         .reload = mount_reload,
+        .can_reload = mount_can_reload,
 
         .clean = mount_clean,
         .can_clean = mount_can_clean,