Commit 3d1504c6 authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

[PATCH] 2.5.6 Fix RPC credentials when coalescing NFS reads/writes...

  The following fixes up a couple of bugs that resulted from the fix
in 2.5.4 for ETXTBSY: Since the READ requests now only store RPC
credentials and not the struct file, we need to be careful when
deciding to coalesce requests on different pages into 1 RPC call that
we compare the credentials instead of the struct file.
parent 76ec9f1c
...@@ -231,7 +231,7 @@ nfs_wait_on_request(struct nfs_page *req) ...@@ -231,7 +231,7 @@ nfs_wait_on_request(struct nfs_page *req)
* *
* Moves a maximum of 'nmax' elements from one list to another. * Moves a maximum of 'nmax' elements from one list to another.
* The elements are checked to ensure that they form a contiguous set * The elements are checked to ensure that they form a contiguous set
* of pages, and that they originated from the same file. * of pages, and that the RPC credentials are the same.
*/ */
int int
nfs_coalesce_requests(struct list_head *head, struct list_head *dst, nfs_coalesce_requests(struct list_head *head, struct list_head *dst,
...@@ -245,7 +245,7 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst, ...@@ -245,7 +245,7 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst,
req = nfs_list_entry(head->next); req = nfs_list_entry(head->next);
if (prev) { if (prev) {
if (req->wb_file != prev->wb_file) if (req->wb_cred != prev->wb_cred)
break; break;
if (page_index(req->wb_page) != page_index(prev->wb_page)+1) if (page_index(req->wb_page) != page_index(prev->wb_page)+1)
break; break;
...@@ -272,14 +272,14 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst, ...@@ -272,14 +272,14 @@ nfs_coalesce_requests(struct list_head *head, struct list_head *dst,
* *
* Tries to coalesce more requests by traversing the request's wb_list. * Tries to coalesce more requests by traversing the request's wb_list.
* Moves the resulting list into dst. Requests are guaranteed to be * Moves the resulting list into dst. Requests are guaranteed to be
* contiguous, and to originate from the same file. * contiguous, and have the same RPC credentials.
*/ */
static int static int
nfs_scan_forward(struct nfs_page *req, struct list_head *dst, int nmax) nfs_scan_forward(struct nfs_page *req, struct list_head *dst, int nmax)
{ {
struct nfs_server *server = NFS_SERVER(req->wb_inode); struct nfs_server *server = NFS_SERVER(req->wb_inode);
struct list_head *pos, *head = req->wb_list_head; struct list_head *pos, *head = req->wb_list_head;
struct file *file = req->wb_file; struct rpc_cred *cred = req->wb_cred;
unsigned long idx = page_index(req->wb_page) + 1; unsigned long idx = page_index(req->wb_page) + 1;
int npages = 0; int npages = 0;
...@@ -300,7 +300,7 @@ nfs_scan_forward(struct nfs_page *req, struct list_head *dst, int nmax) ...@@ -300,7 +300,7 @@ nfs_scan_forward(struct nfs_page *req, struct list_head *dst, int nmax)
break; break;
if (req->wb_offset != 0) if (req->wb_offset != 0)
break; break;
if (req->wb_file != file) if (req->wb_cred != cred)
break; break;
} }
return npages; return npages;
......
...@@ -764,6 +764,7 @@ int ...@@ -764,6 +764,7 @@ int
nfs_flush_incompatible(struct file *file, struct page *page) nfs_flush_incompatible(struct file *file, struct page *page)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct rpc_cred *cred = nfs_file_cred(file);
struct nfs_page *req; struct nfs_page *req;
int status = 0; int status = 0;
/* /*
...@@ -776,7 +777,7 @@ nfs_flush_incompatible(struct file *file, struct page *page) ...@@ -776,7 +777,7 @@ nfs_flush_incompatible(struct file *file, struct page *page)
*/ */
req = nfs_find_request(inode,page); req = nfs_find_request(inode,page);
if (req) { if (req) {
if (req->wb_file != file || req->wb_page != page) if (req->wb_file != file || req->wb_cred != cred || req->wb_page != page)
status = nfs_wb_page(inode, page); status = nfs_wb_page(inode, page);
nfs_release_request(req); nfs_release_request(req);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment