From patchwork Thu Oct 25 15:12:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/3] mm: print out information of file affected by memory error Date: Thu, 25 Oct 2012 05:12:47 -0000 From: Naoya Horiguchi X-Patchwork-Id: 194215 Message-Id: <1351177969-893-2-git-send-email-n-horiguchi@ah.jp.nec.com> To: Andi Kleen , Tony Luck Cc: Wu Fengguang , Andrew Morton , Jan Kara , "Jun'ichi Nomura" , Akira Fujita , Naoya Horiguchi , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Printing out the information about which file can be affected by a memory error in generic_error_remove_page() is helpful for user to estimate the impact of the error. Signed-off-by: Naoya Horiguchi --- mm/truncate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git v3.7-rc2.orig/mm/truncate.c v3.7-rc2/mm/truncate.c index d51ce92..df0c6ab7 100644 --- v3.7-rc2.orig/mm/truncate.c +++ v3.7-rc2/mm/truncate.c @@ -151,14 +151,20 @@ int truncate_inode_page(struct address_space *mapping, struct page *page) */ int generic_error_remove_page(struct address_space *mapping, struct page *page) { + int ret; + struct inode *inode = mapping->host; + 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)) + if (!S_ISREG(inode->i_mode)) return -EIO; + pr_info("MCE %#lx: file info pgoff:%lu, inode:%lu, dev:%s\n", + page_to_pfn(page), page_index(page), + inode->i_ino, inode->i_sb->s_id); return truncate_inode_page(mapping, page); } EXPORT_SYMBOL(generic_error_remove_page);