patch-2.3.10 linux/fs/exec.c

Next file: linux/fs/ext2/ioctl.c
Previous file: linux/fs/dquot.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/fs/exec.c linux/fs/exec.c
@@ -119,8 +119,12 @@
 {
 	struct inode * inode = dentry->d_inode;
 	struct file * f;
+	struct list_head * l = NULL;
 	int fd, error;
 
+	if (inode->i_sb)
+		l = &inode->i_sb->s_files;
+
 	error = -EINVAL;
 	if (!inode->i_op || !inode->i_op->default_file_ops)
 		goto out;
@@ -141,6 +145,7 @@
 			if (error)
 				goto out_filp;
 		}
+		file_move(f, l);
 		fd_install(fd, f);
 		dget(dentry);
 	}
@@ -465,8 +470,7 @@
 		i = j * __NFDBITS;
 		if (i >= files->max_fds)
 			break;
-		set = files->close_on_exec.fds_bits[j];
-		files->close_on_exec.fds_bits[j] = 0;
+		set = xchg(&files->close_on_exec.fds_bits[j], 0);
 		j++;
 		for ( ; set ; i++,set >>= 1) {
 			if (set & 1)
@@ -559,7 +563,7 @@
 	if ((retval = permission(inode, MAY_EXEC)) != 0)
 		return retval;
 	/* better not execute files which are being written to */
-	if (inode->i_writecount > 0)
+	if (atomic_read(&inode->i_writecount) > 0)
 		return -ETXTBSY;
 
 	bprm->e_uid = current->euid;

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