From 37a97481ffc53b1547f86077dc059a12e311b5a0 Mon Sep 17 00:00:00 2001 From: Sven Oehme Date: Mon, 12 Oct 2026 06:28:33 +0000 Subject: [PATCH] fuse: SIGBUS a DLM fault on an aborted connection instead of retrying With the writeback cache and DLM, fuse_filemap_fault()'s slow path drops the fault lock, takes the DLM grant and reads the batch window into private folios, and returns VM_FAULT_RETRY. Errors on that path are ignored. Its comment expects a persistent error to end on the blocking path, which turns it into SIGBUS. Since 9f312f3 ("fuse: drop fault-around for shared-writable mappings under DLM") a FAULT_FLAG_TRIED pass takes the drop-and-retry path too, so a retried fault that keeps failing never gets there. Once the fault lock is dropped, VM_FAULT_RETRY is the only answer the fault can give. An aborted connection fails every request, so a task touching a non-resident page of a mapping on that mount refaults forever. It spends all its time in the kernel, ignores every signal but SIGKILL, and its mapping keeps the mount busy, so the mount cannot be unmounted and recovered. This was seen after the redfsd hang watchdog aborted a hung connection: four fio mmap jobs ran at 100% CPU for minutes, each pass allocating and freeing the batch folios in fuse_fault_read_private_folios(), and the client agent's umount failed with EBUSY until they were killed. Check the connection on the slow path while the fault lock is still held, and return VM_FAULT_SIGBUS when it is gone, which is what a fault on a non-resident page of an aborted mount returns without DLM. Resident pages with a recorded grant still map through the fast path. A persistent error on a live connection, such as a server that fails every READ, still loops the same way. Ending that needs state carried from one retry to the next and is left out here. Signed-off-by: Sven Oehme Co-Authored-By: Claude Opus 5.5 --- fs/fuse/file.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 57ec085d477139..9c0c4d392534fe 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -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; @@ -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);