OSDN Git Service

Wait for completion of device mapping in mountObb
authoryoshiyuki hama <yoshiyuki.hama@sonymobile.com>
Wed, 28 Jan 2015 07:37:23 +0000 (16:37 +0900)
committerJohan Redestig <johan.redestig@sonymobile.com>
Sat, 25 Apr 2015 10:13:17 +0000 (12:13 +0200)
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

VolumeManager.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d6907f2..da4deb6
@@ -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));