From: Miklos Szeredi <mszer...@suse.cz>

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 <mszer...@suse.cz>
CC: David Howells <dhowe...@redhat.com>
---
 fs/afs/dir.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 34494fb..0b74d31 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -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);
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to