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
diff --git a/DirectVolume.cpp b/DirectVolume.cpp
index 4acee76..c745c93 100644
--- a/DirectVolume.cpp
+++ b/DirectVolume.cpp
@@ -275,6 +275,11 @@
     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)",