diff -urN -X dontdiff linux/fs/buffer.c fsync/fs/buffer.c
--- linux/fs/buffer.c	Mon Dec 20 22:52:57 1999
+++ fsync/fs/buffer.c	Wed Dec 29 10:56:37 1999
@@ -345,33 +345,30 @@
 	struct inode * inode;
 	int err;
 
-	lock_kernel();
-	err = -EBADF;
 	file = fget(fd);
 	if (!file)
-		goto out;
+		return -EBADF;
 
+	err = -EBADF;
 	dentry = file->f_dentry;
 	if (!dentry)
-		goto out_putf;
+		goto out;
 
 	inode = dentry->d_inode;
 	if (!inode)
-		goto out_putf;
+		goto out;
 
 	err = -EINVAL;
 	if (!file->f_op || !file->f_op->fsync)
-		goto out_putf;
+		goto out;
 
 	/* We need to protect against concurrent writers.. */
 	down(&inode->i_sem);
 	err = file->f_op->fsync(file, dentry);
 	up(&inode->i_sem);
 
-out_putf:
-	fput(file);
 out:
-	unlock_kernel();
+	fput(file);
 	return err;
 }
 
@@ -382,33 +379,30 @@
 	struct inode * inode;
 	int err;
 
-	lock_kernel();
-	err = -EBADF;
 	file = fget(fd);
 	if (!file)
-		goto out;
+		return -EBADF;
 
+	err = -EBADF;
 	dentry = file->f_dentry;
 	if (!dentry)
-		goto out_putf;
+		goto out;
 
 	inode = dentry->d_inode;
 	if (!inode)
-		goto out_putf;
+		goto out;
 
 	err = -EINVAL;
 	if (!file->f_op || !file->f_op->fsync)
-		goto out_putf;
+		goto out;
 
 	/* this needs further work, at the moment it is identical to fsync() */
 	down(&inode->i_sem);
 	err = file->f_op->fsync(file, dentry);
 	up(&inode->i_sem);
 
-out_putf:
-	fput(file);
 out:
-	unlock_kernel();
+	fput(file);
 	return err;
 }
 
diff -urN -X dontdiff linux/fs/coda/file.c fsync/fs/coda/file.c
--- linux/fs/coda/file.c	Sun Dec  5 16:42:03 1999
+++ fsync/fs/coda/file.c	Wed Dec 29 11:05:21 1999
@@ -215,12 +215,14 @@
 	      S_ISLNK(coda_inode->i_mode)))
 		return -EINVAL;
 
+	lock_kernel();
         cnp = ITOC(coda_inode);
         CHECK_CNODE(cnp);
 
         cont_inode = cnp->c_ovp;
         if ( cont_inode == NULL ) {
                 printk("coda_file_write: cached inode is 0!\n");
+		unlock_kernel();
                 return -1; 
         }
 
@@ -237,6 +239,7 @@
 	up(&cont_inode->i_sem);
 
         coda_restore_codafile(coda_inode, coda_file, cont_inode, &cont_file);
+	unlock_kernel();
         return result;
 }
 /* 
diff -urN -X dontdiff linux/fs/ext2/fsync.c fsync/fs/ext2/fsync.c
--- linux/fs/ext2/fsync.c	Thu Dec  2 23:24:49 1999
+++ fsync/fs/ext2/fsync.c	Wed Dec 29 12:55:19 1999
@@ -23,8 +23,8 @@
  */
 
 #include <linux/fs.h>
-
-
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 
 #define blocksize	(EXT2_BLOCK_SIZE(inode->i_sb))
@@ -126,6 +126,7 @@
 
 	err = generic_buffer_fdatasync(inode, 0, ~0UL);
 
+	lock_kernel();
 	for (wait=0; wait<=1; wait++)
 	{
 		err |= sync_indirect(inode,
@@ -140,5 +141,6 @@
 	}
 skip:
 	err |= ext2_sync_inode (inode);
+	unlock_kernel();
 	return err ? -EIO : 0;
 }
diff -urN -X dontdiff linux/fs/minix/fsync.c fsync/fs/minix/fsync.c
--- linux/fs/minix/fsync.c	Tue Jun 29 17:22:08 1999
+++ fsync/fs/minix/fsync.c	Wed Dec 29 11:01:27 1999
@@ -152,6 +152,7 @@
 	     S_ISLNK(inode->i_mode)))
 		return -EINVAL;
 
+	lock_kernel();
 	for (wait=0; wait<=1; wait++)
 	{
 		err |= V1_sync_direct(inode, wait);
@@ -159,6 +160,7 @@
 		err |= V1_sync_dindirect(inode, inode->u.minix_i.u.i1_data + 8, wait);
 	}
 	err |= minix_sync_inode (inode);
+	unlock_kernel();
 	return (err < 0) ? -EIO : 0;
 }
 
diff -urN -X dontdiff linux/fs/nfs/file.c fsync/fs/nfs/file.c
--- linux/fs/nfs/file.c	Tue Dec 14 08:53:27 1999
+++ fsync/fs/nfs/file.c	Wed Dec 29 11:02:03 1999
@@ -148,11 +148,13 @@
 
 	dfprintk(VFS, "nfs: fsync(%x/%ld)\n", inode->i_dev, inode->i_ino);
 
+	lock_kernel();
 	status = nfs_wb_file(inode, file);
 	if (!status) {
 		status = file->f_error;
 		file->f_error = 0;
 	}
+	unlock_kernel();
 	return status;
 }
 
diff -urN -X dontdiff linux/fs/qnx4/fsync.c fsync/fs/qnx4/fsync.c
--- linux/fs/qnx4/fsync.c	Tue Jun 29 17:22:08 1999
+++ fsync/fs/qnx4/fsync.c	Wed Dec 29 11:04:11 1999
@@ -156,10 +156,12 @@
 	      S_ISLNK(inode->i_mode)))
 		return -EINVAL;
 
+	lock_kernel();
 	for (wait = 0; wait <= 1; wait++) {
 		err |= sync_direct(inode, wait);
 	}
 	err |= qnx4_sync_inode(inode);
+	unlock_kernel();
 	return (err < 0) ? -EIO : 0;
 }
 
diff -urN -X dontdiff linux/fs/sysv/fsync.c fsync/fs/sysv/fsync.c
--- linux/fs/sysv/fsync.c	Tue Jun 29 17:22:08 1999
+++ fsync/fs/sysv/fsync.c	Wed Dec 29 11:03:10 1999
@@ -187,6 +187,7 @@
 	     S_ISLNK(inode->i_mode)))
 		return -EINVAL;
 
+	lock_kernel();
 	for (wait=0; wait<=1; wait++) {
 		err |= sync_direct(inode, wait);
 		err |= sync_indirect(inode, inode->u.sysv_i.i_data+10, 0, wait);
@@ -194,5 +195,6 @@
 		err |= sync_tindirect(inode, inode->u.sysv_i.i_data+12, 0, wait);
 	}
 	err |= sysv_sync_inode (inode);
+	unlock_kernel();
 	return (err < 0) ? -EIO : 0;
 }
diff -urN -X dontdiff linux/fs/udf/fsync.c fsync/fs/udf/fsync.c
--- linux/fs/udf/fsync.c	Sat Sep  4 20:42:30 1999
+++ fsync/fs/udf/fsync.c	Wed Dec 29 11:05:59 1999
@@ -98,6 +98,7 @@
 		goto skip;
 	}
 
+	lock_kernel();
 	err = generic_buffer_fdatasync(inode, 0, ~0UL);
 
 	for (wait=0; wait<=1; wait++)
@@ -106,5 +107,6 @@
 	}
 skip:
 	err |= udf_sync_inode (inode);
+	unlock_kernel();
 	return err ? -EIO : 0;
 }
