Merge "[vold] Add mount lazy if forcemount fail." am: 823898eca3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1764385
Change-Id: If915976e128592cd93e0b7fdde4f9768f6155d1a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/model/PublicVolume.cpp b/model/PublicVolume.cpp
index b13a0ea..034fb23 100644
--- a/model/PublicVolume.cpp
+++ b/model/PublicVolume.cpp
@@ -300,8 +300,15 @@
mSdcardFsWrite.clear();
mSdcardFsFull.clear();
}
- ForceUnmount(mRawPath);
- rmdir(mRawPath.c_str());
+
+ if (ForceUnmount(mRawPath) != 0){
+ umount2(mRawPath.c_str(),MNT_DETACH);
+ PLOG(INFO) << "use umount lazy if force unmount fail";
+ }
+ if(rmdir(mRawPath.c_str()) != 0) {
+ PLOG(INFO) << "rmdir mRawPath=" << mRawPath << " fail";
+ KillProcessesUsingPath(getPath());
+ }
mRawPath.clear();
return OK;