diff options
| author | 2016-06-22 09:04:33 -0600 | |
|---|---|---|
| committer | 2016-06-22 10:32:17 -0600 | |
| commit | a31460ce1206ad938a809a2e19d51d2283398943 (patch) | |
| tree | a24fbd530236f88dec962f672ad7e51177239642 | |
| parent | 94a20367b50a16f8c0143a90135b8b384c6b9d9d (diff) | |
Start primary storage move outside lock.
Otherwise there is a potential deadlock when an unsolicited event
arrives from vold while we're still waiting for the move operation
to be processed.
The safe fix here is to kick off the move after dropping the lock.
Bug: 29501052
Change-Id: I2160c6a7a19c1d9981c692a2be2b04019352db2e
| -rw-r--r-- | services/core/java/com/android/server/MountService.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 9c75a009d7af..55464e4cb7c8 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -2030,6 +2030,9 @@ class MountService extends IMountService.Stub enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS); waitForReady(); + final VolumeInfo from; + final VolumeInfo to; + synchronized (mLock) { if (Objects.equals(mPrimaryStorageUuid, volumeUuid)) { throw new IllegalArgumentException("Primary storage already at " + volumeUuid); @@ -2049,10 +2052,11 @@ class MountService extends IMountService.Stub onMoveStatusLocked(MOVE_STATUS_COPY_FINISHED); onMoveStatusLocked(PackageManager.MOVE_SUCCEEDED); mHandler.obtainMessage(H_RESET).sendToTarget(); + return; } else { - final VolumeInfo from = findStorageForUuid(mPrimaryStorageUuid); - final VolumeInfo to = findStorageForUuid(volumeUuid); + from = findStorageForUuid(mPrimaryStorageUuid); + to = findStorageForUuid(volumeUuid); if (from == null) { Slog.w(TAG, "Failing move due to missing from volume " + mPrimaryStorageUuid); @@ -2063,14 +2067,14 @@ class MountService extends IMountService.Stub onMoveStatusLocked(PackageManager.MOVE_FAILED_INTERNAL_ERROR); return; } - - try { - mConnector.execute("volume", "move_storage", from.id, to.id); - } catch (NativeDaemonConnectorException e) { - throw e.rethrowAsParcelableException(); - } } } + + try { + mConnector.execute("volume", "move_storage", from.id, to.id); + } catch (NativeDaemonConnectorException e) { + throw e.rethrowAsParcelableException(); + } } @Override |