authfs: Drop support of direct I/O
Previously, there was a plan to use dm-verity to verify disk image over
authfs. Supporting direct I/O for those files allows us to avoid an
extra buffer. The plan has changed, so let's get rid of the support.
Bug: 186265793
Test: run dex2oat, saw mmap(2) succeeds
Change-Id: Id556f5ae9b02f1c30f6e9b605d1d48a039989fba
diff --git a/authfs/src/fusefs.rs b/authfs/src/fusefs.rs
index d97291c..0cd8b68 100644
--- a/authfs/src/fusefs.rs
+++ b/authfs/src/fusefs.rs
@@ -257,27 +257,19 @@
// return None as the handle.
match self.get_file_config(&inode)? {
FileConfig::LocalVerifiedReadonlyFile { .. }
- | FileConfig::RemoteVerifiedReadonlyFile { .. } => {
- check_access_mode(flags, libc::O_RDONLY)?;
- // Once verified, and only if verified, the file content can be cached. This is not
- // really needed for a local file, but is the behavior of RemoteVerifiedReadonlyFile
- // later.
- Ok((None, fuse::sys::OpenOptions::KEEP_CACHE))
- }
- FileConfig::LocalUnverifiedReadonlyFile { .. }
+ | FileConfig::LocalUnverifiedReadonlyFile { .. }
+ | FileConfig::RemoteVerifiedReadonlyFile { .. }
| FileConfig::RemoteUnverifiedReadonlyFile { .. } => {
check_access_mode(flags, libc::O_RDONLY)?;
- // Do not cache the content. This type of file is supposed to be verified using
- // dm-verity. The filesystem mount over dm-verity already is already cached, so use
- // direct I/O here to avoid double cache.
- Ok((None, fuse::sys::OpenOptions::DIRECT_IO))
}
FileConfig::RemoteVerifiedNewFile { .. } => {
// No need to check access modes since all the modes are allowed to the
// read-writable file.
- Ok((None, fuse::sys::OpenOptions::KEEP_CACHE))
}
}
+ // Always cache the file content. There is currently no need to support direct I/O or avoid
+ // the cache buffer. Memory mapping is only possible with cache enabled.
+ Ok((None, fuse::sys::OpenOptions::KEEP_CACHE))
}
fn read<W: io::Write + ZeroCopyWriter>(