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
gugelfrei
yoshiyuki hama 10 years ago committed by Johan Redestig
parent f8c905e043
commit 476a627e55

@ -1438,6 +1438,11 @@ int VolumeManager::mountObb(const char *img, const char *key, int ownerGid) {
}
}
/*
* 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));

Loading…
Cancel
Save