afs: use check_submounts_and_drop()
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 5 Sep 2013 09:44:38 +0000 (11:44 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 5 Sep 2013 20:23:51 +0000 (16:23 -0400)
Do have_submounts(), shrink_dcache_parent() and d_drop() atomically.

check_submounts_and_drop() can deal with negative dentries as well.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/afs/dir.c

index 34494fbead0ab892733afb344e002ab1c9a08994..0b74d3176ab7c9293c0583e1b2cff730e7f4df0d 100644 (file)
@@ -685,16 +685,12 @@ not_found:
        spin_unlock(&dentry->d_lock);
 
 out_bad:
-       if (dentry->d_inode) {
-               /* don't unhash if we have submounts */
-               if (have_submounts(dentry))
-                       goto out_skip;
-       }
+       /* don't unhash if we have submounts */
+       if (check_submounts_and_drop(dentry) != 0)
+               goto out_skip;
 
        _debug("dropping dentry %s/%s",
               parent->d_name.name, dentry->d_name.name);
-       shrink_dcache_parent(dentry);
-       d_drop(dentry);
        dput(parent);
        key_put(key);