Wait for completion of device mapping in mountObb
The VolumeManager::mountObb() creates a mapping between
a loopback device and a dm device. However the device-mapper
carries it out asynchronously, so there is a possibility that
Vold accesses to the dm device which is being built. Added
waiting for completion of the mapping in that function, like
mountAsec().
To verify install FrameworksCoreTests.apk and do:
adb shell am instrument -r -w -e class android.os.storage.\
StorageManagerIntegrationTest#testMountTwoEncryptedObb \
com.android.frameworks.coretests/android.test.\
InstrumentationTestRunner
Change-Id: If42f4b7494bb2f8a8b72d106ad84b3e3bf91fd9b
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
old mode 100644
new mode 100755
index d6907f2..da4deb6
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -1438,6 +1438,11 @@
}
}
+ /*
+ * Wait for the device mapper node to be created.
+ */
+ waitForDevMapper(dmDevice);
+
if (Fat::doMount(dmDevice, mountPoint, true, false, true, 0, ownerGid,
0227, false)) {
SLOGE("Image mount failed (%s)", strerror(errno));