aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:50 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:50 -0500
commitdeb7d638262019cbac5d15ab74ffd1c29242c7cb (patch)
tree88095acd2d455b594f4cec08702aa9691faff2a0 /fs/nfs/pagelist.c
parent1dd761e9070aa2e543df3db41bd75ed4b8f2fab9 (diff)
NFS: Fix a race with PG_private and nfs_release_page()
We don't need to set PG_private for readahead pages, since they never get unlocked while I/O is in progress. However there is a small race in nfs_readpage_release() whereby the page may be unlocked, and have PG_private set. Fix is to have PG_private set only for the case of writes... Also fix a bug in nfs_clear_page_writeback(): Don't attempt to clear the radix_tree tag if we've already deleted the radix tree entry. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index d6e076c9dbe1..106aca388ebc 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -88,7 +88,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
88 BUG_ON(PagePrivate(page)); 88 BUG_ON(PagePrivate(page));
89 BUG_ON(!PageLocked(page)); 89 BUG_ON(!PageLocked(page));
90 BUG_ON(page->mapping->host != inode); 90 BUG_ON(page->mapping->host != inode);
91 SetPagePrivate(page);
92 req->wb_offset = offset; 91 req->wb_offset = offset;
93 req->wb_pgbase = offset; 92 req->wb_pgbase = offset;
94 req->wb_bytes = count; 93 req->wb_bytes = count;
@@ -136,9 +135,11 @@ void nfs_clear_page_writeback(struct nfs_page *req)
136{ 135{
137 struct nfs_inode *nfsi = NFS_I(req->wb_context->dentry->d_inode); 136 struct nfs_inode *nfsi = NFS_I(req->wb_context->dentry->d_inode);
138 137
139 spin_lock(&nfsi->req_lock); 138 if (req->wb_page != NULL) {
140 radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_WRITEBACK); 139 spin_lock(&nfsi->req_lock);
141 spin_unlock(&nfsi->req_lock); 140 radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_WRITEBACK);
141 spin_unlock(&nfsi->req_lock);
142 }
142 nfs_unlock_request(req); 143 nfs_unlock_request(req);
143} 144}
144 145
@@ -153,7 +154,6 @@ void nfs_clear_request(struct nfs_page *req)
153{ 154{
154 struct page *page = req->wb_page; 155 struct page *page = req->wb_page;
155 if (page != NULL) { 156 if (page != NULL) {
156 ClearPagePrivate(page);
157 page_cache_release(page); 157 page_cache_release(page);
158 req->wb_page = NULL; 158 req->wb_page = NULL;
159 } 159 }