Do not wait for System StartupFinished 41/204241/8 accepted/tizen/unified/20190425.014556 submit/tizen/20190424.070308
authorHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 22 Apr 2019 08:30:43 +0000 (17:30 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Wed, 24 Apr 2019 07:02:12 +0000 (16:02 +0900)
1) udev event --> sysinit.target/systemd-udevd.service
2) /tmp       --> sysinit.target
3) /opt       --> sysinit.target or initrd
4) /opt/usr   --> wait-mount@opt-usr.service

So, storaged does not need to wait for StartupFinished.
Without this patch, storaged cannot complete booting_done()
when even a single service unit fails.

dbus-send --system --print-reply
--type=method_call
--dest=org.freedesktop.systemd1
/org/freedesktop/systemd1
org.freedesktop.DBus.Properties.Get
string:"org.freedesktop.systemd1.Manager"
string:"SystemState"

variant       string "starting"

Change-Id: I7275cc91e1904600f0c0a7cd7ac2dd243e15922b
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
src/block/block.c
src/storage/storage.c
systemd/storaged.service

index ab6ead90cc6e73d257a479f6d83035548e2187fc..c8119ee4299760daef434ed90e5152d8ab8a665e 100644 (file)
@@ -45,7 +45,6 @@
 #include <glib/gstdio.h>
 #include <gio/gio.h>
 #include <libsyscommon/dbus-system.h>
-#include <libsyscommon/systemd-state.h>
 
 #include "log.h"
 #include "config-parser.h"
@@ -2680,18 +2679,6 @@ static void booting_done(void)
        block_boot = true;
 }
 
-static void booting_done_received(GDBusConnection  *conn,
-               const gchar *sender,
-               const gchar *path,
-               const gchar *iface,
-               const gchar *name,
-               GVariant *param,
-               gpointer data)
-{
-       _I("Signal received: %s", SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED);
-       booting_done();
-}
-
 static void block_poweroff(GDBusConnection  *conn,
                const gchar *sender,
                const gchar *path,
@@ -3659,7 +3646,6 @@ static int mount_root_path_tmpfs(void)
 #define mount_root_path_tmpfs() 0
 #endif
 
-static guint id_booting_done;
 static guint id_block_poweroff;
 
 static void block_init(void *data)
@@ -3715,22 +3701,12 @@ static void block_init(void *data)
        if (ret < 0)
                _E("Failed to get internal storage number.");
 
-       if (check_system_boot_finished() != 0) {
-               _I("System session is already loaded.");
-               id_booting_done = 0;
-               booting_done();
-       } else {
-               /* System Session is loaded completely */
-               id_booting_done = subscribe_dbus_signal(NULL, SYSTEMD_DBUS_PATH,
-                               SYSTEMD_DBUS_IFACE_MANAGER,
-                               SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED,
-                               booting_done_received, NULL, NULL);
-       }
-
        id_block_poweroff = subscribe_dbus_signal(NULL, DEVICED_PATH_POWEROFF,
                        DEVICED_INTERFACE_POWEROFF,
                        SIGNAL_POWEROFF_STATE,
                        block_poweroff, NULL, NULL);
+
+       booting_done();
 }
 static void terminate_threads(void)
 {
@@ -3764,7 +3740,6 @@ static void block_exit(void *data)
        udev_exit(NULL);
 
        /* unregister notifier for below each event */
-       unsubscribe_dbus_signal(NULL, id_booting_done);
        unsubscribe_dbus_signal(NULL, id_block_poweroff);
 
        /* unregister mmc uevent control routine */
index f08fb440356d40a665318a2a7a17a6cd54eb1069..aac728acd1c7422bc0e4e4091136d620e09077d8 100644 (file)
@@ -33,7 +33,6 @@
 #include <tzplatform_config.h>
 #include <glib.h>
 #include <libsyscommon/dbus-system.h>
-#include <libsyscommon/systemd-state.h>
 
 #include "log.h"
 #include "config-parser.h"
@@ -99,7 +98,6 @@ struct storage_config_info {
 static guint memnoti_timer;
 static int noti_id;
 
-static guint id_booting_done;
 static guint id_storage_poweroff;
 
 static struct storage_config_info storage_internal_info = {
@@ -650,18 +648,6 @@ static void booting_done(void)
                _E("Failed to remain mem noti control fd init.");
 }
 
-static void booting_done_received(GDBusConnection  *conn,
-               const gchar *sender,
-               const gchar *path,
-               const gchar *iface,
-               const gchar *name,
-               GVariant *param,
-               gpointer data)
-{
-       _I("Signal received: %s", SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED);
-       booting_done();
-}
-
 static void storage_poweroff(GDBusConnection  *conn,
                const gchar *sender,
                const gchar *path,
@@ -730,28 +716,17 @@ static void storage_init(void *data)
        if (ret < 0)
                _E("Failed to make directory: %d", errno);
 
-       if (check_system_boot_finished() != 0) {
-               _I("System session is already loaded.");
-               id_booting_done = 0;
-               booting_done();
-       } else {
-               /* System Session is loaded completely */
-               id_booting_done = subscribe_dbus_signal(NULL, SYSTEMD_DBUS_PATH,
-                               SYSTEMD_DBUS_IFACE_MANAGER,
-                               SYSTEMD_DBUS_SIGNAL_SYSTEM_STARTUP_FINISHED,
-                               booting_done_received, NULL, NULL);
-       }
-
        id_storage_poweroff = subscribe_dbus_signal(NULL, DEVICED_PATH_POWEROFF,
                        DEVICED_INTERFACE_POWEROFF,
                        SIGNAL_POWEROFF_STATE,
                        storage_poweroff, NULL, NULL);
+
+       booting_done();
 }
 
 static void storage_exit(void *data)
 {
        /* unregister notifier for below each event */
-       unsubscribe_dbus_signal(NULL, id_booting_done);
        unsubscribe_dbus_signal(NULL, id_storage_poweroff);
 }
 
index 61527cc38e62e7cdaab08c25cbf5e52f785c8195..cdccc0f7470fabef0096845cf253391feea4d408 100644 (file)
@@ -1,7 +1,8 @@
 [Unit]
 Description=System storage daemon
 Requires=dbus.socket
-After=dbus.service deviced.service
+Wants=wait-mount@opt-usr.service
+After=dbus.service deviced.service wait-mount@opt-usr.service
 
 [Service]
 Type=notify