aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-22 17:13:07 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:24 -0500
commitacee478afc6ff7e1b8852d9a4dca1ff36021414d (patch)
tree94aa75336122b4914af0cfa91eaf1329b2c519d3 /fs/nfs/pagelist.c
parent8b1f9ee56e21e505a3d5d3e33f823006d1abdbaf (diff)
NFS: Clean up the write request locking.
Ensure that we set/clear NFS_PAGE_TAG_LOCKED when the nfs_page is hashed. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 345bb9b4765b..3b3dbb94393d 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -111,13 +111,14 @@ void nfs_unlock_request(struct nfs_page *req)
111 * nfs_set_page_tag_locked - Tag a request as locked 111 * nfs_set_page_tag_locked - Tag a request as locked
112 * @req: 112 * @req:
113 */ 113 */
114static int nfs_set_page_tag_locked(struct nfs_page *req) 114int nfs_set_page_tag_locked(struct nfs_page *req)
115{ 115{
116 struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode); 116 struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode);
117 117
118 if (!nfs_lock_request(req)) 118 if (!nfs_lock_request_dontget(req))
119 return 0; 119 return 0;
120 radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); 120 if (req->wb_page != NULL)
121 radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED);
121 return 1; 122 return 1;
122} 123}
123 124
@@ -132,9 +133,10 @@ void nfs_clear_page_tag_locked(struct nfs_page *req)
132 if (req->wb_page != NULL) { 133 if (req->wb_page != NULL) {
133 spin_lock(&inode->i_lock); 134 spin_lock(&inode->i_lock);
134 radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); 135 radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED);
136 nfs_unlock_request(req);
135 spin_unlock(&inode->i_lock); 137 spin_unlock(&inode->i_lock);
136 } 138 } else
137 nfs_unlock_request(req); 139 nfs_unlock_request(req);
138} 140}
139 141
140/** 142/**
@@ -421,6 +423,7 @@ int nfs_scan_list(struct nfs_inode *nfsi,
421 goto out; 423 goto out;
422 idx_start = req->wb_index + 1; 424 idx_start = req->wb_index + 1;
423 if (nfs_set_page_tag_locked(req)) { 425 if (nfs_set_page_tag_locked(req)) {
426 kref_get(&req->wb_kref);
424 nfs_list_remove_request(req); 427 nfs_list_remove_request(req);
425 radix_tree_tag_clear(&nfsi->nfs_page_tree, 428 radix_tree_tag_clear(&nfsi->nfs_page_tree,
426 req->wb_index, tag); 429 req->wb_index, tag);