patch-2.2.0-pre6 linux/fs/dcache.c

Next file: linux/fs/nfsd/stats.c
Previous file: linux/fs/coda/upcall.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre5/linux/fs/dcache.c linux/fs/dcache.c
@@ -166,10 +166,26 @@
  */
 int d_invalidate(struct dentry * dentry)
 {
-	/* Check whether to do a partial shrink_dcache */
+	/*
+	 * Check whether to do a partial shrink_dcache
+	 * to get rid of unused child entries.
+	 */
 	if (!list_empty(&dentry->d_subdirs)) {
 		shrink_dcache_parent(dentry);
-		if (!list_empty(&dentry->d_subdirs))
+	}
+
+	/*
+	 * Somebody still using it?
+	 *
+	 * If it's a directory, we can't drop it
+	 * for fear of somebody re-populating it
+	 * with children (even though dropping it
+	 * would make it unreachable from the root,
+	 * we might still populate it if it was a
+	 * working directory or similar).
+	 */
+	if (dentry->d_count) {
+		if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode))
 			return -EBUSY;
 	}
 

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