From: Mike Marshall orangefs_page_mkwrite attaches a private range for the whole folio, then returns VM_FAULT_NOPAGE if folio->mapping is no longer this inode's mapping. Truncate can clear that mapping before the fault locks the folio. The new range stayed attached. The folio stayed on the LRU with mapping NULL, so reclaim called try_to_free_buffers. drop_buffers walked the range as a buffer_head and faulted. The word at offset 8 was the range length, 0x1000 or 0x2000. Detach and free the range before unlocking. The folio lock is held, so this is the range just attached or updated. The detatch and free has been missing since orangefs_page_mkwrite was added. attach_page_private replaced the open-coded attach in 2020 and this failure path was left unchanged. A full xfstests run hit this from kswapd in generic/751, generic/694, and generic/551. The private object was an orangefs_write_range for the folio being freed, and mapping was already NULL. Signed-off-by: Mike Marshall --- fs/orangefs/inode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 04a2c928452e..7b17af735a9e 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -732,6 +732,11 @@ vm_fault_t orangefs_page_mkwrite(struct vm_fault *vmf) file_update_time(vmf->vma->vm_file); if (folio->mapping != inode->i_mapping) { + /* + * Truncate already dropped this folio. Drop the write + * range too, or reclaim will read it as a buffer_head. + */ + kfree(folio_detach_private(folio)); folio_unlock(folio); ret = VM_FAULT_LOCKED|VM_FAULT_NOPAGE; goto out; -- 2.56.1