patch-2.4.0-test3 linux/fs/open.c

Next file: linux/fs/partitions/Config.in
Previous file: linux/fs/ntfs/fs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/fs/open.c linux/fs/open.c
@@ -11,6 +11,7 @@
 #include <linux/smp_lock.h>
 #include <linux/quotaops.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
@@ -114,7 +115,6 @@
 	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
 		goto dput_and_out;
 
-	lock_kernel();
 	error = get_write_access(inode);
 	if (error)
 		goto dput_and_out;
@@ -125,7 +125,6 @@
 		error = do_truncate(nd.dentry, length);
 	}
 	put_write_access(inode);
-	unlock_kernel();
 
 dput_and_out:
 	path_release(&nd);
@@ -161,11 +160,9 @@
 	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
 		goto out_putf;
 
-	lock_kernel();
 	error = locks_verify_truncate(inode, file, length);
 	if (!error)
 		error = do_truncate(dentry, length);
-	unlock_kernel();
 out_putf:
 	fput(file);
 out:
@@ -335,8 +332,6 @@
 	struct nameidata nd;
 	char *name;
 
-	lock_kernel();
-	
 	name = getname(filename);
 	error = PTR_ERR(name);
 	if (IS_ERR(name))
@@ -358,7 +353,6 @@
 dput_and_out:
 	path_release(&nd);
 out:
-	unlock_kernel();
 	return error;
 }
 
@@ -383,11 +377,9 @@
 	if (!S_ISDIR(inode->i_mode))
 		goto out_putf;
 
-	lock_kernel();
 	error = permission(inode, MAY_EXEC);
 	if (!error)
 		set_fs_pwd(current->fs, mnt, dentry);
-	unlock_kernel();
 out_putf:
 	fput(file);
 out:
@@ -400,8 +392,6 @@
 	struct nameidata nd;
 	char *name;
 
-	lock_kernel();
-	
 	name = getname(filename);
 	error = PTR_ERR(name);
 	if (IS_ERR(name))
@@ -428,7 +418,6 @@
 dput_and_out:
 	path_release(&nd);
 out:
-	unlock_kernel();
 	return error;
 }
 
@@ -457,9 +446,7 @@
 		mode = inode->i_mode;
 	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-	lock_kernel();
 	err = notify_change(dentry, &newattrs);
-	unlock_kernel();
 
 out_putf:
 	fput(file);
@@ -755,10 +742,7 @@
 	if (!IS_ERR(tmp)) {
 		fd = get_unused_fd();
 		if (fd >= 0) {
-			struct file * f;
-			lock_kernel();
-			f = filp_open(tmp, flags, mode);
-			unlock_kernel();
+			struct file *f = filp_open(tmp, flags, mode);
 			error = PTR_ERR(f);
 			if (IS_ERR(f))
 				goto out_error;
@@ -801,8 +785,11 @@
 		return 0;
 	}
 	retval = 0;
-	if (filp->f_op && filp->f_op->flush)
+	if (filp->f_op && filp->f_op->flush) {
+		lock_kernel();
 		retval = filp->f_op->flush(filp);
+		unlock_kernel();
+	}
 	locks_remove_posix(filp, id);
 	fput(filp);
 	return retval;
@@ -832,9 +819,7 @@
 	if (release)
 		__put_unused_fd(files, fd);
 	write_unlock(&files->file_lock);
-	lock_kernel();
 	error = filp_close(filp, files);
-	unlock_kernel();
 out:
 	return error;
 out_unlock:

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