Skip to content

Commit 7e8a30f

Browse files
committed
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>
1 parent 1344b7e commit 7e8a30f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

fs/nfs/write.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,6 @@ nfs_page_group_search_locked(struct nfs_page *head, unsigned int page_offset)
243243
{
244244
struct nfs_page *req;
245245

246-
WARN_ON_ONCE(head != head->wb_head);
247-
WARN_ON_ONCE(!test_bit(PG_HEADLOCK, &head->wb_head->wb_flags));
248-
249246
req = head;
250247
do {
251248
if (page_offset >= req->wb_pgbase &&
@@ -273,18 +270,15 @@ static bool nfs_page_group_covers_page(struct nfs_page *req)
273270

274271
nfs_page_group_lock(req);
275272

276-
do {
273+
for (;;) {
277274
tmp = nfs_page_group_search_locked(req->wb_head, pos);
278-
if (tmp) {
279-
/* no way this should happen */
280-
WARN_ON_ONCE(tmp->wb_pgbase != pos);
281-
pos += tmp->wb_bytes - (pos - tmp->wb_pgbase);
282-
}
283-
} while (tmp && pos < len);
275+
if (!tmp)
276+
break;
277+
pos = tmp->wb_pgbase + tmp->wb_bytes;
278+
}
284279

285280
nfs_page_group_unlock(req);
286-
WARN_ON_ONCE(pos > len);
287-
return pos == len;
281+
return pos >= len;
288282
}
289283

290284
/* We can set the PG_uptodate flag if we see that a write request

0 commit comments

Comments
 (0)