• Neil Brown's avatar
    [PATCH] kNFSd: fix d_find_alias brokenness · f1a2bdba
    Neil Brown authored
    10 weeks ago,
      http://linux.bkbits.com:8080/linux-2.5/cset@415b3380pxf4sB97gM8ujLqDxi6GfQ
    
    The patch was mostly right, and fixed a real problem, but missed a bit.
    
    It passed the job of checking if an inode had a current alias off to
    d_find_alias instead of open-coding it in d_alloc_anon.  However there is one
    case where d_alloc_anon would not return the right dentry.  That case being
    when the inode was for the root of the filesystem.
    
    The root is a special case because it is not hashed.  All other dentries that
    are not hashed are quite un-interesting: There are "unlinked" but not yet
    closed.  The root of a filesystem is unhashed, but is interesting.
    
    Allowing d_find_alias to return an unhashed alias for a directory solves this
    problem.  It is safe because callers of d_find_alias on a directory inode
    either have a name for the inode already (so finding an unlinked directory by
    mistake is impossible) or will soon be looking for a name and will drop the
    dentry if a name is not found.
    Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    f1a2bdba
dcache.c 41.4 KB