All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH, V2] metadump: don't verify metadata being dumped
Date: Fri, 28 Feb 2014 15:46:17 +1100	[thread overview]
Message-ID: <20140228044617.GK30131@dastard> (raw)
In-Reply-To: <53100B2D.8000509@sandeen.net>

On Thu, Feb 27, 2014 at 10:06:05PM -0600, Eric Sandeen wrote:
> On 2/27/14, 8:51 PM, Dave Chinner wrote:
> > @@ -1374,6 +1384,7 @@ process_single_fsb_objects(
> >  		o++;
> >  		dp += mp->m_sb.sb_blocksize;
> >  	}
> > +	iocur_top->need_crc = 1;
> 
> in the 
> 
> default:
> 
> case we don't obfuscate.  Should it still get need_crc?

Ah, right. I looked at the "dont_obfuscate" jump, not the switch
statement. Will fix.

> > +/*
> > + * when we process the inode, we may change the data in the data and/or
> > + * attribute fork if they are in short form and we are obfuscating names.
> > + * In this case we need to recalculate the CRC of the inode, but we should
> > + * only do that if the CRC in the inode is good to begin with. If the crc
> > + * is not ok, we just leave it alone.
> > + */
> >  static int
> >  process_inode(
> >  	xfs_agnumber_t		agno,
> > @@ -1729,17 +1748,28 @@ process_inode(
> >  	xfs_dinode_t 		*dip)
> >  {
> >  	int			success;
> > +	bool			crc_ok = false; /* don't recalc by default */
> > +	bool			need_crc = false;
> 
> I might do
> 
> +	bool			crc_was_ok = false; /* don't recalc by default */
> +	bool			need_new_crc = false;
> 
> for clarity...? 

*nod*

> >  	success = 1;
> >  	cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
> >  
> > +	/* we only care about crc recalculation if we are obfuscating names. */
> > +	if (!dont_obfuscate)
> > +		crc_ok = xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
> > +					  offsetof(struct xfs_dinode, di_crc));
> > +
> >  	/* copy appropriate data fork metadata */
> >  	switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
> >  		case S_IFDIR:
> >  			success = process_inode_data(dip, TYP_DIR2);
> > +			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
> > +				need_crc = 1;
> 
> I wish this were closer to the point of obfuscation, but oh well.

It means carrying a tristate or extra varaible through the stack,
which doesn't make it any simpler to understand because we have to
do the CRC here once we know we've finished all the modifications to
the inode....

> 
> >  			break;
> >  		case S_IFLNK:
> >  			success = process_inode_data(dip, TYP_SYMLINK);
> > +			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
> > +				need_crc = 1;
> >  			break;
> >  		case S_IFREG:
> >  			success = process_inode_data(dip, TYP_DATA);
> > @@ -1754,6 +1784,7 @@ process_inode(
> >  		attr_data.remote_val_count = 0;
> >  		switch (dip->di_aformat) {
> >  			case XFS_DINODE_FMT_LOCAL:
> > +				need_crc = 1;
> >  				if (!dont_obfuscate)
> >  					obfuscate_sf_attr(dip);

And this one kind of forces us to do it here if we want to only have
one place where we recalc CRCs...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2014-02-28  4:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28  0:53 [PATCH] metadump: don't verify metadata being dumped Dave Chinner
2014-02-28  1:43 ` Eric Sandeen
2014-02-28  1:57   ` Dave Chinner
2014-02-28  2:51 ` [PATCH, V2] " Dave Chinner
2014-02-28  4:06   ` Eric Sandeen
2014-02-28  4:46     ` Dave Chinner [this message]

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=20140228044617.GK30131@dastard \
    --to=david@fromorbit.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 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.