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

Next file: linux/fs/binfmt_aout.c
Previous file: linux/fs/autofs4/root.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/fs/bfs/inode.c linux/fs/bfs/inode.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/locks.h>
 #include <linux/bfs_fs.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -84,7 +85,7 @@
 	brelse(bh);
 }
 
-static void bfs_write_inode(struct inode * inode)
+static void bfs_write_inode(struct inode * inode, int unused)
 {
 	unsigned long ino = inode->i_ino;
 	kdev_t dev = inode->i_dev;
@@ -97,10 +98,12 @@
 		return;
 	}
 
+	lock_kernel();
 	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
 	bh = bread(dev, block, BFS_BSIZE);
 	if (!bh) {
 		printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino);
+		unlock_kernel();
 		return;
 	}
 
@@ -126,6 +129,7 @@
 
 	mark_buffer_dirty(bh, 0);
 	brelse(bh);
+	unlock_kernel();
 }
 
 static void bfs_delete_inode(struct inode * inode)
@@ -146,11 +150,13 @@
 	
 	inode->i_size = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	lock_kernel();
 	mark_inode_dirty(inode);
 	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
 	bh = bread(dev, block, BFS_BSIZE);
 	if (!bh) {
 		printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino);
+		unlock_kernel();
 		return;
 	}
 	off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK;
@@ -173,6 +179,7 @@
 		s->su_lf_eblk = inode->iu_sblock - 1;
 		mark_buffer_dirty(s->su_sbh, 1);
 	}
+	unlock_kernel();
 	clear_inode(inode);
 }
 

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