OpenAFS Master Repository branch, master, updated. openafs-devel-1_5_76-4058-g06fe295

Gerrit Code Review
Wed, 27 Nov 2013 09:43:40 -0800 (PST)

The following commit has been merged in the master branch:
commit 06fe2957348cfb2c571f2a0b099e09ef7e9fb3b0
Author: Jeffrey Altman <>
Date:   Tue Nov 26 10:52:45 2013 -0500

    Windows: Rationalize Freelance vs "fs flush*"
    cm_scache_t objects representing Freelance volume (cell=-1, volume=-1)
    are special because they are populated from the Freelance mountpoint
    and symlink tables.  These tables are in turn generated from the
    registry.  The tables are regenerated on-demand after the execution of
    cm_noteLocalMountPointChange() which increments cm_data.fakeDirVersion
    which becomes the new data version value for the (-1.-1.1.1) directory
    The next time that cm_GetSCache() is called for a Freelance object
    the fake root directory is rebuilt by cm_InitFakeRootDir().  Since the
    vnode values are not persistent with regards to directory entry names the
    FileId unique is used to distinguish the various versions.
    cm_data.fakeUnique is incremented with each call to cm_InitFakeRootDir().
    Each time cm_noteLocalMountPointChange() is executed the afs redirector is
    notified of the data version change which will force the redirector to
    rebuild its view of the directory the next time a path evaluation requires
    evaluation of the root (\afs).  In other words, on the next request.
    If cm_noteLocalMountPointChange() is executed multiple times there is the
    possibility of a race between the redirector and the service.  When the
    race is lost the redirector receives an invalidation event for -1.-1.1.1
    as it is in the process of rebuilding the directory contents.  The
    redirector ends up believing it has the most recent data version when it
    doesn't but the service no longer has Freelance mountpoint and symlink
    tables representing the requested data version.  Hence, the mountpoints
    and symlinks end up as CM_SCACHETYPE_INVALID.
    fs flushfile and fs flushvolume both had explicit checks to prevent
    flushing Freelance objects because each call to cm_FlushFile() on a
    Freelance object would execute cm_noteLocalMountPointChange() triggering
    the race.
    The Problem:
    fs flushall is not executed on a specific object (volume or file).
    Therefore there was no explicit check to prevent execution against
    Freelance objects.  For each cm_scache_t in the cache cm_FlushFile() is
    processed.  If there are N Freelance mountpoints and symlinks, there will
    be N+1 calls to cm_noteLocalMountPointChange() in quick succession.  Not
    only does this risk losing the race described above but it is extremely
    wasteful as the Freelance tables may be repeatedly regenerated.
    This Patchset:
    This patchset re-organizes the Freelance processing in the flush code
    paths.  cm_FlushFile() and cm_FlushVolume() can simply no longer be
    successfully executed against a Freelance object.  Both will return
    "fs flush <file>" is not permitted against Freelance objects.
    "fs flushvolume <path>" will execute cm_noteLocalMountPointChange() once if
    the path is a Freelance object.
    "fs flushall" continues to execute cm_FlushFile() on all cm_scache_t
    objects.  The calls on Freelance object will fail.  After all cm_scache_t
    objects are flushed then cm_noteLocalMountPointChange() will be executed
    once to force the Freelance directory to be rebuilt.
    This patchset does not address the race but significantly reduces the
    likelihood the race will be lost.
    Change-Id: I298dad453432001b7b2e6f4533ddee17e041b02e
    Tested-by: BuildBot <>
    Reviewed-by: Jeffrey Altman <>

 src/WINNT/afsd/cm_ioctl.c |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

OpenAFS Master Repository