patch-2.1.122 linux/fs/umsdos/rdir.c

Next file: linux/fs/umsdos/specs
Previous file: linux/fs/umsdos/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.121/linux/fs/umsdos/rdir.c linux/fs/umsdos/rdir.c
@@ -20,6 +20,7 @@
 
 
 extern struct inode *pseudo_root;
+extern struct dentry_operations umsdos_dentry_operations;
 
 struct RDIR_FILLDIR {
 	void *dirbuf;
@@ -96,9 +97,14 @@
 		goto out;
 	}
 
-	ret = umsdos_real_lookup (dir, dentry);
+	ret = msdos_lookup (dir, dentry);
+	if (ret) {
+		printk(KERN_WARNING "umsdos_rlookup_x: lookup failed, ret=%d\n",
+			ret);
+		goto out;
+	}
 	inode = dentry->d_inode;
-	if ((ret == 0) && inode) {
+	if (inode) {
 		if (inode == pseudo_root && !nopseudo) {
 			/* #Specification: pseudo root / DOS/linux
 			 * Even in the real root directory (c:\), the directory
@@ -119,6 +125,8 @@
 		}
 	}
 out:
+	/* always install our dentry ops ... */
+	dentry->d_op = &umsdos_dentry_operations;
 	PRINTK ((KERN_DEBUG "umsdos_rlookup_x: returning %d\n", ret));
 	return ret;
 }
@@ -170,28 +178,19 @@
 
 	ret = msdos_rmdir (dir, dentry);
 	if (ret != -ENOTEMPTY)
-		goto out_check;
-
-#if 0	/* why do this? we have the dentry ... */
-	ret = UMSDOS_rlookup (dir, dentry);
-	PRINTK (("rrmdir lookup %d ", ret));
-	if (ret)
 		goto out_unlock;
-	ret = -ENOTEMPTY;
-#endif
 
 	empty = umsdos_isempty (dentry);
 	if (empty == 1) {
-		struct dentry *temp;
+		struct dentry *demd;
 		/* We have to remove the EMD file. */
-		temp = umsdos_lookup_dentry(dentry, UMSDOS_EMD_FILE, 
-						UMSDOS_EMD_NAMELEN);
-		ret = PTR_ERR(temp);
-		if (!IS_ERR(temp)) {
+		demd = umsdos_get_emd_dentry(dentry);
+		ret = PTR_ERR(demd);
+		if (!IS_ERR(demd)) {
 			ret = 0;
-			if (temp->d_inode)
-				ret = msdos_unlink (dentry->d_inode, temp);
-			dput(temp);
+			if (demd->d_inode)
+				ret = msdos_unlink (dentry->d_inode, demd);
+			dput(demd);
 		}
 		if (ret)
 			goto out_unlock;
@@ -199,15 +198,9 @@
 	/* now retry the original ... */
 	ret = msdos_rmdir (dir, dentry);
 
-out_check:
-	/* Check whether we succeeded ... */
-	if (!ret)
-		d_delete(dentry);
-
 out_unlock:
 	umsdos_unlockcreate (dir);
 out:
-	check_inode (dir);
 	return ret;
 }
 

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