Skip to content
  • Miklos Szeredi's avatar
    vfs: check submounts and drop atomically · 848ac114
    Miklos Szeredi authored
    
    
    We check submounts before doing d_drop() on a non-empty directory dentry in
    NFS (have_submounts()), but we do not exclude a racing mount.
    
     Process A: have_submounts() -> returns false
     Process B: mount() -> success
     Process A: d_drop()
    
    This patch prepares the ground for the fix by doing the following
    operations all under the same rename lock:
    
      have_submounts()
      shrink_dcache_parent()
      d_drop()
    
    This is actually an optimization since have_submounts() and
    shrink_dcache_parent() both traverse the same dentry tree separately.
    
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
    CC: David Howells <dhowells@redhat.com>
    CC: Steven Whitehouse <swhiteho@redhat.com>
    CC: Trond Myklebust <Trond.Myklebust@netapp.com>
    CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    848ac114