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
gugelfrei
Lars Svensson 13 years ago committed by Bjorn Andersson
parent 3ad9072a5d
commit 6273661968

@ -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)",

Loading…
Cancel
Save