print information about opened files when failed unmount

Change-Id: I88ae719cdae490433390d624f75612a9f4f96677

Cryptfs : Enabling support for allow_discards in dmcrypt.
Cryptfs : Password matches
Cryptfs : test_mount_encrypted_fs(): Master key saved
TrustyKeymaster: Creating device
TrustyKeymaster: Device address: 0x7f8f416100
Cryptfs : keymaster version is 3
Cryptfs : Just asked init to shut down class main
ServiceManager: service 'drm.drmManager' died
ServiceManager: service 'media.audio_flinger' died
ServiceManager: service 'media.player' died
ServiceManager: service 'media.camera' died
ServiceManager: service 'android.security.keystore' died
Cryptfs : unmounting /data failed

Bug: 17576594
This commit is contained in:
jessica_yu 2014-09-22 15:57:40 +08:00 committed by Greg Hackmann
parent 3846be17fe
commit 3f14fe45a3
3 changed files with 15 additions and 0 deletions

View file

@ -170,6 +170,10 @@ int Process::getPid(const char *s) {
return result;
}
extern "C" void vold_killProcessesWithOpenFiles(const char *path, int action) {
Process::killProcessesWithOpenFiles(path, action);
}
/*
* Hunt down processes that have files open at the given mount point.
* action = 0 to just warn,

View file

@ -17,6 +17,8 @@
#ifndef _PROCESS_H
#define _PROCESS_H
#ifdef __cplusplus
class Process {
public:
static void killProcessesWithOpenFiles(const char *path, int action);
@ -32,4 +34,11 @@ private:
static int pathMatchesMountPoint(const char *path, const char *mountPoint);
};
extern "C" {
#endif /* __cplusplus */
void vold_killProcessesWithOpenFiles(const char *path, int action);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -53,6 +53,7 @@
#include "ext4_utils.h"
#include "f2fs_sparseblock.h"
#include "CheckBattery.h"
#include "Process.h"
#include <hardware/keymaster.h>
@ -1450,6 +1451,7 @@ static int wait_and_unmount(char *mountpoint)
SLOGD("unmounting %s succeeded\n", mountpoint);
rc = 0;
} else {
vold_killProcessesWithOpenFiles(mountpoint, 0);
SLOGE("unmounting %s failed\n", mountpoint);
rc = -1;
}