patch-2.1.79 linux/fs/namei.c

Next file: linux/fs/nfs/dir.c
Previous file: linux/fs/minix/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.78/linux/fs/namei.c linux/fs/namei.c
@@ -247,20 +247,13 @@
 
 /*
  * Internal lookup() using the new generic dcache.
- *
- * Note the revalidation: we have to drop the dcache
- * lock when we revalidate, so we need to update the
- * counts around it.
  */
 static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name)
 {
 	struct dentry * dentry = d_lookup(parent, name);
 
 	if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
-		int validated, (*revalidate)(struct dentry *) = dentry->d_op->d_revalidate;
-
-		validated = revalidate(dentry) || d_invalidate(dentry);
-		if (!validated) {
+		if (!dentry->d_op->d_revalidate(dentry) && !d_invalidate(dentry)) {
 			dput(dentry);
 			dentry = NULL;
 		}
@@ -365,7 +358,7 @@
 
 	/* At this point we know we have a real path component. */
 	for(;;) {
-		int len, err;
+		int err;
 		unsigned long hash;
 		struct qstr this;
 		struct inode *inode;
@@ -386,16 +379,14 @@
 			break;
 
 		this.name = name;
-		len = 0;
 		c = *name;
 
 		hash = init_name_hash();
 		do {
-			len++; name++;
 			hash = partial_name_hash(c, hash);
-			c = *name;
+			c = *++name;
 		} while (c && (c != '/'));
-		this.len = len;
+		this.len = name - (const char *) this.name;
 		this.hash = end_name_hash(hash);
 
 		/* remove trailing slashes? */
@@ -840,7 +831,7 @@
 
 	/* Disallow removals of mountpoints. */
 	error = -EBUSY;
-	if (dentry == dir)
+	if (dentry->d_mounts != dentry->d_covers)
 		goto exit_lock;
 
 	error = -EPERM;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov