From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 10/9] xfs: add debug knob to slow down writeback for fun
Date: Mon, 28 Nov 2022 15:39:47 -0800 [thread overview]
Message-ID: <Y4VGw38+m3+e/wpO@magnolia> (raw)
In-Reply-To: <20221128233021.GW3600936@dread.disaster.area>
On Tue, Nov 29, 2022 at 10:30:21AM +1100, Dave Chinner wrote:
> On Mon, Nov 28, 2022 at 02:34:05PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Add a new error injection knob so that we can arbitrarily slow down
> > writeback to test for race conditions and aberrant reclaim behavior if
> > the writeback mechanisms are slow to issue writeback. This will enable
> > functional testing for the ifork sequence counters introduced in commit
> > 745b3f76d1c8 ("xfs: maintain a sequence count for inode fork
> > manipulations").
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > fs/xfs/libxfs/xfs_errortag.h | 4 +++-
> > fs/xfs/xfs_aops.c | 12 ++++++++++--
> > fs/xfs/xfs_error.c | 11 +++++++++++
> > fs/xfs/xfs_error.h | 22 ++++++++++++++++++++++
> > 4 files changed, 46 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h
> > index 580ccbd5aadc..f5f629174eca 100644
> > --- a/fs/xfs/libxfs/xfs_errortag.h
> > +++ b/fs/xfs/libxfs/xfs_errortag.h
> > @@ -61,7 +61,8 @@
> > #define XFS_ERRTAG_LARP 39
> > #define XFS_ERRTAG_DA_LEAF_SPLIT 40
> > #define XFS_ERRTAG_ATTR_LEAF_TO_NODE 41
> > -#define XFS_ERRTAG_MAX 42
> > +#define XFS_ERRTAG_WB_DELAY_MS 42
> > +#define XFS_ERRTAG_MAX 43
> >
> > /*
> > * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
> > @@ -107,5 +108,6 @@
> > #define XFS_RANDOM_LARP 1
> > #define XFS_RANDOM_DA_LEAF_SPLIT 1
> > #define XFS_RANDOM_ATTR_LEAF_TO_NODE 1
> > +#define XFS_RANDOM_WB_DELAY_MS 3000
> >
> > #endif /* __XFS_ERRORTAG_H_ */
> > diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> > index a22d90af40c8..4a13260527b9 100644
> > --- a/fs/xfs/xfs_aops.c
> > +++ b/fs/xfs/xfs_aops.c
> > @@ -17,6 +17,8 @@
> > #include "xfs_bmap.h"
> > #include "xfs_bmap_util.h"
> > #include "xfs_reflink.h"
> > +#include "xfs_errortag.h"
> > +#include "xfs_error.h"
> >
> > struct xfs_writepage_ctx {
> > struct iomap_writepage_ctx ctx;
> > @@ -217,11 +219,15 @@ xfs_imap_valid(
> > * checked (and found nothing at this offset) could have added
> > * overlapping blocks.
> > */
> > - if (XFS_WPC(wpc)->data_seq != READ_ONCE(ip->i_df.if_seq))
> > + if (XFS_WPC(wpc)->data_seq != READ_ONCE(ip->i_df.if_seq)) {
> > + XFS_ERRORTAG_REPORT(ip->i_mount, XFS_ERRTAG_WB_DELAY_MS);
> > return false;
> > + }
> > if (xfs_inode_has_cow_data(ip) &&
> > - XFS_WPC(wpc)->cow_seq != READ_ONCE(ip->i_cowfp->if_seq))
> > + XFS_WPC(wpc)->cow_seq != READ_ONCE(ip->i_cowfp->if_seq)) {
> > + XFS_ERRORTAG_REPORT(ip->i_mount, XFS_ERRTAG_WB_DELAY_MS);
> > return false;
>
> These should be tracepoints, right?
>
> Otherwise I don't see a problem with the delay code.
Yeah. I suppose this'll be the first fstest that has to go wrangle with
setting up its own tracepoint filtering. :)
--D
> -Dave.
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2022-11-28 23:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 5:58 [PATCH 0/9 V4] xfs, iomap: fix data corrupton due to stale cached iomaps Dave Chinner
2022-11-23 5:58 ` [PATCH 1/9] xfs: write page faults in iomap are not buffered writes Dave Chinner
2022-11-23 5:58 ` [PATCH 2/9] xfs: punching delalloc extents on write failure is racy Dave Chinner
2022-11-23 5:58 ` [PATCH 3/9] xfs: use byte ranges for write cleanup ranges Dave Chinner
2022-11-23 5:58 ` [PATCH 4/9] xfs,iomap: move delalloc punching to iomap Dave Chinner
2022-11-23 5:58 ` [PATCH 5/9] iomap: buffered write failure should not truncate the page cache Dave Chinner
2022-11-23 13:24 ` kernel test robot
2022-11-23 5:58 ` [PATCH 6/9] xfs: xfs_bmap_punch_delalloc_range() should take a byte range Dave Chinner
2022-11-23 5:58 ` [PATCH 7/9] iomap: write iomap validity checks Dave Chinner
2022-11-23 5:58 ` [PATCH 8/9] xfs: use iomap_valid method to detect stale cached iomaps Dave Chinner
2022-11-23 5:58 ` [PATCH 9/9] xfs: drop write error injection is unfixable, remove it Dave Chinner
2022-11-28 22:34 ` [PATCH 10/9] xfs: add debug knob to slow down writeback for fun Darrick J. Wong
2022-11-28 23:30 ` Dave Chinner
2022-11-28 23:39 ` Darrick J. Wong [this message]
2022-11-29 1:21 ` [PATCH v2 " Darrick J. Wong
2022-11-29 1:34 ` Dave Chinner
2022-11-29 21:53 ` Darrick J. Wong
2022-11-29 21:57 ` [RFC PATCH] xfs: regression test for writeback corruption bug Darrick J. Wong
2022-11-30 17:34 ` Zorro Lang
2022-11-30 19:04 ` Darrick J. Wong
2022-12-01 15:21 ` Zorro Lang
2022-12-01 15:53 ` Darrick J. Wong
2022-11-28 22:34 ` [PATCH 11/9] xfs: add debug knob to slow down write for fun Darrick J. Wong
2022-11-29 1:22 ` [PATCH v2 " Darrick J. Wong
2022-11-29 1:37 ` Dave Chinner
2022-11-29 21:53 ` Darrick J. Wong
2022-11-29 21:55 ` [RFC PATCH] xfs: regression test for writes racing with reclaim writeback Darrick J. Wong
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=Y4VGw38+m3+e/wpO@magnolia \
--to=djwong@kernel.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).