← Back to team overview

ecryptfs team mailing list archive

[Bug 431975] Re: downloading a torrent to an encrypted home partition hangs and uses 100% CPU

 

After taking a look at the call trace during a truncate that extends a
file, eCryptfs could probably handle this in a more efficient way.

-> ecryptfs_setattr
 -> ecryptfs_truncate
  -> ecryptfs_write
...
   -> ecryptfs_get_locked_page
    -> ecryptfs_readpage
     -> ecryptfs_read_lower_page_segment
      -> kmap
      <- kmap
      -> ecryptfs_read_lower
      <- ecryptfs_read_lower
     <- ecryptfs_read_lower_page_segment
    <- ecryptfs_readpage
   <- ecryptfs_get_locked_page
   -> ecryptfs_encrypt_page
    -> alloc_pages_node").call
    <- alloc_pages_node").return
    -> kmap
    <- kmap
    -> ecryptfs_encrypt_extent
     -> ecryptfs_derive_iv
      -> ecryptfs_calculate_md5
      <- ecryptfs_calculate_md5
     <- ecryptfs_derive_iv
    <- ecryptfs_encrypt_extent
    -> ecryptfs_write_lower
    <- ecryptfs_write_lower
   <- ecryptfs_encrypt_page
...
  <- ecryptfs_write
 <- ecryptfs_truncate
<- ecryptfs_setattr

I don't think there's any need for the ecryptfs_readpage ->
ecryptfs_read_lower_page_segment -> ecryptfs_read_lower sequence, as we
know that we just need to encrypt a bunch of zeroes.  Fixing that will
improve performance, but the CPU is still likely to be pegged pretty
high while doing all the encryption operations.

Improving the truncate path would really be a nice-to-have improvement,
but I will probably not be able to devote much time to it.  If someone
wants to try to tackle it, I'll be more than happy to provide any help
that I can.

** Also affects: ecryptfs
   Importance: Undecided
       Status: New

** Changed in: ecryptfs
       Status: New => Triaged

** Changed in: ecryptfs
   Importance: Undecided => Low

** Changed in: ecryptfs
   Importance: Low => Wishlist

-- 
downloading a torrent to an encrypted home partition hangs and uses 100% CPU
https://bugs.launchpad.net/bugs/431975
You received this bug notification because you are a member of eCryptfs,
which is subscribed to ecryptfs-utils in ubuntu.

Status in eCryptfs - Enterprise Cryptographic Filesystem: Triaged
Status in “ecryptfs-utils” package in Ubuntu: Incomplete

Bug description:
Karmic with all updates. Home is encrypted with ecryptfs.
I have tried downloading several torrents with thansmission and rtorrent. When downloading to the encrypted home, both programs hang, use 100% CPU and I can't kill them. Downloading to /tmp, which is not encrypted works.