OpenAFS Master Repository branch, master, updated. openafs-devel-1_5_76-2803-gde381aa

Gerrit Code Review gerrit@openafs.org
Tue, 31 Jul 2012 09:30:03 -0700 (PDT)


The following commit has been merged in the master branch:
commit de381aa0d39e88a1ca0c8ccbb2471c5cad5a964c
Author: Andrew Deason <adeason@sinenomine.net>
Date:   Fri Jul 6 16:37:39 2012 -0500

    Linux: Make dir dentry aliases act like symlinks
    
    Currently, we try to invalidate other dentries that exist for a
    particular dir inode when we look up a dentry. This is so we try to
    avoid duplicate dentries for a directory, which Linux does not like
    (you cannot have hardlinks to a dir).
    
    If we cannot invalidate the other aliases (because they are being
    used), right now we just return the alias. This can make it very easy
    to panic the client, due to the sanity checks Linux performs when dong
    things like 'rmdir'. If we do something like this:
    
    mkdir dir1
    fs mkm dir1/mtpt vol
    mkdir dir1/mtpt/dir2
    fs mkm dir1/mtpt/dir2/mtpt2 vol
    cd dir1/mtpt
    rmdir dir2/mtpt2
    
    For the 'rmdir', we will lookup 'mtpt2'. Since 'mtpt' and 'mtpt2'
    are mountpoints for the same volume, their dentries point to the same
    directory inode. So when we lookup 'mtpt2', we will try to invalidate
    the other dentry, but we cannot do that since it is the cwd. So we
    return the alias dentry (for 'mtpt'). The Linux VFS layer then does a
    sanity check for the rmdir operation, checking that the child dentry's
    parent inode is the same as the inode we're performing the rmdir for.
    Since the dentry we returned was for 'mtpt', whose parent is 'dir1',
    and the actual dir we're performing the rmdir for is 'dir2', this
    sanity check fails and we BUG.
    
    To avoid this, make the dentry alias act like a symlink when we
    encounter an uninvalidateable dentry alias. That is, we allow multiple
    dentry aliases for a directory, however, when the dentry aliases are
    actually used, we redirect to a common dentry (via d_automount where
    possible, and follow_link elsewhere).
    
    This means that such mountpoints will behave similarly to symlinks, in
    that we 'point' to a specific mountpoint dentry. This means that if we
    have multiple different ways to get to the same volume, and all are
    accessed at the same time, all but one of those mountpoints will
    behave like symlinks, pointing to the same mountpoint. So, the '..'
    entries for each path will all point to the parent dir of one
    mountpoint, meaning that the '..' entry will be "wrong", but for most
    cases it will still be correct.
    
    In order to try to make the 'target', pointed-to directory consistent,
    we add a new field to struct vcache: target_link. This points to the
    dentry we should redirect to, whenever that vcache is referenced. To
    avoid (possibly not-feasibly-solvable) problems with refcounting, this
    pointer is not actually a reference to the target dentry, but just
    serves as a pointer to compare to.
    
    FIXES 130273
    
    Change-Id: I990131ce95cefe8336e83c7ebfb48aed1d685109
    Reviewed-on: http://gerrit.openafs.org/7741
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Tested-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>

 acinclude.m4                   |    1 +
 src/afs/LINUX/osi_vnodeops.c   |  143 +++++++++++++++++++++++++++++++++++++---
 src/afs/LINUX24/osi_vnodeops.c |   95 ++++++++++++++++++++++++---
 src/afs/afs.h                  |    7 ++
 4 files changed, 227 insertions(+), 19 deletions(-)

-- 
OpenAFS Master Repository