Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2011-07-14 14:47:44 +0200
committerJan Kara <jack@suse.cz>2011-07-14 14:47:44 +0200
commitffa5306f4481fce98a4e5a3a9093bbb4735e84c9 (patch)
tree667625237cda9fe4f517cb5cdb75dfb2e42c5a78
parentfb2e2b0fe4da8dcebd075ae3b08c9fea4284feb5 (diff)
parent191b3fc1bc99ccc3e6b206bdc60db382c69a54b4 (diff)
Merge branch 'SLE11-SP1' of ssh://kerncvs.suse.de/home/git/kernel-source into SLE11-SP1rpm-2.6.32.43-0.4
Conflicts: series.conf suse-commit: 7da281afbd78855773911f3b44d7d45efa04ec20
-rw-r--r--fs/dcache.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 74aa57fe1a9c..a3bbcd004400 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1448,41 +1448,30 @@ out:
}
/**
- * d_validate - verify dentry provided from insecure source
+ * d_validate - verify dentry provided from insecure source (deprecated)
* @dentry: The dentry alleged to be valid child of @dparent
* @dparent: The parent dentry (known to be valid)
*
* An insecure source has sent us a dentry, here we verify it and dget() it.
* This is used by ncpfs in its readdir implementation.
* Zero is returned in the dentry is invalid.
+ *
+ * This function is slow for big directories, and deprecated, do not use it.
*/
-
int d_validate(struct dentry *dentry, struct dentry *dparent)
{
- struct hlist_head *base;
- struct hlist_node *lhp;
-
- /* Check whether the ptr might be valid at all.. */
- if (!kmem_ptr_validate(dentry_cache, dentry))
- goto out;
-
- if (dentry->d_parent != dparent)
- goto out;
+ struct dentry *child;
spin_lock(&dcache_lock);
- base = d_hash(dparent, dentry->d_name.hash);
- hlist_for_each(lhp,base) {
- /* hlist_for_each_entry_rcu() not required for d_hash list
- * as it is parsed under dcache_lock
- */
- if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
+ list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) {
+ if (dentry == child) {
__dget_locked(dentry);
spin_unlock(&dcache_lock);
return 1;
}
}
spin_unlock(&dcache_lock);
-out:
+
return 0;
}