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

Next file: linux/fs/nfsd/export.c
Previous file: linux/fs/nfs/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.119/linux/fs/nfs/write.c linux/fs/nfs/write.c
@@ -61,6 +61,7 @@
 
 static void			nfs_wback_lock(struct rpc_task *task);
 static void			nfs_wback_result(struct rpc_task *task);
+static void			nfs_cancel_request(struct nfs_wreq *req);
 
 /*
  * Cache parameters
@@ -248,7 +249,7 @@
 
 	req = head = NFS_WRITEBACK(inode);
 	while (req != NULL) {
-		if (req->wb_dentry == dentry) {
+		if (req->wb_dentry == dentry && !WB_CANCELLED(req)) {
 			found = 1;
 			break;
 		}
@@ -474,6 +475,7 @@
 		if (!PageLocked(page))
 			break;
 		retval = -ERESTARTSYS;
+		checksignals();
 		if (signalled())
 			break;
 		schedule();
@@ -585,8 +587,11 @@
 			transfer_page_lock(req);
 			/* rpc_execute(&req->wb_task); */
 			if (sync) {
-				/* N.B. if signalled, result not ready? */
-				wait_on_write_request(req);
+				/* if signalled, ensure request is cancelled */
+				if ((count = wait_on_write_request(req)) != 0) {
+					nfs_cancel_request(req);
+					status = count;
+				}
 				if ((count = nfs_write_error(inode)) < 0)
 					status = count;
 			}

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]