patch-2.1.48 linux/fs/hpfs/hpfs_fs.c

Next file: linux/fs/inode.c
Previous file: linux/fs/fat/misc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.47/linux/fs/hpfs/hpfs_fs.c linux/fs/hpfs/hpfs_fs.c
@@ -1127,13 +1127,14 @@
 	ino_t ino;
 	const char *name = dentry->d_name.name;
 	int len = dentry->d_name.len;
+	int retval;
 
 	/* In case of madness */
 
 	if (dir == 0)
 		return -ENOENT;
 	if (!S_ISDIR(dir->i_mode))
-		goto bail;
+		return -ENOENT;
 
 	/*
 	 * Read in the directory entry. "." is there under the name ^A^A .
@@ -1153,8 +1154,9 @@
 	 * This is not really a bailout, just means file not found.
 	 */
 
+	inode = NULL;
 	if (!de)
-		goto bail;
+		goto add_dentry;
 
 	/*
 	 * Get inode number, what we're after.
@@ -1169,8 +1171,9 @@
 	 * Go find or make an inode.
 	 */
 
+	retval = -EACCES;
 	if (!(inode = iget(dir->i_sb, ino)))
-		goto bail1;
+		goto free4;
 
 	/*
 	 * Fill in the info from the directory if this is a newly created
@@ -1195,24 +1198,16 @@
 		}
 	}
 
-	brelse4(&qbh);
-
 	/*
-	 * Made it.
+	 * Add the dentry, negative or otherwise.
 	 */
+      add_dentry:
+	d_add(dentry, inode);
+	retval = 0;
 
-	d_instantiate(dentry, inode);
-	iput(dir);
-	return 0;
-
-	/*
-	 * Didn't.
-	 */
- bail1:
+      free4:
 	brelse4(&qbh);
- bail:
-	iput(dir);
-	return -ENOENT;
+	return retval;
 }
 
 /*

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