patch-2.4.0-test3 linux/fs/smbfs/dir.c

Next file: linux/fs/smbfs/file.c
Previous file: linux/fs/readdir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/fs/smbfs/dir.c linux/fs/smbfs/dir.c
@@ -9,6 +9,7 @@
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/smp_lock.h>
 
 #include <linux/smb_fs.h>
 #include <linux/smbno.h>
@@ -140,7 +141,7 @@
 smb_dir_open(struct inode *dir, struct file *file)
 {
 	struct dentry *dentry = file->f_dentry;
-	struct smb_sb_info *server = server_from_dentry(dentry);
+	struct smb_sb_info *server;
 	int error = 0;
 #ifdef SMBFS_DEBUG_VERBOSE
 printk("smb_dir_open: (%s/%s)\n", dentry->d_parent->d_name.name, 
@@ -150,6 +151,8 @@
 	 * Directory timestamps in the core protocol aren't updated
 	 * when a file is added, so we give them a very short TTL.
 	 */
+	lock_kernel();
+	server = server_from_dentry(dentry);
 	if (server->opt.protocol < SMB_PROTOCOL_LANMAN2)
 	{
 		unsigned long age = jiffies - dir->u.smbfs_i.oldmtime;
@@ -159,6 +162,7 @@
 
 	if (server->conn_pid)
 		error = smb_revalidate_inode(dentry);
+	unlock_kernel();
 	return error;
 }
 
@@ -202,6 +206,7 @@
 
 	if (inode)
 	{
+		lock_kernel();
 		if (is_bad_inode(inode))
 		{
 #ifdef SMBFS_PARANOIA
@@ -211,6 +216,7 @@
 			valid = 0;
 		} else if (!valid)
 			valid = (smb_revalidate_inode(dentry) == 0);
+		unlock_kernel();
 	} else
 	{
 	/*

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