patch-2.1.130 linux/fs/nfs/dir.c

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

diff -u --recursive --new-file v2.1.129/linux/fs/nfs/dir.c linux/fs/nfs/dir.c
@@ -371,6 +371,15 @@
 	nfs_invalidate_dircache_sb(NULL);
 }
 
+/*
+ * Whenever an NFS operation succeeds, we know that the dentry
+ * is valid, so we update the revalidation timestamp.
+ */
+static inline void nfs_renew_times(struct dentry * dentry)
+{
+	dentry->d_time = jiffies;
+}
+
 #define NFS_REVALIDATE_INTERVAL (5*HZ)
 /*
  * This is called every time the dcache has a lookup hit,
@@ -427,6 +436,9 @@
 	if (memcmp(dentry->d_fsdata, &fhandle, sizeof(struct nfs_fh)))
 		goto out_bad;
 
+	/* Ok, remeber that we successfully checked it.. */
+	nfs_renew_times(dentry);
+
 out_valid:
 	return 1;
 out_bad:
@@ -474,26 +486,6 @@
 }
 
 /*
- * Called to free the inode from the dentry. We must flush
- * any pending writes for this dentry before freeing the inode.
- */
-static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
-{
-	dfprintk(VFS, "NFS: dentry_iput(%s/%s, cnt=%d, ino=%ld)\n",
-		dentry->d_parent->d_name.name, dentry->d_name.name,
-		dentry->d_count, inode->i_ino);
-
-	if (NFS_WRITEBACK(inode)) {
-#ifdef NFS_PARANOIA
-printk("nfs_dentry_iput: pending writes for %s/%s, i_count=%d\n",
-dentry->d_parent->d_name.name, dentry->d_name.name, inode->i_count);
-#endif
-		nfs_wbinval(inode);
-	}
-	iput(inode);
-}
-
-/*
  * Called when the dentry is being freed to release private memory.
  */
 static void nfs_dentry_release(struct dentry *dentry)
@@ -508,7 +500,7 @@
 	NULL,			/* d_compare */
 	nfs_dentry_delete,	/* d_delete(struct dentry *) */
 	nfs_dentry_release,	/* d_release(struct dentry *) */
-	nfs_dentry_iput		/* d_iput(struct dentry *, struct inode *) */
+	NULL			/* d_iput */
 };
 
 #ifdef NFS_PARANOIA
@@ -534,15 +526,6 @@
 }
 #endif
 
-/*
- * Whenever an NFS operation succeeds, we know that the dentry
- * is valid, so we update the revalidation timestamp.
- */
-static inline void nfs_renew_times(struct dentry * dentry)
-{
-	dentry->d_time = jiffies;
-}
-
 static int nfs_lookup(struct inode *dir, struct dentry * dentry)
 {
 	struct inode *inode;
@@ -932,18 +915,7 @@
 
 	/* N.B. not needed now that d_delete is done in advance? */
 	error = -EBUSY;
-	if (inode) {
-		if (NFS_WRITEBACK(inode)) {
-			nfs_wbinval(inode);
-			if (NFS_WRITEBACK(inode)) {
-#ifdef NFS_PARANOIA
-printk("nfs_safe_remove: %s/%s writes pending, d_count=%d\n",
-dentry->d_parent->d_name.name, dentry->d_name.name, dentry->d_count);
-#endif
-				goto out;
-			}
-		}
-	} else {
+	if (!inode) {
 #ifdef NFS_PARANOIA
 printk("nfs_safe_remove: %s/%s already negative??\n",
 dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -1190,29 +1162,14 @@
 	if (new_dir == old_dir)
 		goto do_rename;
 	/*
-	 * Cross-directory move ... check whether it's a file.
-	 */
-	if (S_ISREG(old_inode->i_mode)) {
-		if (NFS_WRITEBACK(old_inode)) {
-#ifdef NFS_PARANOIA
-printk("nfs_rename: %s/%s has pending writes\n",
-old_dentry->d_parent->d_name.name, old_dentry->d_name.name);
-#endif
-			nfs_wbinval(old_inode);
-			if (NFS_WRITEBACK(old_inode)) {
-#ifdef NFS_PARANOIA
-printk("nfs_rename: %s/%s has pending writes after flush\n",
-old_dentry->d_parent->d_name.name, old_dentry->d_name.name);
-#endif
-				goto out;
-			}
-		}
-	}
-	/*
-	 * Moving a directory ... prune child dentries if needed.
+	 * Cross-directory move ...
+	 *
+	 * ... prune child dentries and writebacks if needed.
 	 */
-	else if (old_dentry->d_count > 1)
+	if (old_dentry->d_count > 1) {
+		nfs_wb_all(old_inode);
 		shrink_dcache_parent(old_dentry);
+	}
 
 	/*
 	 * Now check the use counts ... we can't safely do the

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