patch-2.3.99-pre9 linux/fs/nfs/inode.c

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

diff -u --recursive --new-file v2.3.99-pre8/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -555,22 +555,18 @@
 	struct list_head *tmp, *head = &inode->i_dentry;
 	int unhashed;
 
-restart:
+	if (S_ISDIR(inode->i_mode)) {
+		struct dentry *dentry = d_find_alias(inode);
+		if (dentry) {
+			shrink_dcache_parent(dentry);
+			dput(dentry);
+		}
+	}
+	d_prune_aliases(inode);
 	tmp = head;
 	unhashed = 0;
 	while ((tmp = tmp->next) != head) {
 		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
-		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, !d_unhashed(dentry));
-		if (!list_empty(&dentry->d_subdirs))
-			shrink_dcache_parent(dentry);
-		if (!dentry->d_count) {
-			dget(dentry);
-			d_drop(dentry);
-			dput(dentry);
-			goto restart;
-		}
 		if (d_unhashed(dentry))
 			unhashed++;
 	}
@@ -895,11 +891,20 @@
  */
 int nfs_open(struct inode *inode, struct file *filp)
 {
+	struct rpc_auth *auth = NFS_CLIENT(inode)->cl_auth;
+	struct rpc_cred *cred = rpcauth_lookupcred(auth, 0);
+
+	filp->private_data = cred;
 	return 0;
 }
 
 int nfs_release(struct inode *inode, struct file *filp)
 {
+	struct rpc_auth *auth = NFS_CLIENT(inode)->cl_auth;
+	struct rpc_cred *cred = nfs_file_cred(filp);
+
+	if (cred)
+		rpcauth_releasecred(auth, cred);
 	return 0;
 }
 

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