diff options
author | Zim <zezeozue@google.com> | 2019-10-17 21:06:12 +0100 |
---|---|---|
committer | Zim <zezeozue@google.com> | 2019-11-12 10:41:49 +0000 |
commit | 7e0d314c5ed4979688743bf36bc8d495a3e61e22 (patch) | |
tree | 2335af6ec71b478e9fc3d7a00df588473ffb0699 /jni/com_android_providers_media_FuseDaemon.cpp | |
parent | 13bad15461d650fda9ee8b0e3e276fa2f772ec9a (diff) | |
download | MediaProvider-7e0d314c5ed4979688743bf36bc8d495a3e61e22.tar.gz |
Stop FUSE sessions properly
Now when we call ExternalStorageService#onEndSession
we block to ensure the FUSE loop has exited. This allows
us avoid racing mount and unmount events.
Typical usage: Vold#unmount -> ExternalStorageService#waitForExit
We don't use fuse_session_exit provided by libfuse because it needs
to be called from a signal handler or a FUSE operation handler.
Those are the only ways the loop can break out of a blocking read(2)
to accept the set 'exit' flag.
Test: atest AdoptableHostTest
Bug: 142109745
Change-Id: Ib0d525792eecd813ed4c7c30db5cb9d3053668c0
Diffstat (limited to 'jni/com_android_providers_media_FuseDaemon.cpp')
-rw-r--r-- | jni/com_android_providers_media_FuseDaemon.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/jni/com_android_providers_media_FuseDaemon.cpp b/jni/com_android_providers_media_FuseDaemon.cpp index a6a8d1844..1633b991f 100644 --- a/jni/com_android_providers_media_FuseDaemon.cpp +++ b/jni/com_android_providers_media_FuseDaemon.cpp @@ -15,7 +15,7 @@ */ // Need to use LOGE_EX. -#define LOG_TAG "FuseDaemon" +#define LOG_TAG "FuseDaemonJNI" #include <nativehelper/scoped_utf_chars.h> @@ -49,12 +49,6 @@ void com_android_providers_media_FuseDaemon_start(JNIEnv* env, jobject self, jlo daemon->Start(fd, string_path); } -void com_android_providers_media_FuseDaemon_stop(JNIEnv* env, jobject self, jlong java_daemon) { - LOG(DEBUG) << "Stopping the FUSE daemon..."; - fuse::FuseDaemon* const daemon = reinterpret_cast<fuse::FuseDaemon*>(java_daemon); - daemon->Stop(); -} - void com_android_providers_media_FuseDaemon_delete(JNIEnv* env, jobject self, jlong java_daemon) { LOG(DEBUG) << "Destroying the FUSE daemon..."; fuse::FuseDaemon* const daemon = reinterpret_cast<fuse::FuseDaemon*>(java_daemon); @@ -66,8 +60,6 @@ const JNINativeMethod methods[] = { reinterpret_cast<void*>(com_android_providers_media_FuseDaemon_new)}, {"native_start", "(JILjava/lang/String;)V", reinterpret_cast<void*>(com_android_providers_media_FuseDaemon_start)}, - {"native_stop", "(J)V", - reinterpret_cast<void*>(com_android_providers_media_FuseDaemon_stop)}, {"native_delete", "(J)V", reinterpret_cast<void*>(com_android_providers_media_FuseDaemon_delete)}}; } // namespace |