Commit 3e217045 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust

nfs: handle multiple reqs in nfs_wb_page_cancel

Use nfs_lock_and_join_requests to merge all subrequests into the head request -
this cancels and dereferences all subrequests.
Signed-off-by: default avatarWeston Andros Adamson <dros@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent d4581383
...@@ -1799,27 +1799,28 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page) ...@@ -1799,27 +1799,28 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
struct nfs_page *req; struct nfs_page *req;
int ret = 0; int ret = 0;
for (;;) { wait_on_page_writeback(page);
wait_on_page_writeback(page);
req = nfs_page_find_head_request(page); /* blocking call to cancel all requests and join to a single (head)
if (req == NULL) * request */
break; req = nfs_lock_and_join_requests(page, false);
if (nfs_lock_request(req)) {
nfs_clear_request_commit(req); if (IS_ERR(req)) {
nfs_inode_remove_request(req); ret = PTR_ERR(req);
/* } else if (req) {
* In case nfs_inode_remove_request has marked the /* all requests from this page have been cancelled by
* page as being dirty * nfs_lock_and_join_requests, so just remove the head
*/ * request from the inode / page_private pointer and
cancel_dirty_page(page, PAGE_CACHE_SIZE); * release it */
nfs_unlock_and_release_request(req); nfs_inode_remove_request(req);
break; /*
} * In case nfs_inode_remove_request has marked the
ret = nfs_wait_on_request(req); * page as being dirty
nfs_release_request(req); */
if (ret < 0) cancel_dirty_page(page, PAGE_CACHE_SIZE);
break; nfs_unlock_and_release_request(req);
} }
return ret; return ret;
} }
......
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