OpenAFS Master Repository branch, openafs-stable-1_4_x, updated. openafs-stable-1_4_12-140-g654b5c5

Gerrit Code Review
Tue, 14 Aug 2012 06:20:49 -0700 (PDT)

The following commit has been merged in the openafs-stable-1_4_x branch:
commit 94b6648c1f324a34336ed5ada3ad25d5f52ac5e8
Author: Andrew Deason <>
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
    Tested-by: BuildBot <>
    Tested-by: Andrew Deason <>
    Reviewed-by: Derrick Brashear <>
    (cherry picked from commit de381aa0d39e88a1ca0c8ccbb2471c5cad5a964c)
    Change-Id: I42959ab0c09e5b752660cd87293c63ca7978d242
    Tested-by: BuildBot <>
    Reviewed-by: Derrick Brashear <>

 acinclude.m4                 |    1 +
 src/afs/LINUX/osi_vnodeops.c |  143 ++++++++++++++++++++++++++++++++++++++---
 src/afs/afs.h                |    7 ++
 3 files changed, 140 insertions(+), 11 deletions(-)

OpenAFS Master Repository