Repository navigation
Conversation
…e write grant" This reverts commit 9973e48. Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
filemap_splice_read() serves the page cache without calling ->read_iter, so splice, sendfile and the copy_file_range fallback skip the size update, the DLM read grant with its invalidation fence and the direct io dispatch, and fill pages that no grant covers. Use copy_splice_read(). Fixes: 2cb1e08 ("splice: Use filemap_splice_read() instead of generic_file_splice_read()") Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
6cc84c6 to
95d0826
Compare
|
Tested this PR (6cc84c6) on a lab client: kernel 6.17.0-42, redfs.ko built from this branch, against a one-node Infinia cluster on main. Each copy is a 4 GiB file within one mount, run after a cold remount. All 24 copies matched their source under
Read side: fixed. In a FUSE request sample taken during shutil with the writeback cache, the old module sent 2243 READ/s, 85% of them single 4 KiB Write side: now the limit for splice copies, at 55-69 MB/s. Each 64 KiB chunk from the internal splice pipe becomes one synchronous WRITE: 64 KiB is at Correctness, old and new module:
Two questions:
Tracking: RED-54152. |
yongzech
left a comment
There was a problem hiding this comment.
The splice fix looks right, but this PR also reverts an unrelated fix without saying why. That revert needs to come out or get its own PR before this can merge.
1. Silent revert of #277 (blocking)
Commit b8b2f2c reverts 9973e48 ("fuse: flush dirty times when a whole-file DLM revoke drops the write grant"). That commit is the RED-52104 fix for a WRITEBACK SETATTR hang of more than ten minutes that held an RPC credit. The revert has nothing to do with splice reads, its commit message gives no reason, and neither the PR title nor the description mentions it.
If the reason is the metadata-design concern raised on #277, please put the revert in its own PR. That PR should say what replaces the fix, or explain why the RED-52104 hang can't come back, so @hazhou-ddn can respond. Merging this PR as it stands would bring back RED-52104 without anyone deciding to.
2. Splice fix (fs/fuse/file.c, fuse_splice_read): correct
filemap_splice_read() serves the page cache without calling fuse_file_read_iter(). So splice, sendfile and the splice_copy_file_range() fallback skipped the size refresh in fuse_cache_read_iter(), the range lock and DLM READ grant, and the FOPEN_DIRECT_IO / fuse_inode_force_dio() dispatch.
copy_splice_read() goes through ->read_iter with an ITER_BVEC iterator, and I checked that both read paths handle it:
- Cached path: copying into kernel pages can't fault, so the
pagefault_disable()loop runs once and!user_backed_iter()exits it cleanly. The ABBA case that loop guards against doesn't apply. - Direct path: bvec is not kvec, so
fuse_get_user_pages()takes theiov_iter_extract_pages()route, andshould_dirtyis false, which is right for pipe pages.
3. Non-blocking
- Cost: every buffered fuse splice loses zero-copy and pays an extra memcpy plus a bulk page allocation. That includes non-DLM mounts and knfsd re-export, which splices reads. Consider using
copy_splice_read()only where it's needed (fc->dlm && fc->writeback_cache,FOPEN_DIRECT_IO, orfuse_inode_force_dio()) and keepingfilemap_splice_read()otherwise. Or state in the commit message that the cost is accepted. - The passthrough branch checks
FOPEN_DIRECT_IObut notfuse_inode_force_dio(), whilefuse_file_read_iter()checks both. A force-DIO inode with passthrough still splices from the backing file. Since this commit's goal is to make splice match->read_iter, this seems worth fixing here too. - The
FOPEN_DIRECT_IOpart of the bug also exists upstream (see theFixes:tag), so this may be worth sending upstream.
4. Housekeeping
- The PR body is empty. Please describe the change and how it was tested, for example a sendfile or splice read on a DLM mount after another node writes, checking that it returns the new data and size.
- The title doesn't describe the change and doesn't mention the revert.
|
the revert is necessary ... before we add this patch ... it is a separate patch so it will be correct in the git log. regarding the PR body ... we only care about git in the kernel. No PR log here. @cryptosven76 tested it in the way described above regarding nfsd ... we don't export redfs AFAIK |
No description provided.