• David Howells's avatar
    afs: Use the vnode ID uniquifier in the cache key not the aux data · 27a3ee3a
    David Howells authored
    AFS vnodes (files) are referenced by a triplet of { volume ID, vnode ID,
    uniquifier }.  Currently, kafs is only using the vnode ID as the file key
    in the volume fscache index and checking the uniquifier on cookie
    acquisition against the contents of the auxiliary data stored in the cache.
    
    Unfortunately, this is subject to a race in which an FS.RemoveFile or
    FS.RemoveDir op is issued against the server but the local afs inode isn't
    torn down and disposed off before another thread issues something like
    FS.CreateFile.  The latter then gets given the vnode ID that just got
    removed, but with a new uniquifier and a cookie collision occurs in the
    cache because the cookie is only keyed on the vnode ID whereas the inode is
    keyed on the vnode ID plus the uniquifier.
    
    Fix this by keying the cookie on the uniquifier in addition to the vnode ID
    and dropping the uniquifier from the auxiliary data supplied.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    27a3ee3a
cache.c 5.19 KB