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

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

diff -u --recursive --new-file v2.4.3/linux/fs/nfs/write.c linux/fs/nfs/write.c
@@ -183,7 +183,6 @@
 	if (file)
 		cred = nfs_file_cred(file);
 
-	lock_kernel();
 	dprintk("NFS:      nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
 		inode->i_dev, (long long)NFS_FILEID(inode),
 		count, (long long)(page_offset(page) + offset));
@@ -228,7 +227,6 @@
 io_error:
 	kunmap(page);
 
-	unlock_kernel();
 	return written? written : result;
 }
 
@@ -282,16 +280,17 @@
 	if (page->index >= end_index+1 || !offset)
 		goto out;
 do_it:
-	if (!PageError(page) && NFS_SERVER(inode)->rsize >= PAGE_CACHE_SIZE) {
+	lock_kernel();
+	if (NFS_SERVER(inode)->rsize >= PAGE_CACHE_SIZE) {
 		err = nfs_writepage_async(NULL, inode, page, 0, offset);
 		if (err >= 0)
-			goto out_ok;
-	}
-	err = nfs_writepage_sync(NULL, inode, page, 0, offset); 
-	if ( err == offset) {
-out_ok:
-		err = 0;
+			err = 0;
+	} else {
+		err = nfs_writepage_sync(NULL, inode, page, 0, offset); 
+		if (err == offset)
+			err = 0;
 	}
+	unlock_kernel();
 out:
 	UnlockPage(page);
 	return err; 
@@ -1172,7 +1171,9 @@
 
 	rpc_clnt_sigmask(clnt, &oldset);
 	rpc_call_setup(task, &msg, 0);
+	lock_kernel();
 	rpc_execute(task);
+	unlock_kernel();
 	rpc_clnt_sigunmask(clnt, &oldset);
 	return 0;
  out_bad:
@@ -1394,7 +1395,9 @@
 	dprintk("NFS: %4d initiated commit call\n", task->tk_pid);
 	rpc_clnt_sigmask(clnt, &oldset);
 	rpc_call_setup(task, &msg, 0);
+	lock_kernel();
 	rpc_execute(task);
+	unlock_kernel();
 	rpc_clnt_sigunmask(clnt, &oldset);
 	return 0;
  out_bad:

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