patch-2.1.49 linux/fs/namei.c

Next file: linux/fs/nfs/dir.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.48/linux/fs/namei.c linux/fs/namei.c
@@ -245,7 +245,9 @@
 	if (!result) {
 		int error;
 		result = d_alloc(parent, name);
+		result->d_count++;
 		error = dir->i_op->lookup(dir, result);
+		result->d_count--;
 		if (error) {
 			d_free(result);
 			result = ERR_PTR(error);
@@ -268,16 +270,12 @@
 
 	if (dentry && dentry->d_revalidate) {
 		int validated, (*revalidate)(struct dentry *) = dentry->d_revalidate;
-		struct dentry * save;
 
 		dentry->d_count++;
-		validated = revalidate(dentry);
-		save = dentry;
-		if (!validated) {
-			d_drop(dentry);
+		validated = revalidate(dentry) || d_invalidate(dentry);
+		dput(dentry);
+		if (!validated)
 			dentry = NULL;
-		}
-		dput(save);
 	}
 	return dentry;
 }
@@ -1057,21 +1055,6 @@
 		up(s2);
 }
 
-static inline int is_reserved(struct dentry *dentry)
-{
-	if (dentry->d_name.name[0] == '.') {
-		switch (dentry->d_name.len) {
-		case 2:
-			if (dentry->d_name.name[1] != '.')
-				break;
-			/* fallthrough */
-		case 1:
-			return 1;
-		}
-	}
-	return 0;
-}
-
 static inline int do_rename(const char * oldname, const char * newname)
 {
 	int error;
@@ -1106,11 +1089,10 @@
 	if (error)
 		goto exit_lock;
 
-	error = -EPERM;
-	if (is_reserved(new_dentry) || is_reserved(old_dentry))
-		goto exit_lock;
-
-	/* Disallow moves of mountpoints. */
+	/*
+	 * Disallow moves of mountpoints.  There is no technical 
+	 * reason for this, but user level stuff gets too confused.
+	 */
 	error = -EBUSY;
 	if (old_dentry->d_covers != old_dentry)
 		goto exit_lock;

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