public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Myers <bpm@sgi.com>
To: Dave Chinner <dchinner@redhat.com>, Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/6] xfs: rework dquot CRCs
Date: Tue, 4 Jun 2013 16:46:12 -0500	[thread overview]
Message-ID: <20130604214612.GL20932@sgi.com> (raw)
In-Reply-To: <51ACDDF9.1040202@redhat.com>

On Mon, Jun 03, 2013 at 02:18:33PM -0400, Brian Foster wrote:
> On 06/03/2013 01:28 AM, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Calculating dquot CRCs when the backing buffer is written back just
> > doesn't work reliably. There are several places which manipulate
> > dquots directly in the buffers, and they don't calculate CRCs
> > appropriately, nor do they always set the buffer up to calculate
> > CRCs appropriately.
> > 
> > Firstly, if we log a dquot buffer (e.g. during allocation) it gets
> > logged without valid CRC, and so on recovery we end up with a dquot
> > that is not valid.
> > 
> > Secondly, if we recover/repair a dquot, we don't have a verifier
> > attached to the buffer and hence CRCs arenot calculate don the way
> > down to disk.
> > 
> > Thirdly, calculating the CRC after we've changed the contents means
> > that if we re-read the dquot from the buffer, we cannot verify the
> > contents of the dquot are valid, as the CRC is invalid.
> > 
> > So, to avoid all the dquot CRC errors that are being detected by the
> > read verifier, change to using the same model as for inodes. that
> > is, dquot CRCs are calculated and written to the backing buffer at
> > the time the dquot is flushed to the backing buffer. If we modify
> > the dquuot directly in the backing buffer, calculate the CRC
> > immediately after the modification is complete. Hence the dquot in
> > the on-disk buffer should always have a valid CRC.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> Reviewed-by: Brian Foster <bfoster@redhat.com>
> 
> > ---
> >  fs/xfs/xfs_dquot.c       |   37 ++++++++++++++++---------------------
> >  fs/xfs/xfs_log_recover.c |   10 ++++++++++
> >  fs/xfs/xfs_qm.c          |   40 ++++++++++++++++++++++++++++++----------
> >  fs/xfs/xfs_quota.h       |    2 ++
> >  4 files changed, 58 insertions(+), 31 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> > index a41f8bf..044e97a 100644
> > --- a/fs/xfs/xfs_dquot.c
> > +++ b/fs/xfs/xfs_dquot.c
> > @@ -249,8 +249,11 @@ xfs_qm_init_dquot_blk(
> >  		d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
> >  		d->dd_diskdq.d_id = cpu_to_be32(curid);
> >  		d->dd_diskdq.d_flags = type;
> > -		if (xfs_sb_version_hascrc(&mp->m_sb))
> > +		if (xfs_sb_version_hascrc(&mp->m_sb)) {
> >  			uuid_copy(&d->dd_uuid, &mp->m_sb.sb_uuid);
> > +			xfs_update_cksum((char *)d, sizeof(struct xfs_dqblk),
> > +					 XFS_DQUOT_CRC_OFF);
> > +		}
> >  	}
> >  
> >  	xfs_trans_dquot_buf(tp, bp,

Huh.  Looks like this buffer will not be recovered.  See
xlog_recover_do_reg_buffer... I think he'll be skipped in recovery.  Goto next.

That's not an issue with this patch though.

Reviewed-by: Ben Myers <bpm@sgi.com>

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

  reply	other threads:[~2013-06-04 21:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03  5:28 [PATCH 0/6] xfs: fixes for 3.10-rc4 Dave Chinner
2013-06-03  5:28 ` [PATCH 1/6] xfs: rework dquot CRCs Dave Chinner
2013-06-03 18:18   ` Brian Foster
2013-06-04 21:46     ` Ben Myers [this message]
2013-06-04 22:07       ` Ben Myers
2013-06-03  5:28 ` [PATCH 2/6] xfs: fix log recovery transaction item reordering Dave Chinner
2013-06-03  5:28 ` [PATCH 3/6] xfs: inode unlinked list needs to recalculate the inode CRC Dave Chinner
2013-06-03 18:18   ` Brian Foster
2013-06-04  3:06     ` Dave Chinner
2013-06-03  5:28 ` [PATCH 4/6] xfs: fix remote attribute invalidation for a leaf Dave Chinner
2013-06-03 18:59   ` Brian Foster
2013-06-03 19:09   ` Mark Tinguely
2013-06-04  3:13     ` Dave Chinner
2013-06-04 22:28   ` Ben Myers
2013-06-03  5:28 ` [PATCH 5/6] xfs: disable noattr2/attr2 mount options for CRC enabled filesystems Dave Chinner
2013-06-03 19:02   ` Brian Foster
2013-06-03 21:38   ` Mark Tinguely
2013-06-05  1:49     ` Dave Chinner
2013-06-03  5:28 ` [PATCH 6/6] xfs: increase number of ACL entries for V5 superblocks Dave Chinner
2013-06-03 22:08   ` Mark Tinguely
2013-06-04  3:26     ` Dave Chinner
2013-06-05  1:58       ` Dave Chinner
2013-06-04 15:34   ` Ben Myers
2013-06-04 22:29     ` Dave Chinner
2013-06-04 22:32       ` Ben Myers

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=20130604214612.GL20932@sgi.com \
    --to=bpm@sgi.com \
    --cc=bfoster@redhat.com \
    --cc=dchinner@redhat.com \
    --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