patch-2.3.7 linux/fs/nfs/inode.c

Next file: linux/fs/nfs/read.c
Previous file: linux/fs/nfs/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -99,23 +99,28 @@
 	int failed;
 
 	dprintk("NFS: delete_inode(%x/%ld)\n", inode->i_dev, inode->i_ino);
-	/*
-	 * Flush out any pending write requests ...
-	 */
-	if (NFS_WRITEBACK(inode) != NULL) {
-		unsigned long timeout = jiffies + 5*HZ;
+
+	if (S_ISDIR(inode->i_mode)) {
+		nfs_free_dircache(inode);
+	} else {
+		/*
+		 * Flush out any pending write requests ...
+		 */
+		if (NFS_WRITEBACK(inode) != NULL) {
+			unsigned long timeout = jiffies + 5*HZ;
 #ifdef NFS_DEBUG_VERBOSE
 printk("nfs_delete_inode: inode %ld has pending RPC requests\n", inode->i_ino);
 #endif
-		nfs_inval(inode);
-		while (NFS_WRITEBACK(inode) != NULL &&
-		       time_before(jiffies, timeout)) {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(HZ/10);
+			nfs_inval(inode);
+			while (NFS_WRITEBACK(inode) != NULL &&
+			       time_before(jiffies, timeout)) {
+				current->state = TASK_INTERRUPTIBLE;
+				schedule_timeout(HZ/10);
+			}
+			current->state = TASK_RUNNING;
+			if (NFS_WRITEBACK(inode) != NULL)
+				printk("NFS: Arghhh, stuck RPC requests!\n");
 		}
-		current->state = TASK_RUNNING;
-		if (NFS_WRITEBACK(inode) != NULL)
-			printk("NFS: Arghhh, stuck RPC requests!\n");
 	}
 
 	failed = nfs_check_failed_request(inode);
@@ -433,7 +438,7 @@
 
 	invalidate_inode_pages(inode);
 	if (S_ISDIR(inode->i_mode))
-		nfs_invalidate_dircache(inode);
+		nfs_flush_dircache(inode);
 }
 
 /*
@@ -477,8 +482,6 @@
 		inode->i_size  = fattr->size;
 		inode->i_mtime = fattr->mtime.seconds;
 		NFS_OLDMTIME(inode) = fattr->mtime.seconds;
-		NFS_COOKIES(inode) = NULL;
-		NFS_WRITEBACK(inode) = NULL;
 	}
 	nfs_refresh_inode(inode, fattr);
 }

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