patch-2.3.43 linux/fs/minix/fsync.c

Next file: linux/fs/minix/inode.c
Previous file: linux/fs/minix/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/fs/minix/fsync.c linux/fs/minix/fsync.c
@@ -16,6 +16,7 @@
 #include <linux/stat.h>
 #include <linux/fcntl.h>
 #include <linux/locks.h>
+#include <linux/smp_lock.h>
 
 #include <linux/fs.h>
 #include <linux/minix_fs.h>
@@ -148,10 +149,7 @@
 {
 	int wait, err = 0;
 	
-	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
-	     S_ISLNK(inode->i_mode)))
-		return -EINVAL;
-
+	lock_kernel();
 	for (wait=0; wait<=1; wait++)
 	{
 		err |= V1_sync_direct(inode, wait);
@@ -159,6 +157,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;
 }
 
@@ -309,10 +308,7 @@
 {
 	int wait, err = 0;
 	
-	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
-	     S_ISLNK(inode->i_mode)))
-		return -EINVAL;
-
+	lock_kernel();
 	for (wait=0; wait<=1; wait++)
 	{
 		err |= V2_sync_direct(inode, wait);
@@ -324,6 +320,7 @@
 		      (unsigned long *) inode->u.minix_i.u.i2_data + 9, wait);
 	}
 	err |= minix_sync_inode (inode);
+	unlock_kernel();
 	return (err < 0) ? -EIO : 0;
 }
 
@@ -336,6 +333,10 @@
 {
 	struct inode *inode = dentry->d_inode;
 	
+	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
+	     S_ISLNK(inode->i_mode)))
+		return -EINVAL;
+
 	if (INODE_VERSION(inode) == MINIX_V1)
 		return V1_minix_sync_file(inode, file);
 	else

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