---
name: "filemap_fault"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/filemap_fault"
---

# filemap\_fault(9)

read in file data for page fault handling

## NAME

filemap\_fault - read in file data for page fault handling

## SYNOPSIS

**int filemap\_fault(struct vm\_area\_struct \*** *vma***, struct vm\_fault \*** *vmf***);**

## ARGUMENTS

*vma*

vma in which the fault was taken

*vmf*

struct vm\_fault containing details of the fault

## DESCRIPTION

**filemap\_fault** is invoked via the vma operations vector for a mapped memory region to read in file data during a page fault.

The goto's are kind of ugly, but this streamlines the normal case of having it in the page cache, and handles the special cases reasonably without having a lot of duplicated code.

vma-\>vm\_mm-\>mmap\_sem must be held on entry.

If our return value has VM\_FAULT\_RETRY set, it's because **lock\_page\_or\_retry** returned 0. The mmap\_sem has usually been released in this case. See **\_\_lock\_page\_or\_retry** for the exception.

If our return value does not have VM\_FAULT\_RETRY set, the mmap\_sem has not been released.

We never return with VM\_FAULT\_RETRY and a bit from VM\_FAULT\_ERROR set.

## COPYRIGHT
