NFS: patch for 2.1.131-ac11 (will hopefully apply to stock 2.1.131)

Trond Myklebust (trond.myklebust@fys.uio.no)
15 Dec 1998 21:02:50 +0100


--Multipart_Tue_Dec_15_21:02:50_1998-1
Content-Type: text/plain; charset=US-ASCII

Hi,

Please note there are 2 patches included in this mail:

The first patch (to nfs/read.c) fixes a problem with page locking
that can occur if the call to nfs_wb_page in nfs_readpage fails. This
may be the cause of the hanging processes that people have recently
reported. The same problem exists in stock 2.1.131.

The second patch attempts to implement some small speedups in
nfs/write.c

Enjoy,
Trond

--Multipart_Tue_Dec_15_21:02:50_1998-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="nfs-pagelocking.dif"
Content-Transfer-Encoding: 7bit

--- linux/fs/nfs/read.c-2.1.131 Mon Dec 14 11:24:12 1998
+++ linux/fs/nfs/read.c Tue Dec 15 19:00:56 1998
@@ -235,6 +235,7 @@

dprintk("NFS: nfs_readpage (%p %ld@%ld)\n",
page, PAGE_SIZE, page->offset);
+ atomic_inc(&page->count);
set_bit(PG_locked, &page->flags);

/*
@@ -246,18 +247,21 @@
*/
error = nfs_wb_page(inode, page);
if (error)
- return error;
+ goto 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 */
+ 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 error;
+ return error;
+error:
+ if (IS_SWAPFILE(inode))
+ printk("Aiee.. nfs swap-in of page failed!\n");
+ clear_bit(PG_locked, &page->flags);
+ free_page(page_address(page));
return error;
}
--- linux/fs/nfs/write.c-2.1.131 Mon Dec 14 11:24:12 1998
+++ linux/fs/nfs/write.c Tue Dec 15 20:35:23 1998
@@ -128,9 +128,8 @@
inode->i_size = offset;
} while (count);

-io_error:
/* Note: we don't refresh if the call failed (fattr invalid) */
- if (refresh && result >= 0) {
+ if (refresh) {
/* See comments in nfs_wback_result */
/* N.B. I don't think this is right -- sync writes in order */
if (fattr.size < inode->i_size)
@@ -151,7 +150,10 @@
printk("nfs_writepage_sync: inode %ld, got %u?\n",
inode->i_ino, fattr.fileid);
}
+ if (written == PAGE_SIZE)
+ set_bit(PG_uptodate, &page->flags);

+io_error:
return written? written : result;
}

@@ -217,6 +219,10 @@
pid_t pid = current->pid;
struct nfs_wreq *head, *req;

+ unsigned int wsize = NFS_SERVER(inode)->wsize;
+ if (wsize > PAGE_SIZE) /* reflect reality */
+ wsize = PAGE_SIZE;
+
dprintk("NFS: find_write_request(%x/%ld, %p)\n",
inode->i_dev, inode->i_ino, page);
if (!(req = head = NFS_WRITEBACK(inode)))
@@ -235,7 +241,8 @@
/*
* Ehh, don't keep too many tasks queued..
*/
- rpc_wake_up_task(&req->wb_task);
+ if (req->wb_bytes >= wsize)
+ rpc_wake_up_task(&req->wb_task);

} while ((req = WB_NEXT(req)) != head);
return NULL;

--Multipart_Tue_Dec_15_21:02:50_1998-1--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/