patch-2.1.43 linux/fs/minix/namei.c

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

diff -u --recursive --new-file v2.1.42/linux/fs/minix/namei.c linux/fs/minix/namei.c
@@ -462,7 +462,7 @@
 		retval = -ENOENT;
 		goto end_rmdir;
 	}
-	if (inode->i_count > 1) {
+	if (atomic_read(&inode->i_count) > 1) {
 		retval = -EBUSY;
 		goto end_rmdir;
 	}
@@ -639,7 +639,7 @@
 	int ino;
 	int result;
 
-	new_inode->i_count++;
+	atomic_inc(&new_inode->i_count);
 	result = 0;
 	for (;;) {
 		if (new_inode == old_inode) {
@@ -672,7 +672,7 @@
  * higher-level routines.
  */
 static int do_minix_rename(struct inode * old_dir, const char * old_name, int old_len,
-	struct inode * new_dir, const char * new_name, int new_len, int must_be_dir)
+			   struct inode * new_dir, const char * new_name, int new_len)
 {
 	struct inode * old_inode, * new_inode;
 	struct buffer_head * old_bh, * new_bh, * dir_bh;
@@ -700,8 +700,6 @@
 	old_inode = __iget(old_dir->i_sb, old_de->inode,0); /* don't cross mnt-points */
 	if (!old_inode)
 		goto end_rename;
-	if (must_be_dir && !S_ISDIR(old_inode->i_mode))
-		goto end_rename;
 	retval = -EPERM;
 	if ((old_dir->i_mode & S_ISVTX) && 
 	    current->fsuid != old_inode->i_uid &&
@@ -730,7 +728,7 @@
 		if (!empty_dir(new_inode))
 			goto end_rename;
 		retval = -EBUSY;
-		if (new_inode->i_count > 1)
+		if (atomic_read(&new_inode->i_count) > 1)
 			goto end_rename;
 	}
 	retval = -EPERM;
@@ -818,8 +816,7 @@
  * as they are on different partitions.
  */
 int minix_rename(struct inode * old_dir, const char * old_name, int old_len,
-	struct inode * new_dir, const char * new_name, int new_len,
-	int must_be_dir)
+		 struct inode * new_dir, const char * new_name, int new_len)
 {
 	static struct wait_queue * wait = NULL;
 	static int lock = 0;
@@ -829,7 +826,7 @@
 		sleep_on(&wait);
 	lock = 1;
 	result = do_minix_rename(old_dir, old_name, old_len,
-		new_dir, new_name, new_len, must_be_dir);
+				 new_dir, new_name, new_len);
 	lock = 0;
 	wake_up(&wait);
 	return result;

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