patch-2.1.132 linux/fs/nfs/read.c

Next file: linux/fs/nfs/write.c
Previous file: linux/fs/nfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.131/linux/fs/nfs/read.c linux/fs/nfs/read.c
@@ -229,6 +229,7 @@
 
 	dprintk("NFS: nfs_readpage (%p %ld@%ld)\n",
 		page, PAGE_SIZE, page->offset);
+	atomic_inc(&page->count);
 	set_bit(PG_locked, &page->flags);
 
 	/*
@@ -240,18 +241,24 @@
 	 */
 	error = nfs_wb_page(inode, page);
 	if (error)
-		return error;
+		goto out_error;
 
 	error = -1;
-	atomic_inc(&page->count);
 	if (!IS_SWAPFILE(inode) && !PageError(page) &&
 	    NFS_SERVER(inode)->rsize >= PAGE_SIZE)
 		error = nfs_readpage_async(dentry, inode, page);
-	if (error < 0) {	/* couldn't enqueue */
-		error = nfs_readpage_sync(dentry, inode, page);
-		if (error < 0 && IS_SWAPFILE(inode))
-			printk("Aiee.. nfs swap-in of page failed!\n");
-		free_page(page_address(page));
-	}
+	if (error >= 0)
+		goto out;
+
+	error = nfs_readpage_sync(dentry, inode, page);
+	if (error < 0 && IS_SWAPFILE(inode))
+		printk("Aiee.. nfs swap-in of page failed!\n");
+	goto out_free;
+
+out_error:
+	clear_bit(PG_locked, &page->flags);
+out_free:
+	free_page(page_address(page));
+out:
 	return error;
 }

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