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

Next file: linux/fs/nls/Config.in
Previous file: linux/fs/ncpfs/ncplib_kernel.h
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -413,23 +413,25 @@
 	int unhashed;
 
 restart:
-	tmp = head;
+	tmp = head->next;
 	unhashed = 0;
-	while ((tmp = tmp->next) != head) {
+	while (tmp != head) {
 		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
+		dget(dentry);
 		if (!list_empty(&dentry->d_subdirs))
 			shrink_dcache_parent(dentry);
 		dprintk("nfs_free_dentries: found %s/%s, d_count=%d, hashed=%d\n",
 			dentry->d_parent->d_name.name, dentry->d_name.name,
 			dentry->d_count, !list_empty(&dentry->d_hash));
-		if (!dentry->d_count) {
-			dget(dentry);
+		if (dentry->d_count == 1) {
 			d_drop(dentry);
 			dput(dentry);
 			goto restart;
 		}
 		if (list_empty(&dentry->d_hash))
 			unhashed++;
+		tmp = tmp->next;
+		dput(dentry);
 	}
 	return unhashed;
 }

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