Hot Fix for delay of unit stop 27/182327/3 accepted/tizen/4.0/unified/20180622.231441 submit/tizen_4.0/20180622.051742
authorseolheui kim <s414.kim@samsung.com>
Fri, 22 Jun 2018 04:39:24 +0000 (13:39 +0900)
committerseolheui kim <s414.kim@samsung.com>
Fri, 22 Jun 2018 05:11:38 +0000 (14:11 +0900)
Change-Id: I7f436995cecfefe313d36549b308ddbf459abeb3
Signed-off-by: seolheui kim <s414.kim@samsung.com>
server/internal-encryption.cpp

index e5f77ce..aaeb9e2 100644 (file)
@@ -163,8 +163,7 @@ void stopKnownSystemdUnits()
                } else if (unit.compare(0, 5, "user@") == 0 ||
                        unit == "tlm.service" ||
                        unit == "resourced.service" ||
-                       unit == "security-manager.service" ||
-                       unit == "samsung-log-mgr.service") {
+                       unit == "security-manager.service") {
                        knownSystemdUnits.push_back(unit);
                }
        }
@@ -189,6 +188,7 @@ void stopDependedSystemdUnits()
 {
        dbus::Connection& systemDBus = dbus::Connection::getSystem();
        std::set<std::string> unitsToStop;
+       pid_t p = -1;
 
        for (pid_t pid : runtime::FileUser::getList(INTERNAL_PATH, true)) {
                try {
@@ -199,7 +199,12 @@ void stopDependedSystemdUnits()
                                                                        "GetUnitByPID",
                                                                        -1, "(o)", "(u)", (unsigned int)pid)
                                                                                .get("(o)", &unit);
-                       unitsToStop.insert(unit);
+
+                       if (std::string(unit) ==
+                                       "/org/freedesktop/systemd1/unit/samsung_2dlog_2dmgr_2eservice")
+                               p = pid;
+                       else
+                               unitsToStop.insert(unit);
                } catch (runtime::Exception &e) {
                        INFO(SINK, "Killing process: " + std::to_string(pid));
                        ::kill(pid, SIGKILL);
@@ -220,6 +225,12 @@ void stopDependedSystemdUnits()
                if (!watch.waitForJob(job))
                        throw runtime::Exception("Stopping unit: " + unit + " failed");
        }
+
+       if (::umount2("/sys/fs/cgroup", MNT_FORCE | MNT_DETACH) != 0)
+               INFO(SINK, "Failed to unmount cgroup");
+
+       if (p != -1)
+               ::kill(p, SIGKILL);
 }
 
 void showProgressUI(const std::string type)