diff options
-rw-r--r-- | DirectVolume.cpp | 4 | ||||
-rw-r--r-- | Volume.cpp | 8 | ||||
-rw-r--r-- | Volume.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/DirectVolume.cpp b/DirectVolume.cpp index 7e8ac68..fa3eb9a 100644 --- a/DirectVolume.cpp +++ b/DirectVolume.cpp @@ -220,6 +220,10 @@ void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) #endif if (getState() != Volume::State_Formatting) { setState(Volume::State_Idle); + if (mRetryMount == true) { + mRetryMount = false; + mountVol(); + } } } else { #ifdef PARTITION_DEBUG @@ -116,6 +116,7 @@ Volume::Volume(VolumeManager *vm, const char *label, const char *mount_point) { mState = Volume::State_Init; mCurrentlyMountedKdev = -1; mPartIdx = -1; + mRetryMount = false; } Volume::~Volume() { @@ -174,6 +175,10 @@ void Volume::setState(int state) { 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 @@ int Volume::mountVol() { return -1; } else if (getState() != Volume::State_Idle) { errno = EBUSY; + if (getState() == Volume::State_Pending) { + mRetryMount = true; + } return -1; } @@ -52,6 +52,7 @@ protected: VolumeManager *mVm; bool mDebug; int mPartIdx; + bool mRetryMount; /* * The major/minor tuple of the currently mounted filesystem. |