patch-2.1.117 linux/fs/nfs/write.c

Next file: linux/fs/proc/array.c
Previous file: linux/fs/nfs/nfs2xdr.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.116/linux/fs/nfs/write.c linux/fs/nfs/write.c
@@ -468,7 +468,9 @@
 	struct wait_queue	wait = { current, NULL };
 	struct page		*page = req->wb_page;
 	int			retval;
+	sigset_t		oldmask;
 
+	rpc_clnt_sigmask(NFS_CLIENT(req->wb_inode), &oldmask);
 	add_wait_queue(&page->wait, &wait);
 	atomic_inc(&page->count);
 	for (;;) {
@@ -477,7 +479,8 @@
 		if (!PageLocked(page))
 			break;
 		retval = -ERESTARTSYS;
-		if (IS_SOFT && signalled())
+		/* IS_SOFT is a timeout item .. */
+		if (signalled())
 			break;
 		schedule();
 	}
@@ -485,6 +488,7 @@
 	current->state = TASK_RUNNING;
 	/* N.B. page may have been unused, so we must use free_page() */
 	free_page(page_address(page));
+	rpc_clnt_sigunmask(NFS_CLIENT(req->wb_inode), &oldmask);
 	return retval;
 }
 
@@ -534,6 +538,10 @@
 	if ((req = find_write_request(inode, page)) != NULL) {
 		if (update_write_request(req, offset, count)) {
 			/* N.B. check for a fault here and cancel the req */
+			/*
+			 *	SECURITY - copy_from_user must zero the
+			 *	rest of the data after a fault!
+			 */
 			copy_from_user(page_addr + offset, buffer, count);
 			goto updated;
 		}
@@ -889,6 +897,9 @@
 		/* Update attributes as result of writeback. 
 		 * Beware: when UDP replies arrive out of order, we
 		 * may end up overwriting a previous, bigger file size.
+		 *
+		 * When the file size shrinks we cancel all pending
+		 * writebacks. 
 		 */
 		if (fattr->mtime.seconds >= inode->i_mtime) {
 			if (fattr->size < inode->i_size)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov