This function handles the return value of the writepage, the Writepage function calls the function that the file system writes, and then returns the state of the write. Through the kernel Source view:
res = mapping->a_ops->writepage (page, &WBC); if (Res < 0) handle_write_error (mapping, page, res); if (res = = writepage_activate) {clearpagereclaim (page); return page _activate;} if (! Pagewriteback (page)) {/* synchronous write or broken A_ops? */clearpagereclaim (page);}
The following is the Handle_write_error function:
Lock_page (page); if (page_mapping (page) = = mapping) {if (Error = =-ENOSPC) set_bit (AS_ENOSPC, &mapping->flags); Elseset_bit (As_eio , &mapping->flags);} Unlock_page (page);
From here we receive an error: ENOSPC no space
As_eio a write error
Suppose a write error has the following conditions: Disk offline, disk line interruption, and so on. But we look at the above, when we find an IO write exception, we do nothing, just simply do the pagewriteback whether it is a write check, if not written, then whether this page can be released, obviously, No.
If the page is neither writable nor freed, it is permanently not recoverable by the system, which causes the physical memory to run out, causing the system to crash abnormally.
Write-Back failed processing: Handle_write_error