patch-2.4.0-test3 linux/fs/nfs/inode.c

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

diff -u --recursive --new-file v2.4.0-test2/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -542,7 +542,7 @@
 static int
 nfs_free_dentries(struct inode *inode)
 {
-	struct list_head *tmp, *head = &inode->i_dentry;
+	struct list_head *tmp, *head;
 	int unhashed;
 
 	if (S_ISDIR(inode->i_mode)) {
@@ -553,13 +553,16 @@
 		}
 	}
 	d_prune_aliases(inode);
+	spin_lock(&dcache_lock);
+	head = &inode->i_dentry;
 	tmp = head;
 	unhashed = 0;
 	while ((tmp = tmp->next) != head) {
 		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
-		if (d_unhashed(dentry))
+		if (list_empty(&dentry->d_hash))
 			unhashed++;
 	}
+	spin_unlock(&dcache_lock);
 	return unhashed;
 }
 
@@ -881,10 +884,14 @@
  */
 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);
+	struct rpc_auth *auth;
+	struct rpc_cred *cred;
 
+	lock_kernel();
+	auth = NFS_CLIENT(inode)->cl_auth;
+	cred = rpcauth_lookupcred(auth, 0);
 	filp->private_data = cred;
+	unlock_kernel();
 	return 0;
 }
 
@@ -913,15 +920,22 @@
 		dentry->d_parent->d_name.name, dentry->d_name.name,
 		inode->i_ino);
 
-	if (!inode || is_bad_inode(inode))
+	lock_kernel();
+	if (!inode || is_bad_inode(inode)) {
+		unlock_kernel();
 		return -ESTALE;
+	}
 
 	while (NFS_REVALIDATING(inode)) {
 		status = nfs_wait_on_inode(inode, NFS_INO_REVALIDATING);
-		if (status < 0)
+		if (status < 0) {
+			unlock_kernel();
 			return status;
-		if (time_before(jiffies,NFS_READTIME(inode)+NFS_ATTRTIMEO(inode)))
+		}
+		if (time_before(jiffies,NFS_READTIME(inode)+NFS_ATTRTIMEO(inode))) {
+			unlock_kernel();
 			return 0;
+		}
 	}
 	NFS_FLAGS(inode) |= NFS_INO_REVALIDATING;
 
@@ -968,6 +982,7 @@
 out:
 	NFS_FLAGS(inode) &= ~NFS_INO_REVALIDATING;
 	wake_up(&inode->i_wait);
+	unlock_kernel();
 	return status;
 }
 

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