All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	Akira Fujita <a-fujita@rs.jp.nec.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] mm: print out information of file affected by memory error
Date: Thu, 25 Oct 2012 21:32:49 +0200	[thread overview]
Message-ID: <20121025193249.GC3262@quack.suse.cz> (raw)
In-Reply-To: <1351177969-893-2-git-send-email-n-horiguchi@ah.jp.nec.com>

On Thu 25-10-12 11:12:47, Naoya Horiguchi wrote:
> 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 <n-horiguchi@ah.jp.nec.com>
> ---
>  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;
> +
  This will oops if mapping == NULL. Currently the only caller seems to
check beforehand but still, it's better keep the code as robust as it it.

>  	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);
  Otherwise the patch looks OK.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi.kleen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Wu Fengguang <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	Akira Fujita <a-fujita@rs.jp.nec.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] mm: print out information of file affected by memory error
Date: Thu, 25 Oct 2012 21:32:49 +0200	[thread overview]
Message-ID: <20121025193249.GC3262@quack.suse.cz> (raw)
In-Reply-To: <1351177969-893-2-git-send-email-n-horiguchi@ah.jp.nec.com>

On Thu 25-10-12 11:12:47, Naoya Horiguchi wrote:
> 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 <n-horiguchi@ah.jp.nec.com>
> ---
>  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;
> +
  This will oops if mapping == NULL. Currently the only caller seems to
check beforehand but still, it's better keep the code as robust as it it.

>  	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);
  Otherwise the patch looks OK.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-10-25 19:32 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 15:12 [PATCH 0/3] HWPOISON: improve error_remove_page() Naoya Horiguchi
2012-10-25 15:12 ` Naoya Horiguchi
2012-10-25 15:12 ` [PATCH 1/3] mm: print out information of file affected by memory error Naoya Horiguchi
2012-10-25 15:12   ` Naoya Horiguchi
2012-10-25 19:32   ` Jan Kara [this message]
2012-10-25 19:32     ` Jan Kara
2012-10-25 20:34     ` Naoya Horiguchi
2012-10-25 20:34       ` Naoya Horiguchi
2012-10-25 15:12 ` [PATCH 2/3] ext4: introduce ext4_error_remove_page Naoya Horiguchi
2012-10-25 15:12   ` Naoya Horiguchi
2012-10-25 19:39   ` Jan Kara
2012-10-25 19:39     ` Jan Kara
2012-10-26  6:12   ` Theodore Ts'o
2012-10-26  6:12     ` Theodore Ts'o
2012-10-26 16:55     ` Luck, Tony
2012-10-26 16:55       ` Luck, Tony
2012-10-26 18:46       ` Theodore Ts'o
2012-10-26 18:46         ` Theodore Ts'o
2012-10-26 22:24         ` Luck, Tony
2012-10-26 22:24           ` Luck, Tony
2012-10-27 22:16           ` Theodore Ts'o
2012-10-27 22:16             ` Theodore Ts'o
2012-10-28  1:57             ` Naoya Horiguchi
2012-10-28  1:57               ` Naoya Horiguchi
2012-10-28  1:57               ` Naoya Horiguchi
2012-10-29  1:16             ` Dave Chinner
2012-10-29  1:16               ` Dave Chinner
2012-10-29  2:40               ` Theodore Ts'o
2012-10-29  2:40                 ` Theodore Ts'o
2012-10-29 10:37                 ` Andi Kleen
2012-10-29 10:37                   ` Andi Kleen
2012-10-29 10:37                   ` Andi Kleen
2012-10-29 11:05                   ` Jun'ichi Nomura
2012-10-29 11:05                     ` Jun'ichi Nomura
2012-10-29 11:05                     ` Jun'ichi Nomura
2012-10-29 18:24                   ` Theodore Ts'o
2012-10-29 18:24                     ` Theodore Ts'o
2012-10-29 18:55                     ` Jan Kara
2012-10-29 18:55                       ` Jan Kara
2012-10-29 19:07                     ` Andi Kleen
2012-10-29 19:07                       ` Andi Kleen
2012-10-29 19:07                       ` Andi Kleen
2012-10-29 21:47                       ` Naoya Horiguchi
2012-10-29 21:47                         ` Naoya Horiguchi
2012-10-30  0:00                       ` Jun'ichi Nomura
2012-10-30  0:00                         ` Jun'ichi Nomura
2012-10-30  0:00                         ` Jun'ichi Nomura
2012-10-29 18:11             ` Luck, Tony
2012-10-29 18:11               ` Luck, Tony
2012-10-31  0:21               ` Dave Chinner
2012-10-31  0:21                 ` Dave Chinner
2012-10-26 18:50     ` Naoya Horiguchi
2012-10-26 18:50       ` Naoya Horiguchi
2012-10-26 18:50       ` Naoya Horiguchi
2012-10-25 15:12 ` [PATCH 3/3] ext3: introduce ext3_error_remove_page Naoya Horiguchi
2012-10-25 15:12   ` Naoya Horiguchi
2012-10-25 19:45   ` Jan Kara
2012-10-25 19:45     ` Jan Kara
2012-10-25 20:35     ` Naoya Horiguchi
2012-10-25 20:35       ` Naoya Horiguchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121025193249.GC3262@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=a-fujita@rs.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.