• David Howells's avatar
    afs: Fix incorrect triggering of sillyrename on 3rd-party invalidation · 63d49d84
    David Howells authored
    The AFS filesystem is currently triggering the silly-rename cleanup from
    afs_d_revalidate() when it sees that a dentry has been changed by a third
    party[1].  It should not be doing this as the cleanup includes deleting the
    silly-rename target file on iput.
    
    Fix this by removing the places in the d_revalidate handling that validate
    anything other than the directory and the dirent.  It probably should not
    be looking to validate the target inode of the dentry also.
    
    This includes removing the point in afs_d_revalidate() where the inode that
    a dentry used to point to was marked as being deleted (AFS_VNODE_DELETED).
    We don't know it got deleted.  It could have been renamed or it could have
    hard links remaining.
    
    This was reproduced by cloning a git repo onto an afs volume on one
    machine, switching to another machine and doing "git status", then
    switching back to the first and doing "git status".  The second status
    would show weird output due to ".git/index" getting deleted by the above
    mentioned mechanism.
    
    A simpler way to do it is to do:
    
    	machine 1: touch a
    	machine 2: touch b; mv -f b a
    	machine 1: stat a
    
    on an afs volume.  The bug shows up as the stat failing with ENOENT and the
    file server log showing that machine 1 deleted "a".
    
    Fixes: 79ddbfa5 ("afs: Implement sillyrename for unlink and rename")
    Reported-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Tested-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
    cc: linux-afs@lists.infradead.org
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=214217#c4 [1]
    Link: https://lore.kernel.org/r/163111668100.283156.3851669884664475428.stgit@warthog.procyon.org.uk/
    63d49d84
dir.c 53.3 KB