diff --git a/fs/dcache.c b/fs/dcache.c
index 42d290be0ac155c675bae69cbfdb0d50bcd12211..5489b2d98a002901d28fdc2417135aab1744b9d0 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1542,7 +1542,7 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)
 	}
 
 	/* Move the dentry to the target hash queue, if on different bucket */
-	if (dentry->d_flags & DCACHE_UNHASHED)
+	if (d_unhashed(dentry))
 		goto already_unhashed;
 
 	hlist_del_rcu(&dentry->d_hash);