diff options
| author | San Mehat <san@google.com> | 2010-02-18 09:00:18 -0800 |
|---|---|---|
| committer | San Mehat <san@google.com> | 2010-02-18 11:48:49 -0800 |
| commit | 4ba8948dc16463053e21cda5744f519a555080d0 (patch) | |
| tree | b033c6371d77569f490bf0b4a2a7e64dbac58882 /Volume.cpp | |
| parent | d31e380bd9689dd9629b510ffe324707e261b439 (diff) | |
| download | android_system_vold-4ba8948dc16463053e21cda5744f519a555080d0.tar.gz android_system_vold-4ba8948dc16463053e21cda5744f519a555080d0.tar.bz2 android_system_vold-4ba8948dc16463053e21cda5744f519a555080d0.zip | |
vold: Add 'force' option to anything that can cause an unmount
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'Volume.cpp')
| -rw-r--r-- | Volume.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -275,7 +275,7 @@ int Volume::mountVol() { return -1; } -int Volume::unmountVol() { +int Volume::unmountVol(bool force) { int i, rc; if (getState() != Volume::State_Mounted) { @@ -285,7 +285,7 @@ int Volume::unmountVol() { } setState(Volume::State_Unmounting); - usleep(1000 * 200); // Give the framework some time to react + usleep(1000 * 1000); // Give the framework some time to react for (i = 1; i <= 10; i++) { rc = umount(getMountpoint()); if (!rc) @@ -299,17 +299,18 @@ int Volume::unmountVol() { LOGW("Volume %s unmount attempt %d failed (%s)", getLabel(), i, strerror(errno)); - int action; + int action = 0; - if (i > 8) { - action = 2; // SIGKILL - } else if (i > 7) { - action = 1; // SIGHUP - } else - action = 0; // just complain + if (force) { + if (i > 8) { + action = 2; // SIGKILL + } else if (i > 7) { + action = 1; // SIGHUP + } + } Process::killProcessesWithOpenFiles(getMountpoint(), action); - usleep(1000*250); + usleep(1000*1000); } if (!rc) { @@ -319,6 +320,7 @@ int Volume::unmountVol() { return 0; } + errno = EBUSY; LOGE("Volume %s failed to unmount (%s)\n", getLabel(), strerror(errno)); setState(Volume::State_Mounted); return -1; |
