Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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. – RebelScum 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 – RebelScum 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. – RebelScum Oct 28 '15 at 16:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.