From ba81238076d368b9bb78a7fbf6c621b49d4d602f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 5 Sep 2013 11:44:38 +0200 Subject: [PATCH] afs: use check_submounts_and_drop() 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 CC: David Howells Signed-off-by: Al Viro --- 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); -- 2.7.4