vold: retry mounting partition
Works around a race condition between the vold and MountService uevent handlers
Change-Id: I71c92f2e9b92e1fefc192da166a91d81bc60e242
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/Volume.cpp b/Volume.cpp
index 685cb35..45db27e 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -116,6 +116,7 @@
mState = Volume::State_Init;
mCurrentlyMountedKdev = -1;
mPartIdx = -1;
+ mRetryMount = false;
}
Volume::~Volume() {
@@ -174,6 +175,10 @@
return;
}
+ if ((oldState == Volume::State_Pending) && (state != Volume::State_Idle)) {
+ mRetryMount = false;
+ }
+
mState = state;
SLOGD("Volume %s state changing %d (%s) -> %d (%s)", mLabel,
@@ -309,6 +314,9 @@
return -1;
} else if (getState() != Volume::State_Idle) {
errno = EBUSY;
+ if (getState() == Volume::State_Pending) {
+ mRetryMount = true;
+ }
return -1;
}