Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3771,7 +3771,20 @@ static vm_fault_t fuse_filemap_fault(struct vm_fault *vmf)
* the retried fast path only means the range is contended
* again; waiting for it must happen with mmap_lock
* dropped, every time.
*
* The flip side is that an error met with mmap_lock
* dropped cannot be reported: only VM_FAULT_RETRY (or
* COMPLETED) may be returned then, and a retried fault
* that keeps failing comes straight back here. An
* aborted connection fails every request, so the task
* would refault forever: it burns CPU in this path,
* only SIGKILL ends it, and its mapping keeps the mount
* busy. Check it while the fault lock is still held,
* where SIGBUS can be returned.
*/
if (!READ_ONCE(fc->connected))
return VM_FAULT_SIGBUS;

if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT)
return VM_FAULT_RETRY;
Expand All @@ -3784,10 +3797,10 @@ static vm_fault_t fuse_filemap_fault(struct vm_fault *vmf)
range_mode);
if (!err) {
/*
* A hard error is not failed here: the
* retried fault ends up on the blocking
* path below, which turns a persistent
* error into SIGBUS.
* A hard error is not failed here, it
* cannot be with the fault lock dropped:
* the retried fault meets it again. A
* lost connection ends at the check above.
*/
fuse_get_dlm_lock(file, bpos, blen,
mode, &rlock);
Expand Down