My assumption (which seems to be incorrect) was that ecryptfs (FUSE filesystems in general) used the following stacking mechanism:

  • User code issues read()
  • Kernel attempts to satisfy request from existing (unencrypted) buffer
  • Buffer doesn't exist, kernel asks ecryptfs to load block
  • ecryptfs asks kernel to load physical (encrypted) block, kernel does this and stores it in buffer cache
  • ecryptfs decrypts physical block
  • kernel stores decrypted block in buffer cache
  • subsequent reads are fulfilled from decrypted block in cache

However, comparing the "sys" times for identical operations on encrypted and non-encrypted filesystems, it appears that the only buffer in the cache is the encrypted one, and ecryptfs decrypts on every read(). The diagram on the FUSE homepage doesn't mention buffer cache, but seems to indicate that operations take place at the syscall level, not the block level.

Could someone who is familiar with either the internals of ecryptfs (Dustin?) or FUSE in general answer this?

migrated from askubuntu.com Jun 5 '14 at 17:34

This question came from our site for Ubuntu users and developers.

  • When talking to people on #zfs, I was told that it is the VFS that caches files. Not the filesystem, not the block device. I do not know any better, just repeating. – ArekBulski Oct 26 '15 at 20:27
  • Source code has 10K lines of code. Reading through all of it would take a whole day at least, but is doable. github.com/torvalds/linux/tree/master/fs/ecryptfs – ArekBulski Oct 26 '15 at 20:29
  • Ecryptfs is stackable on another filesystem, so it does not load physical blocks from disk, it reads a file from filesystem beneath. Lower filesystem reads from block device. Block device sends read requests to disk. – ArekBulski Oct 28 '15 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.