aboutsummaryrefslogtreecommitdiff
path: root/mm/truncate.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2009-09-16 11:50:13 +0200
committerAndi Kleen <ak@linux.intel.com>2009-09-16 11:50:13 +0200
commit257187362123f15d9d1e09918cf87cebbea4e786 (patch)
tree92b768ad3f2afeda13a2acadc6d5766090ebcc60 /mm/truncate.c
parent83f786680aec8d030184f7ced1a0a3dd8ac81764 (diff)
HWPOISON: Define a new error_remove_page address space op for async truncation
Truncating metadata pages is not safe right now before we haven't audited all file systems. To enable truncation only for data address space define a new address_space callback error_remove_page. This is used for memory_failure.c memory error handling. This can be then set to truncate_inode_page() This patch just defines the new operation and adds documentation. Callers and users come in followon patches. Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/truncate.c')
-rw-r--r--mm/truncate.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/truncate.c b/mm/truncate.c
index ea132f7ea2d..a17b3977cfd 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -147,6 +147,23 @@ int truncate_inode_page(struct address_space *mapping, struct page *page)
}
/*
+ * Used to get rid of pages on hardware memory corruption.
+ */
+int generic_error_remove_page(struct address_space *mapping, struct page *page)
+{
+ if (!mapping)
+ return -EINVAL;
+ /*
+ * Only punch for normal data pages for now.
+ * Handling other types like directories would need more auditing.
+ */
+ if (!S_ISREG(mapping->host->i_mode))
+ return -EIO;
+ return truncate_inode_page(mapping, page);
+}
+EXPORT_SYMBOL(generic_error_remove_page);
+
+/*
* Safely invalidate one page from its pagecache mapping.
* It only drops clean, unused pages. The page must be locked.
*