Skip to content

pgio: fix buffered write retry path

Weston Andros Adamson linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5nfs: mark nfs_page reqs with flag for extra reffs/nfs/pagelist.c fs/nfs/write.c+9 -30 replies
2/5nfs: nfs_page should take a ref on the head reqfs/nfs/pagelist.c+10 -00 replies
3/5nfs: change find_request to find_head_requestfs/nfs/write.c+24 -90 replies
4/5nfs: handle multiple reqs in nfs_page_async_flushfs/nfs/internal.h fs/nfs/pagelist.c fs/nfs/write.c+234 -251 reply
5/5nfs: handle multiple reqs in nfs_wb_page_cancelfs/nfs/write.c+21 -200 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] pgio: fix buffered write retry path

My recent pgio work added the ability to split requests into sub-page regions, but didn't handle a few places in the writeback code where requests are looked up by struct page and may already be split into multiple requests.

This patchset adds a function "nfs_lock_and_join_requests" in patch "nfs: handle multiple reqs in nfs_page_async_flush", which:
- takes mutex lock
- looks up head request
- grabs request lock for each subrequest
- if unsuccessful, unrolls old locks and waits on subrequest
- removes all requests from commit lists
- merges range of subrequests into the head requests
- unlinks and destroys the old subrequests.

The other patches are related fixes.

The problem showed up when mounting with wsize < PAGE_SIZE - this would cause multiple requests per page. If a commit failed, nfs_page_async_flush would operate just on the head request, leading to a hang.

The nfs_wb_page_cancel patch leverages the same function - nfs_lock_and_join_requests cancels all operations on the page group. I've had a really hard time testing nfs_wb_page_cancel, I've only hit it once in weeks of testing. Any ideas on how to reliably trigger this is appreciated - it's not as easy as just kicking off a ton of writeback then truncating. The one time I did see it was with a ton of i/o on a VM with 256M of RAM, which was swapping like crazy, along with restarting the server repeatedly (to get commit verifier mismatch).

Thanks,
-dros

Weston Andros Adamson (5):
nfs: mark nfs_page reqs with flag for extra ref
nfs: nfs_page should take a ref on the head req
nfs: change find_request to find_head_request
nfs: handle multiple reqs in nfs_page_async_flush
nfs: handle multiple reqs in nfs_wb_page_cancel

 fs/nfs/internal.h |   1 +
 fs/nfs/pagelist.c |  18 ++-
 fs/nfs/write.c    | 332 +++++++++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 296 insertions(+), 55 deletions(-)
Signature · 1 line
1.8.5.2 (Apple Git-48)