Correctly remove asecs for full disk encryption
Previously this would fail if the framework wasn't stopped. The failure
would then stop full disk encryption. The fact that the unmount worked,
however, would then stop the second attempt from achieving anything.
Fix in line with current retry philosophy
We still need to figure out why Devmapper::destroy() fails at first.
Bug: 17301843
Change-Id: I405a36c832ccdebf2d904bef77f15eea174a6bfb
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index b2b0cf6..14f1509 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -1090,8 +1090,14 @@
SLOGE("Timed out trying to rmdir %s (%s)", mountPoint, strerror(errno));
}
- if (Devmapper::destroy(idHash) && errno != ENXIO) {
- SLOGE("Failed to destroy devmapper instance (%s)", strerror(errno));
+ for (i=1; i <= UNMOUNT_RETRIES; i++) {
+ if (Devmapper::destroy(idHash) && errno != ENXIO) {
+ SLOGE("Failed to destroy devmapper instance (%s)", strerror(errno));
+ usleep(UNMOUNT_SLEEP_BETWEEN_RETRY_MS);
+ continue;
+ } else {
+ break;
+ }
}
char loopDevice[255];