patch-2.1.113 linux/fs/coda/dir.c

Next file: linux/fs/coda/upcall.c
Previous file: linux/drivers/zorro/zorrosyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.112/linux/fs/coda/dir.c linux/fs/coda/dir.c
@@ -578,7 +578,7 @@
 	struct inode *old_inode = old_dentry->d_inode;
 	struct inode *new_inode = new_dentry->d_inode;
         struct coda_inode_info *new_cnp, *old_cnp;
-        int error, rehash = 0, update = 1;
+        int error;
 
 	ENTRY;
 	coda_vfs_stat.rename++;
@@ -598,8 +598,6 @@
 	if (new_inode == old_inode)
 		return 0;
 
-	if (new_dir == old_dir)
-		goto do_rename;
 	/* make sure target is not in use */
 	if (new_inode && S_ISDIR(new_inode->i_mode)) { 
 		/*
@@ -612,38 +610,11 @@
                         return -EBUSY;
         }
 
+	/* the C library will do unlink/create etc */
 	if ( coda_crossvol_rename == 0 && 
 	     old_cnp->c_fid.Volume != new_cnp->c_fid.Volume )
 		return -EXDEV;
 
-	/* if the volumeid are the same we can reuse the inode,
-	   otherwise we need a new inode, since the new file 
-	   will have a new inode number. */
-
-	/* if moving a directory, clean the dcache */
-	if (S_ISDIR(old_inode->i_mode) && old_dentry->d_count > 1) 
-		shrink_dcache_parent(old_dentry);
-
-#if 0
-	if (old_dentry->d_count > 1) {
-		return -EBUSY;
-	}
-#endif
-
-	if (new_dentry->d_count > 1) {
-		return -EBUSY;
-	}
-	d_drop(old_dentry);
-	update = 0;
-
- do_rename:
-	if (!list_empty(&new_dentry->d_hash)) {
-		d_drop(new_dentry);
-		rehash = update;
-	}
-	if ( new_inode ) 
-		d_delete(new_dentry);
-
         error = venus_rename(old_dir->i_sb, &(old_cnp->c_fid), 
 			     &(new_cnp->c_fid), old_length, new_length, 
 			     (const char *) old_name, (const char *)new_name);
@@ -652,14 +623,13 @@
                 CDEBUG(D_INODE, "returned error %d\n", error);
                 return error;
         }
-	/* Update the dcache if needed */
-	if (rehash) {
-		d_add(new_dentry, NULL);
-	}
-	if (update)
-	        d_move(old_dentry, new_dentry);
-	
-        CDEBUG(D_INODE, "result %d\n", error); 
+
+	coda_flag_inode(new_inode, C_VATTR);
+	coda_flag_inode(old_dir, C_VATTR);
+	coda_flag_inode(new_dir, C_VATTR);
+
+	CDEBUG(D_INODE, "result %d\n", error); 
+	d_move(old_dentry, new_dentry);
 
 	EXIT;
 	return 0;

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