summaryrefslogtreecommitdiff
path: root/jni/com_android_providers_media_FuseDaemon.cpp
diff options
context:
space:
mode:
authorZim <zezeozue@google.com>2020-03-06 13:45:19 +0000
committerZimuzo Ezeozue <zezeozue@google.com>2020-03-13 13:36:12 +0000
commit4d3fa27c4e041ffa57155ac83784e50bbc58c084 (patch)
tree348144119b3b21962f935e15ddf7a5fd54a6b667 /jni/com_android_providers_media_FuseDaemon.cpp
parent08cda783a77adce97f6202feee9698d9660d63ba (diff)
downloadMediaProvider-4d3fa27c4e041ffa57155ac83784e50bbc58c084.tar.gz
Prevent invalidating dentries on FUSE threads
libfuse provides an api to invalidate VFS dentries, fuse_lowlevel_notify_inval_entry. This can be useful to invalidate a dentry if it has been modified on the lower file system. This API *must* never be called on a FUSE thread. This cl takes advantage of the fact that all FUSE threads can be identified by a JNIEnv TLS pthread key. Test: Manual Bug: 149512775 Change-Id: Idc9b91d1979489568c4b1dea57212c5983950b52 Merged-In: Idc9b91d1979489568c4b1dea57212c5983950b52 (cherry picked from commit e65c95b5d0b12a048c406c8877da71d670c4197f)
Diffstat (limited to 'jni/com_android_providers_media_FuseDaemon.cpp')
-rw-r--r--jni/com_android_providers_media_FuseDaemon.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/jni/com_android_providers_media_FuseDaemon.cpp b/jni/com_android_providers_media_FuseDaemon.cpp
index 9a79412e5..fe4848f73 100644
--- a/jni/com_android_providers_media_FuseDaemon.cpp
+++ b/jni/com_android_providers_media_FuseDaemon.cpp
@@ -92,6 +92,7 @@ void com_android_providers_media_FuseDaemon_invalidate_fuse_dentry_cache(JNIEnv*
return;
}
+ CHECK_EQ(pthread_getspecific(fuse::MediaProviderWrapper::gJniEnvKey), nullptr);
daemon->InvalidateFuseDentryCache(utf_chars_path.c_str());
}
// TODO(b/145741152): Throw exception