afs: use check_submounts_and_drop()
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 5 Sep 2013 09:44:38 +0000 (11:44 +0200)
committerMaciej Wereski <m.wereski@partner.samsung.com>
Tue, 9 Jun 2015 09:30:59 +0000 (11:30 +0200)
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 7a465ed..41cd878 100644 (file)
@@ -710,16 +710,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);