diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2016-04-05 18:32:52 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-04-05 18:32:52 +0000 |
| commit | 28d8a526bca8bd002cefb89b5ee694f688c82c22 (patch) | |
| tree | 4aecd4f035329ab92a2ea2d098a107d28ec0ac2a /init/builtins.cpp | |
| parent | 4057273b62b54c5913afa46ce4a1dc3e497845dd (diff) | |
| parent | eb2989e6fbb8652a464b3c096b4e71455e94843a (diff) | |
Merge "init: watchdog restarted during shutdown fsck"
Diffstat (limited to 'init/builtins.cpp')
| -rw-r--r-- | init/builtins.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 6469ec4886..b3bd418010 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -21,6 +21,7 @@ #include <mntent.h> #include <net/if.h> #include <signal.h> +#include <sched.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -129,6 +130,16 @@ static void unmount_and_fsck(const struct mntent *entry) { ServiceManager::GetInstance().ForEachService([] (Service* s) { s->Stop(); }); TEMP_FAILURE_RETRY(kill(-1, SIGKILL)); + // Restart Watchdogd to allow us to complete umounting and fsck + Service *svc = ServiceManager::GetInstance().FindServiceByName("watchdogd"); + if (svc) { + do { + sched_yield(); // do not be so eager, let cleanup have priority + ServiceManager::GetInstance().ReapAnyOutstandingChildren(); + } while (svc->flags() & SVC_RUNNING); // Paranoid Cargo + svc->Start(); + } + int count = 0; while (count++ < UNMOUNT_CHECK_TIMES) { int fd = TEMP_FAILURE_RETRY(open(entry->mnt_fsname, O_RDONLY | O_EXCL)); @@ -149,6 +160,11 @@ static void unmount_and_fsck(const struct mntent *entry) { } } + // NB: With watchdog still running, there is no cap on the time it takes + // to complete the fsck, from the users perspective the device graphics + // and responses are locked-up and they may choose to hold the power + // button in frustration if it drags out. + int st; if (!strcmp(entry->mnt_type, "f2fs")) { const char *f2fs_argv[] = { |
