diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-08-04 07:11:29 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-08-04 07:11:29 +0000 |
commit | ba9e8c7368c6800d7b4df22e67c5b35c505a08d1 (patch) | |
tree | 2e526d23a38c14ea14a97d121e2d216774f2d480 | |
parent | e88c803a747623776a427a35f7bc5af62662cc7b (diff) | |
parent | 375ac25773d0ea48b4ae63378cca4891c926627d (diff) | |
download | vold-oreo-dr1-release.tar.gz |
release-request-c1d158b7-bec8-489c-b291-f2070225a3d9-for-git_oc-dr1-release-4245011 snap-temp-L08000000089163353android-8.0.0_r34android-8.0.0_r33android-8.0.0_r27android-8.0.0_r26android-8.0.0_r25android-8.0.0_r24android-8.0.0_r23android-8.0.0_r22android-8.0.0_r21oreo-dr3-releaseoreo-dr2-releaseoreo-dr1-release
Change-Id: Ia52395991f365708261ecda2d4589360dcd33cf4
-rw-r--r-- | Utils.cpp | 15 | ||||
-rw-r--r-- | VolumeManager.cpp | 4 | ||||
-rw-r--r-- | VolumeManager.h | 3 |
3 files changed, 15 insertions, 7 deletions
@@ -17,6 +17,7 @@ #include "sehandle.h" #include "Utils.h" #include "Process.h" +#include "VolumeManager.h" #include <android-base/file.h> #include <android-base/logging.h> @@ -126,22 +127,22 @@ status_t ForceUnmount(const std::string& path) { } // Apps might still be handling eject request, so wait before // we start sending signals - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); Process::killProcessesWithOpenFiles(cpath, SIGINT); - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); if (!umount2(cpath, UMOUNT_NOFOLLOW) || errno == EINVAL || errno == ENOENT) { return OK; } Process::killProcessesWithOpenFiles(cpath, SIGTERM); - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); if (!umount2(cpath, UMOUNT_NOFOLLOW) || errno == EINVAL || errno == ENOENT) { return OK; } Process::killProcessesWithOpenFiles(cpath, SIGKILL); - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); if (!umount2(cpath, UMOUNT_NOFOLLOW) || errno == EINVAL || errno == ENOENT) { return OK; } @@ -154,17 +155,17 @@ status_t KillProcessesUsingPath(const std::string& path) { if (Process::killProcessesWithOpenFiles(cpath, SIGINT) == 0) { return OK; } - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); if (Process::killProcessesWithOpenFiles(cpath, SIGTERM) == 0) { return OK; } - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); if (Process::killProcessesWithOpenFiles(cpath, SIGKILL) == 0) { return OK; } - sleep(5); + if (!VolumeManager::shutting_down) sleep(5); // Send SIGKILL a second time to determine if we've // actually killed everyone with open files diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 4ba0c366..83984987 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -89,6 +89,8 @@ const char *VolumeManager::ASECDIR = "/mnt/asec"; */ const char *VolumeManager::LOOPDIR = "/mnt/obb"; +bool VolumeManager::shutting_down = false; + static const char* kPathUserMount = "/mnt/user"; static const char* kPathVirtualDisk = "/data/misc/vold/virtual_disk"; @@ -704,12 +706,14 @@ int VolumeManager::shutdown() { if (mInternalEmulated == nullptr) { return 0; // already shutdown } + shutting_down = true; mInternalEmulated->destroy(); mInternalEmulated = nullptr; for (const auto& disk : mDisks) { disk->destroy(); } mDisks.clear(); + shutting_down = false; return 0; } diff --git a/VolumeManager.h b/VolumeManager.h index 796a91d3..537aebe1 100644 --- a/VolumeManager.h +++ b/VolumeManager.h @@ -70,6 +70,9 @@ public: static const char *ASECDIR; static const char *LOOPDIR; + //TODO remove this with better solution, b/64143519 + static bool shutting_down; + private: static VolumeManager *sInstance; |