07 Feb, 2008

8 commits

  • Jeff Moyer pointed out that a mount; umount loop of ecryptfs, with the same
    cipher & other mount options, created a new ecryptfs_key_tfm_cache item
    each time, and the cache could grow quite large this way.

    Looking at this with mhalcrow, we saw that ecryptfs_parse_options()
    unconditionally called ecryptfs_add_new_key_tfm(), which is what was adding
    these items.

    Refactor ecryptfs_get_tfm_and_mutex_for_cipher_name() to create a new
    helper function, ecryptfs_tfm_exists(), which checks for the cipher on the
    cached key_tfm_list, and sets a pointer to it if it exists. This can then
    be called from ecryptfs_parse_options(), and new key_tfm's can be added
    only when a cached one is not found.

    With list locking changes suggested by akpm.

    Signed-off-by: Eric Sandeen
    Cc: Michael Halcrow
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Only the lower byte of cipher_code is ever used, so it makes sense
    for its type to be u8.

    Signed-off-by: Trevor Highland
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trevor Highland
     
  • The printk statements that result when the user does not have the
    proper key available could use some refining.

    Signed-off-by: Mike Halcrow
    Cc: Mike Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • ecryptfs_debug really should not be a mount option; it is not per-mount,
    but rather sets a global "ecryptfs_verbosity" variable which affects all
    mounted filesysytems. It's already settable as a module load option,
    I think we can leave it at that.

    Also, if set, since secret values come out in debug messages, kick
    things off with a stern warning.

    Signed-off-by: Eric Sandeen
    Acked-by: Mike Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Change ecryptfs_show_options to reflect the actual mount options in use.
    Note that this does away with the "dir=" output, which is not a valid mount
    option and appears to be unused.

    Mount options such as "ecryptfs_verbose" and "ecryptfs_xattr_metadata" are
    somewhat indeterminate for a given fs, but in any case the reported mount
    options can be used in a new mount command to get the same behavior.

    [akpm@linux-foundation.org: fix printk warning]
    Signed-off-by: Eric Sandeen
    Acked-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • There is no need to keep re-setting the same key for any given eCryptfs inode.
    This patch optimizes the use of the crypto API and helps performance a bit.

    Signed-off-by: Trevor Highland
    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Trevor Highland
     
  • Remove internal references to header extents; just keep track of header bytes
    instead. Headers can easily span multiple pages with the recent persistent
    file changes.

    Signed-off-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     
  • - make the following needlessly global code static:
    - crypto.c:ecryptfs_lower_offset_for_extent()
    - crypto.c:key_tfm_list
    - crypto.c:key_tfm_list_mutex
    - inode.c:ecryptfs_getxattr()
    - main.c:ecryptfs_init_persistent_file()

    - remove the no longer used mmap.c:ecryptfs_lower_page_cache

    - #if 0 the unused read_write.c:ecryptfs_read()

    Signed-off-by: Adrian Bunk
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

06 Feb, 2008

1 commit

  • Simplify page cache zeroing of segments of pages through 3 functions

    zero_user_segments(page, start1, end1, start2, end2)

    Zeros two segments of the page. It takes the position where to
    start and end the zeroing which avoids length calculations and
    makes code clearer.

    zero_user_segment(page, start, end)

    Same for a single segment.

    zero_user(page, start, length)

    Length variant for the case where we know the length.

    We remove the zero_user_page macro. Issues:

    1. Its a macro. Inline functions are preferable.

    2. The KM_USER0 macro is only defined for HIGHMEM.

    Having to treat this special case everywhere makes the
    code needlessly complex. The parameter for zeroing is always
    KM_USER0 except in one single case that we open code.

    Avoiding KM_USER0 makes a lot of code not having to be dealing
    with the special casing for HIGHMEM anymore. Dealing with
    kmap is only necessary for HIGHMEM configurations. In those
    configurations we use KM_USER0 like we do for a series of other
    functions defined in highmem.h.

    Since KM_USER0 is depends on HIGHMEM the existing zero_user_page
    function could not be a macro. zero_user_* functions introduced
    here can be be inline because that constant is not used when these
    functions are called.

    Also extract the flushing of the caches to be outside of the kmap.

    [akpm@linux-foundation.org: fix nfs and ntfs build]
    [akpm@linux-foundation.org: fix ntfs build some more]
    Signed-off-by: Christoph Lameter
    Cc: Steven French
    Cc: Michael Halcrow
    Cc:
    Cc: Steven Whitehouse
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Anton Altaparmakov
    Cc: Mark Fasheh
    Cc: David Chinner
    Cc: Michael Halcrow
    Cc: Steven French
    Cc: Steven Whitehouse
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

29 Jan, 2008

1 commit


25 Jan, 2008

8 commits


09 Jan, 2008

1 commit

  • This patch corrects some erroneous dentry handling in eCryptfs.

    If there is a problem creating the lower file, then there is nothing that
    the persistent lower file can do to really help us. This patch makes a
    vfs_create() failure in the lower filesystem always lead to an
    unconditional do_create failure in eCryptfs.

    Under certain sequences of operations, the eCryptfs dentry can remain in
    the dcache after an unlink. This patch calls d_drop() on the eCryptfs
    dentry to correct this.

    eCryptfs has no business calling d_delete() directly on a lower
    filesystem's dentry. This patch removes the call to d_delete() on the
    lower persistent file's dentry in ecryptfs_destroy_inode().

    (Thanks to David Kleikamp, Eric Sandeen, and Jeff Moyer for helping
    identify and resolve this issue)

    Signed-off-by: Michael Halcrow
    Cc: Dave Kleikamp
    Cc: Eric Sandeen
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Halcrow
     

24 Dec, 2007

3 commits

  • Thanks to Jeff Moyer for pointing this out.

    If the RDWR dentry_open() in ecryptfs_init_persistent_file fails,
    it will do a dput/mntput. Need to re-take references if we
    retry as RDONLY.

    Signed-off-by: Eric Sandeen
    Acked-by: Mike Halcrow
    Signed-off-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Thanks to Josef Bacik for finding these.

    A couple of ecryptfs error paths don't properly unlock things they locked.

    Signed-off-by: Eric Sandeen
    Cc: Josef Bacik
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • Passing a cipher name > 32 chars on mount results in an overflow when the
    cipher name is printed, because the last character in the struct
    ecryptfs_key_tfm's cipher_name string was never zeroed.

    Signed-off-by: Eric Sandeen
    Acked-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

18 Dec, 2007

3 commits

  • ecryptfs in 2.6.24-rc3 wasn't surviving fsx for me at all, dying after 4
    ops. Generally, encountering problems with stale data and improperly
    zeroed pages. An extending truncate + write for example would expose stale
    data.

    With the changes below I got to a million ops and beyond with all mmap ops
    disabled - mmap still needs work. (A version of this patch on a RHEL5
    kernel ran for over 110 million fsx ops)

    I added a few comments as well, to the best of my understanding
    as I read through the code.

    Signed-off-by: Eric Sandeen
    Acked-by: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • eCryptfs wasn't setting s_blocksize in it's superblock; just pick it up
    from the lower FS. Having an s_blocksize of 0 made things like "filefrag"
    which call FIGETBSZ unhappy.

    Signed-off-by: Eric Sandeen
    Acked-by: Mike Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     
  • ecryptfs_destroy_mount_crypt_stat() checks whether each
    auth_tok->global_auth_tok_key is nonzero and if so puts that key. However,
    in some early mount error paths nothing has initialized the pointer, and we
    try to key_put() garbage. Running the bad cipher tests in the testsuite
    exposes this, and it's happy with the following change.

    Signed-off-by: Eric Sandeen
    Cc: Michael Halcrow
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

15 Nov, 2007

1 commit


06 Nov, 2007

2 commits


27 Oct, 2007

1 commit


24 Oct, 2007

1 commit


23 Oct, 2007

1 commit


19 Oct, 2007

1 commit

  • Make sure ecryptfs doesn't trip the BUG() in notify_change. This also allows
    the lower filesystem to interpret ATTR_KILL_S*ID in its own way.

    Signed-off-by: Jeff Layton
    Cc: Michael Halcrow
    Cc: Christoph Hellwig
    Cc: Neil Brown
    Cc: "J. Bruce Fields"
    Cc: Chris Mason
    Cc: Jeff Mahoney
    Cc: "Vladimir V. Saveliev"
    Cc: Josef 'Jeff' Sipek
    Cc: Trond Myklebust
    Cc: Steven French
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Layton
     

17 Oct, 2007

8 commits