Skip to content
  • Al Viro's avatar
    iget_locked et.al.: make sure we don't return bad inodes · 2864f301
    Al Viro authored
    
    
    If one thread does iget_locked(), proceeds to try and set
    the new inode up and fails, inode will be unhashed and dropped.
    However, another thread doing ilookup/iget_locked in the middle
    of that would end up finding a half-set-up inode, grabbing
    a reference, waiting for it to come unlocked and getting the
    resulting bad inode.  It's a race (if that ilookup had been
    called just after the failure of setup attempt it wouldn't
    have found the sucker at all), particularly unpleasant in
    cases when failure is transient/caller-dependent/etc.
    
    While it can be dealt with in the callers, there's no reason
    not to handle it in fs/inode.c primitives, especially since
    the cost is trivial.
    
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    2864f301