patch-2.2.7 linux/fs/umsdos/namei.c

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

diff -u --recursive --new-file v2.2.6/linux/fs/umsdos/namei.c linux/fs/umsdos/namei.c
@@ -175,18 +175,6 @@
 
 #endif
 
-/*
- * Check whether we can delete from the directory.
- */
-static int is_sticky(struct inode *dir, int uid)
-{
-	return !((dir->i_mode & S_ISVTX) == 0 || 
-		current->fsuid == uid ||
-		current->fsuid == dir->i_uid ||
-		capable (CAP_FOWNER));
-}
-
-
 static int umsdos_nevercreat (struct inode *dir, struct dentry *dentry,
 				int errcod)
 {
@@ -696,9 +684,8 @@
 olddentry->d_parent->d_name.name, olddentry->d_name.name, old_info.fake.fname));
 
 	/* Do a real lookup to get the short name dentry */
-	temp = umsdos_lookup_dentry(olddentry->d_parent,
-					old_info.fake.fname, 
-					old_info.fake.len, 1);
+	temp = umsdos_covered(olddentry->d_parent, old_info.fake.fname, 
+					old_info.fake.len);
 	ret = PTR_ERR(temp);
 	if (IS_ERR(temp))
 		goto out_unlock;
@@ -784,16 +771,11 @@
 		goto out;
 
 	/* lookup the short name dentry */
-	temp = umsdos_lookup_dentry(dentry->d_parent, info.fake.fname, 
-					info.fake.len, 1);
+	temp = umsdos_covered(dentry->d_parent, info.fake.fname, info.fake.len);
 	ret = PTR_ERR(temp);
 	if (IS_ERR(temp))
 		goto out_remove;
 
-	/* Keep the short name dentry anonymous */ 
-	if (temp != dentry)
-		d_drop(temp);
-
 	/* Make sure the short name doesn't exist */
 	ret = -EEXIST;
 	if (temp->d_inode) {
@@ -812,16 +794,9 @@
 	inode = temp->d_inode;
 	down(&inode->i_sem);
 
-	/*
-	 * Note! The long and short name might be the same,
-	 * so check first before doing the instantiate ...
-	 */
-	if (dentry != temp) {
-if (dentry->d_inode)
-printk("umsdos_mkdir: dentry not negative!\n");
-		inode->i_count++;
-		d_instantiate(dentry, inode);
-	}
+	inode->i_count++;
+	d_instantiate(dentry, inode);
+
 	/* N.B. this should have an option to create the EMD ... */
 	umsdos_lookup_patch_new(dentry, &info);
 
@@ -921,21 +896,11 @@
 	umsdos_parse (dentry->d_name.name, dentry->d_name.len, &info);
 	/* Call findentry to complete the mangling */
 	umsdos_findentry (dentry->d_parent, &info, 2);
-	temp = umsdos_lookup_dentry(dentry->d_parent, info.fake.fname, 
-					info.fake.len, 1);
+	temp = umsdos_covered(dentry->d_parent, info.fake.fname, info.fake.len);
 	ret = PTR_ERR(temp);
 	if (IS_ERR(temp))
 		goto out;
 	/*
-	 * If the short name is an alias, dput() it now;
-	 * otherwise d_drop() it to keep it anonymous.
-	 */
-	if (temp == dentry)
-		dput(temp);
-	else
-		d_drop(temp);
-
-	/*
 	 * Attempt to remove the msdos name.
 	 */
 	ret = msdos_rmdir (dir, temp);
@@ -951,8 +916,7 @@
 
 	/* dput() temp if we didn't do it above */
 out_dput:
-	if (temp != dentry)
-		dput(temp);
+	dput(temp);
 
 out:
 	Printk (("umsdos_rmdir %d\n", ret));
@@ -999,14 +963,6 @@
 
 Printk (("UMSDOS_unlink %.*s ", info.fake.len, info.fake.fname));
 
-	ret = -EPERM;
-	/* check sticky bit */
-	if (is_sticky(dir, info.entry.uid)) {
-printk("umsdos_unlink: %s/%s is sticky\n",
-dentry->d_parent->d_name.name, dentry->d_name.name);
-		goto out_unlock;
-	}
-
 	/*
 	 * Note! If this is a hardlink and the names are aliased,
 	 * the short-name lookup will return the hardlink dentry.
@@ -1018,8 +974,7 @@
 	}
 
 	/* Do a real lookup to get the short name dentry */
-	temp = umsdos_lookup_dentry(dentry->d_parent, info.fake.fname, 
-					info.fake.len, 1);
+	temp = umsdos_covered(dentry->d_parent, info.fake.fname, info.fake.len);
 	ret = PTR_ERR(temp);
 	if (IS_ERR(temp))
 		goto out_unlock;
@@ -1031,13 +986,6 @@
 		link = umsdos_solve_hlink(dget(temp));
 	}
 
-	/*
-	 * If the short and long names are aliased,
-	 * dput() it now so the dentry isn't busy.
-	 */
-	if (temp == dentry)
-		dput(temp);
-
 	/* Delete the EMD entry */
 	ret = umsdos_delentry (dentry->d_parent, &info, 0);
 	if (ret && ret != -ENOENT) {
@@ -1046,7 +994,7 @@
 		goto out_dput;
 	}
 
-	ret = msdos_unlink_umsdos (dir, temp);
+	ret = msdos_unlink(dir, temp);
 #ifdef UMSDOS_PARANOIA
 if (ret)
 printk("umsdos_unlink: %s/%s unlink failed, ret=%d\n",
@@ -1055,12 +1003,9 @@
 
 	/* dput() temp if we didn't do it above */
 out_dput:
-	if (temp != dentry) {
-		d_drop(temp);
-		dput(temp);
-		if (!ret)
-			d_delete (dentry);
-	}
+	dput(temp);
+	if (!ret)
+		d_delete (dentry);
 
 out_unlock:
 	umsdos_unlockcreate (dir);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)