patch-2.3.1 linux/fs/smbfs/inode.c

Next file: linux/fs/super.c
Previous file: linux/fs/select.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.0/linux/fs/smbfs/inode.c linux/fs/smbfs/inode.c
@@ -36,6 +36,7 @@
 static void smb_delete_inode(struct inode *);
 static void smb_put_super(struct super_block *);
 static int  smb_statfs(struct super_block *, struct statfs *, int);
+static void smb_set_inode_attr(struct inode *, struct smb_fattr *);
 
 static struct super_operations smb_sops =
 {
@@ -67,9 +68,7 @@
 	return ino;
 }
 
-static struct smb_fattr *read_fattr = NULL;
-static struct semaphore read_semaphore = MUTEX;
-
+/* We are always generating a new inode here */
 struct inode *
 smb_iget(struct super_block *sb, struct smb_fattr *fattr)
 {
@@ -77,11 +76,19 @@
 
 	pr_debug("smb_iget: %p\n", fattr);
 
-	down(&read_semaphore);
-	read_fattr = fattr;
-	result = iget(sb, fattr->f_ino);
-	read_fattr = NULL;
-	up(&read_semaphore);
+	result = get_empty_inode();
+	result->i_sb = sb;
+	result->i_dev = sb->s_dev;
+	result->i_ino = fattr->f_ino;
+	memset(&(result->u.smbfs_i), 0, sizeof(result->u.smbfs_i));
+	smb_set_inode_attr(result, fattr);
+	if (S_ISREG(result->i_mode))
+		result->i_op = &smb_file_inode_operations;
+	else if (S_ISDIR(result->i_mode))
+		result->i_op = &smb_dir_inode_operations;
+	else
+		result->i_op = NULL;
+	insert_inode_hash(result)
 	return result;
 }
 
@@ -147,24 +154,9 @@
 static void
 smb_read_inode(struct inode *inode)
 {
-	pr_debug("smb_iget: %p\n", read_fattr);
-
-	if (!read_fattr || inode->i_ino != read_fattr->f_ino)
-	{
-		printk("smb_read_inode called from invalid point\n");
-		return;
-	}
-
-	inode->i_dev = inode->i_sb->s_dev;
-	memset(&(inode->u.smbfs_i), 0, sizeof(inode->u.smbfs_i));
-	smb_set_inode_attr(inode, read_fattr);
-
-	if (S_ISREG(inode->i_mode))
-		inode->i_op = &smb_file_inode_operations;
-	else if (S_ISDIR(inode->i_mode))
-		inode->i_op = &smb_dir_inode_operations;
-	else
-		inode->i_op = NULL;
+	/* Now it can be called only by NFS */
+	printk("smb_read_inode called from invalid point\n");
+	return;
 }
 
 /*
@@ -362,8 +354,8 @@
 	sb->s_op = &smb_sops;
 
 	sb->u.smbfs_sb.sock_file = NULL;
-	sb->u.smbfs_sb.sem = MUTEX;
-	sb->u.smbfs_sb.wait = NULL;
+	init_MUTEX(&sb->u.smbfs_sb.sem);
+	init_waitqueue_head(&sb->u.smbfs_sb.wait);
 	sb->u.smbfs_sb.conn_pid = 0;
 	sb->u.smbfs_sb.state = CONN_INVALID; /* no connection yet */
 	sb->u.smbfs_sb.generation = 0;
@@ -608,8 +600,6 @@
 	smb_current_kmalloced = 0;
 	smb_current_vmalloced = 0;
 #endif
-
-	read_semaphore = MUTEX;
 
 	return init_smb_fs();
 }

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