diff options
author | Lars Svensson <lars1.svensson@sonyericsson.com> | 2011-04-07 15:17:43 +0200 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@sonymobile.com> | 2012-05-07 15:16:23 -0700 |
commit | 627366196859339d72ab9f68a817dd395a13468f (patch) | |
tree | 26775166f46cbb10fd767dccc26b9ca06dd2b1fc | |
parent | 3ad9072a5d6f6bda32123b367545649364e3c11d (diff) | |
download | system_vold-627366196859339d72ab9f68a817dd395a13468f.tar.gz system_vold-627366196859339d72ab9f68a817dd395a13468f.tar.bz2 system_vold-627366196859339d72ab9f68a817dd395a13468f.zip |
Unshare ums when SD card is removed
If SD card is removed without unmounting when in USB mass storage mode
the ums share is not properly closed and the device files 179:0 and 179:1
are left in use. This causes erratic behaviour on subsequent operations on
the card, i.e. mounting and formatting will fail.
Change-Id: I757703c6282f4b76e2d8b027f4644920737309b6
-rw-r--r-- | DirectVolume.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/DirectVolume.cpp b/DirectVolume.cpp index 4acee76..c745c93 100644 --- a/DirectVolume.cpp +++ b/DirectVolume.cpp @@ -275,6 +275,11 @@ void DirectVolume::handleDiskRemoved(const char *devpath, NetlinkEvent *evt) { int major = atoi(evt->findParam("MAJOR")); int minor = atoi(evt->findParam("MINOR")); char msg[255]; + bool enabled; + + if (mVm->shareEnabled(getLabel(), "ums", &enabled) == 0 && enabled) { + mVm->unshareVolume(getLabel(), "ums"); + } SLOGD("Volume %s %s disk %d:%d removed\n", getLabel(), getMountpoint(), major, minor); snprintf(msg, sizeof(msg), "Volume %s %s disk removed (%d:%d)", |