All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/4] xfs: quotacheck leaves dquot buffers without verifiers
Date: Wed, 30 Jul 2014 12:30:12 -0400	[thread overview]
Message-ID: <20140730163012.GC2830@bfoster.bfoster> (raw)
In-Reply-To: <1406684929-11133-4-git-send-email-david@fromorbit.com>

On Wed, Jul 30, 2014 at 11:48:48AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> When running xfs/305, I noticed that quotacheck was flushing dquot
> buffers that did not have the xfs_dquot_buf_ops verifiers attached:
> 
> XFS (vdb): _xfs_buf_ioapply: no ops on block 0x1dc8/0x1dc8
> ffff880052489000: 44 51 01 04 00 00 65 b8 00 00 00 00 00 00 00 00  DQ....e.........
> ffff880052489010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> ffff880052489020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> ffff880052489030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> CPU: 1 PID: 2376 Comm: mount Not tainted 3.16.0-rc2-dgc+ #306
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>  ffff88006fe38000 ffff88004a0ffae8 ffffffff81cf1cca 0000000000000001
>  ffff88004a0ffb88 ffffffff814d50ca 000010004a0ffc70 0000000000000000
>  ffff88006be56dc4 0000000000000021 0000000000001dc8 ffff88007c773d80
> Call Trace:
>  [<ffffffff81cf1cca>] dump_stack+0x45/0x56
>  [<ffffffff814d50ca>] _xfs_buf_ioapply+0x3ca/0x3d0
>  [<ffffffff810db520>] ? wake_up_state+0x20/0x20
>  [<ffffffff814d51f5>] ? xfs_bdstrat_cb+0x55/0xb0
>  [<ffffffff814d513b>] xfs_buf_iorequest+0x6b/0xd0
>  [<ffffffff814d51f5>] xfs_bdstrat_cb+0x55/0xb0
>  [<ffffffff814d53ab>] __xfs_buf_delwri_submit+0x15b/0x220
>  [<ffffffff814d6040>] ? xfs_buf_delwri_submit+0x30/0x90
>  [<ffffffff814d6040>] xfs_buf_delwri_submit+0x30/0x90
>  [<ffffffff8150f89d>] xfs_qm_quotacheck+0x17d/0x3c0
>  [<ffffffff81510591>] xfs_qm_mount_quotas+0x151/0x1e0
>  [<ffffffff814ed01c>] xfs_mountfs+0x56c/0x7d0
>  [<ffffffff814f0f12>] xfs_fs_fill_super+0x2c2/0x340
>  [<ffffffff811c9fe4>] mount_bdev+0x194/0x1d0
>  [<ffffffff814f0c50>] ? xfs_finish_flags+0x170/0x170
>  [<ffffffff814ef0f5>] xfs_fs_mount+0x15/0x20
>  [<ffffffff811ca8c9>] mount_fs+0x39/0x1b0
>  [<ffffffff811e4d67>] vfs_kern_mount+0x67/0x120
>  [<ffffffff811e757e>] do_mount+0x23e/0xad0
>  [<ffffffff8117abde>] ? __get_free_pages+0xe/0x50
>  [<ffffffff811e71e6>] ? copy_mount_options+0x36/0x150
>  [<ffffffff811e8103>] SyS_mount+0x83/0xc0
>  [<ffffffff81cfd40b>] tracesys+0xdd/0xe2
> 
> This was caused by dquot buffer readahead not attaching a verifier
> structure to the buffer when readahead was issued, resulting in the
> followup read of the buffer finding a valid buffer and so not
> attaching new verifiers to the buffer as part of the read.
> 
> Also, when a verifier failure occurs, we then read the buffer
> without verifiers. Attach the verifiers manually after this read so
> that if the buffer is then written it will be verified that the
> corruption has been repaired.
> 
> Further, when flushing a dquot we don't ask for a verifier when
> reading in the dquot buffer the dquot belongs to. Most of the time
> this isn't an issue because the buffer is still cached, but when it
> is not cached it will result in writing the dquot buffer without
> having the verfier attached.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_dquot.c | 3 ++-
>  fs/xfs/xfs_qm.c    | 8 +++++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 8a44a79..63c2de4 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -974,7 +974,8 @@ xfs_qm_dqflush(
>  	 * Get the buffer containing the on-disk dquot
>  	 */
>  	error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
> -				   mp->m_quotainfo->qi_dqchunklen, 0, &bp, NULL);
> +				   mp->m_quotainfo->qi_dqchunklen, 0, &bp,
> +				   &xfs_dquot_buf_ops);
>  	if (error)
>  		goto out_unlock;
>  
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 7e1a80b..1023210 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -911,6 +911,12 @@ xfs_qm_dqiter_bufs(
>  		if (error)
>  			break;
>  
> +		/*
> +		 * A corrupt buffer might not have a verifier attached, so
> +		 * make sure we have the correct one attached before writeback
> +		 * occurs.
> +		 */
> +		bp->b_ops = &xfs_dquot_buf_ops;
>  		xfs_qm_reset_dqcounts(mp, bp, firstid, type);
>  		xfs_buf_delwri_queue(bp, buffer_list);
>  		xfs_buf_relse(bp);
> @@ -996,7 +1002,7 @@ xfs_qm_dqiterate(
>  					xfs_buf_readahead(mp->m_ddev_targp,
>  					       XFS_FSB_TO_DADDR(mp, rablkno),
>  					       mp->m_quotainfo->qi_dqchunklen,
> -					       NULL);
> +					       &xfs_dquot_buf_ops);
>  					rablkno++;
>  				}
>  			}
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

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

  reply	other threads:[~2014-07-30 16:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30  1:48 [PATCH 0/4] xfs: missing verifer fixes Dave Chinner
2014-07-30  1:48 ` [PATCH 1/4] xfs: catch buffers written without verifiers attached Dave Chinner
2014-07-30  2:29   ` Dave Chinner
2014-07-30  2:30   ` [PATCH 1/4 V2] " Dave Chinner
2014-07-30 16:29     ` Brian Foster
2014-07-30 21:39       ` Dave Chinner
2014-07-30  1:48 ` [PATCH 2/4] xfs: ensure verifiers are attached to recovered buffers Dave Chinner
2014-07-30 16:30   ` Brian Foster
2014-07-30  1:48 ` [PATCH 3/4] xfs: quotacheck leaves dquot buffers without verifiers Dave Chinner
2014-07-30 16:30   ` Brian Foster [this message]
2014-07-30  1:48 ` [PATCH 4/4] xfs: dquot recovery needs verifiers Dave Chinner
2014-07-30 12:30   ` Fanael Linithien
2014-07-30 21:43     ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2014-07-31  1:01 [PATCH 0/4 V2] xfs: missing verifier fixes Dave Chinner
2014-07-31  1:01 ` [PATCH 3/4] xfs: quotacheck leaves dquot buffers without verifiers Dave Chinner
2014-08-01 14:28   ` Christoph Hellwig

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=20140730163012.GC2830@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.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 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.