public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ramon de Carvalho Valle <ramon@risesecurity.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Christoph Hellwig <hch@infradead.org>,
	xfs@oss.sgi.com, hch@lst.de, linux-kernel@vger.kernel.org,
	mszeredi@novell.com
Subject: Re: [PATCH 1/1] XFS: xfs_iformat realtime device target pointer check
Date: Wed, 05 Aug 2009 00:55:50 -0300	[thread overview]
Message-ID: <1249444550.7372.23.camel@logos> (raw)
In-Reply-To: <4A7887CE.2060300@sandeen.net>

[-- Attachment #1: Type: text/plain, Size: 3959 bytes --]

On Tue, 2009-08-04 at 14:11 -0500, Eric Sandeen wrote:
> Ramon de Carvalho Valle wrote:
> > The xfs_iformat function does not check if the realtime device target pointer
> > is valid when the XFS_DIFLAG_REALTIME flag is set on the ondisk inode
> > structure.
> > 
> > Signed-off-by: Christoph Hellwig <hch@infradead.org>
> > Signed-off-by: Ramon de Carvalho Valle <ramon@risesecurity.org>
> > Cc: stable <stable@kernel.org>
> > ---
> >  fs/xfs/xfs_inode.c |   23 +++++++++++++++++------
> >  1 files changed, 17 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> > index 1f22d65..37d3ee5 100644
> > --- a/fs/xfs/xfs_inode.c
> > +++ b/fs/xfs/xfs_inode.c
> > @@ -343,13 +343,24 @@ xfs_iformat(
> >  		return XFS_ERROR(EFSCORRUPTED);
> >  	}
> >  
> > +	if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
> > +			!ip->i_mount->m_rtdev_targp)) {
> > +		xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
> > +			"corrupt dinode %Lu, flags = 0x%x.",
> > +			(unsigned long long)ip->i_ino,
> > +			ip->i_d.di_flags);
> > +		XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW,
> > +				     ip->i_mount, dip);
> 
> I think I'd rather not change all the corruption text tag ordering;
> it'll make it harder to track down any common occurrences of
> "xfs_iformat(X)" corruption in the future if they get renumbered now.
> 
> I'd either make this xfs_iformat(2.1) ;) or just leave it as Christoph
> had.  "realtime" is a lot more informative than "3" anyway.

I don't think this is a bad decision, because the corruption errors can
be easily identified by the output of xfs_fs_repair_cmn_err and the
source line. I think this is a reasonable change that will keep the code
clean and consistent.

-Ramon

> 
> -Eric
> 
> > +		return XFS_ERROR(EFSCORRUPTED);
> > +	}
> > +
> >  	switch (ip->i_d.di_mode & S_IFMT) {
> >  	case S_IFIFO:
> >  	case S_IFCHR:
> >  	case S_IFBLK:
> >  	case S_IFSOCK:
> >  		if (unlikely(dip->di_format != XFS_DINODE_FMT_DEV)) {
> > -			XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW,
> > +			XFS_CORRUPTION_ERROR("xfs_iformat(4)", XFS_ERRLEVEL_LOW,
> >  					      ip->i_mount, dip);
> >  			return XFS_ERROR(EFSCORRUPTED);
> >  		}
> > @@ -371,7 +382,7 @@ xfs_iformat(
> >  					"corrupt inode %Lu "
> >  					"(local format for regular file).",
> >  					(unsigned long long) ip->i_ino);
> > -				XFS_CORRUPTION_ERROR("xfs_iformat(4)",
> > +				XFS_CORRUPTION_ERROR("xfs_iformat(5)",
> >  						     XFS_ERRLEVEL_LOW,
> >  						     ip->i_mount, dip);
> >  				return XFS_ERROR(EFSCORRUPTED);
> > @@ -384,7 +395,7 @@ xfs_iformat(
> >  					"(bad size %Ld for local inode).",
> >  					(unsigned long long) ip->i_ino,
> >  					(long long) di_size);
> > -				XFS_CORRUPTION_ERROR("xfs_iformat(5)",
> > +				XFS_CORRUPTION_ERROR("xfs_iformat(6)",
> >  						     XFS_ERRLEVEL_LOW,
> >  						     ip->i_mount, dip);
> >  				return XFS_ERROR(EFSCORRUPTED);
> > @@ -400,14 +411,14 @@ xfs_iformat(
> >  			error = xfs_iformat_btree(ip, dip, XFS_DATA_FORK);
> >  			break;
> >  		default:
> > -			XFS_ERROR_REPORT("xfs_iformat(6)", XFS_ERRLEVEL_LOW,
> > +			XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW,
> >  					 ip->i_mount);
> >  			return XFS_ERROR(EFSCORRUPTED);
> >  		}
> >  		break;
> >  
> >  	default:
> > -		XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW, ip->i_mount);
> > +		XFS_ERROR_REPORT("xfs_iformat(8)", XFS_ERRLEVEL_LOW, ip->i_mount);
> >  		return XFS_ERROR(EFSCORRUPTED);
> >  	}
> >  	if (error) {
> > @@ -430,7 +441,7 @@ xfs_iformat(
> >  				"(bad attr fork size %Ld).",
> >  				(unsigned long long) ip->i_ino,
> >  				(long long) size);
> > -			XFS_CORRUPTION_ERROR("xfs_iformat(8)",
> > +			XFS_CORRUPTION_ERROR("xfs_iformat(9)",
> >  					     XFS_ERRLEVEL_LOW,
> >  					     ip->i_mount, dip);
> >  			return XFS_ERROR(EFSCORRUPTED);
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-08-05  3:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 20:03 [PATCH 1/1] XFS: __xfs_get_blocks check pointer to the target device Ramon de Carvalho Valle
2009-08-03 21:49 ` Christoph Hellwig
2009-08-04  2:00   ` Ramon de Carvalho Valle
2009-08-04 14:31     ` Christoph Hellwig
2009-08-04 16:25     ` Eric Sandeen
2009-08-04 18:50       ` Ramon de Carvalho Valle
2009-08-04 18:51       ` [PATCH 1/1] XFS: xfs_iformat realtime device target pointer check Ramon de Carvalho Valle
2009-08-04 19:11         ` Eric Sandeen
2009-08-05  3:55           ` Ramon de Carvalho Valle [this message]
2009-08-05  4:15             ` Eric Sandeen
2009-08-05 13:21               ` Ramon de Carvalho Valle
2009-08-05 21:53               ` Felix Blyakher
2009-08-05 15:17         ` Christoph Hellwig
2009-08-05 16:34           ` Ramon de Carvalho Valle

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=1249444550.7372.23.camel@logos \
    --to=ramon@risesecurity.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@novell.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox