patch-2.1.47 linux/fs/namei.c

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

diff -u --recursive --new-file v2.1.46/linux/fs/namei.c linux/fs/namei.c
@@ -338,26 +338,39 @@
 	return result;
 }
 
-/*
- * This should check "link_count", but doesn't do that yet..
- */
 static struct dentry * do_follow_link(struct dentry *base, struct dentry *dentry)
 {
 	struct inode * inode = dentry->d_inode;
 
 	if (inode && inode->i_op && inode->i_op->follow_link) {
-		struct dentry *result;
+		if (current->link_count < 5) {
+			struct dentry * result;
 
-		/* This eats the base */
-		result = inode->i_op->follow_link(inode, base);
-		base = dentry;
-		dentry = result;
+			current->link_count++;
+			/* This eats the base */
+			result = inode->i_op->follow_link(inode, base);
+			current->link_count--;
+			dput(dentry);
+			return result;
+		}
+		dput(dentry);
+		dentry = ERR_PTR(-ELOOP);
 	}
 	dput(base);
 	return dentry;
 }
 
 /*
+ * Allow a filesystem to translate the character set of
+ * a file name. This allows for filesystems that are not
+ * case-sensitive, for example.
+ *
+ * This is only a dummy define right now, but eventually
+ * it might become something like "(parent)->d_charmap[c]"
+ */
+#define name_translate_char(parent, c) (c)
+
+/*
  * Name resolution.
  *
  * This is the basic name resolution function, turning a pathname
@@ -397,6 +410,7 @@
 		c = *name;
 		do {
 			len++; name++;
+			c = name_translate_char(base, c);
 			hash = partial_name_hash(c, hash);
 			c = *name;
 		} while (c && (c != '/'));

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