aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2017-07-17 16:58:07 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-08-15 11:54:47 -0400
commit7e8a30f8b497315a6467d86c82f6cc8acaa9db61 (patch)
treece4c4ac4b12941cf601d47cadb06b0ef9c7d5ce1
parent1344b7ea172b4911a8ee8a6ff26c5bc6b5abb302 (diff)
NFS: Fix up nfs_page_group_covers_page()
Fix up the test in nfs_page_group_covers_page(). The simplest implementation is to check that we have a set of intersecting or contiguous subrequests that connect page offset 0 to nfs_page_length(req->wb_page). Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/write.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 0f418d825185..759e37d26acf 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -243,9 +243,6 @@ nfs_page_group_search_locked(struct nfs_page *head, unsigned int page_offset)
243{ 243{
244 struct nfs_page *req; 244 struct nfs_page *req;
245 245
246 WARN_ON_ONCE(head != head->wb_head);
247 WARN_ON_ONCE(!test_bit(PG_HEADLOCK, &head->wb_head->wb_flags));
248
249 req = head; 246 req = head;
250 do { 247 do {
251 if (page_offset >= req->wb_pgbase && 248 if (page_offset >= req->wb_pgbase &&
@@ -273,18 +270,15 @@ static bool nfs_page_group_covers_page(struct nfs_page *req)
273 270
274 nfs_page_group_lock(req); 271 nfs_page_group_lock(req);
275 272
276 do { 273 for (;;) {
277 tmp = nfs_page_group_search_locked(req->wb_head, pos); 274 tmp = nfs_page_group_search_locked(req->wb_head, pos);
278 if (tmp) { 275 if (!tmp)
279 /* no way this should happen */ 276 break;
280 WARN_ON_ONCE(tmp->wb_pgbase != pos); 277 pos = tmp->wb_pgbase + tmp->wb_bytes;
281 pos += tmp->wb_bytes - (pos - tmp->wb_pgbase); 278 }
282 }
283 } while (tmp && pos < len);
284 279
285 nfs_page_group_unlock(req); 280 nfs_page_group_unlock(req);
286 WARN_ON_ONCE(pos > len); 281 return pos >= len;
287 return pos == len;
288} 282}
289 283
290/* We can set the PG_uptodate flag if we see that a write request 284/* We can set the PG_uptodate flag if we see that a write request