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 v2 10/9] xfs: add debug knob to slow down writeback for fun
Date: Tue, 29 Nov 2022 13:53:13 -0800 [thread overview]
Message-ID: <Y4Z/SRoONpVMv3dZ@magnolia> (raw)
In-Reply-To: <20221129013453.GY3600936@dread.disaster.area>
On Tue, Nov 29, 2022 at 12:34:53PM +1100, Dave Chinner wrote:
> On Mon, Nov 28, 2022 at 05:21:18PM -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>
> > ---
> > v2: this time with tracepoints
> > ---
> .....
>
> > @@ -267,6 +270,14 @@ xfs_errortag_valid(
> > return true;
> > }
> >
> > +bool
> > +xfs_errortag_enabled(
> > + struct xfs_mount *mp,
> > + unsigned int tag)
> > +{
> > + return mp->m_errortag && mp->m_errortag[tag] != 0;
> > +}
>
> Perhaps consider using the new xfs_errortag_valid() helper? i.e.
>
> {
> if (!mp->errortag)
> return false;
> if (!xfs_errortag_valid(tag))
> return false;
> return mp->m_errortag[tag] != 0;
Fixed.
> }
>
> > +
> > bool
> > xfs_errortag_test(
> > struct xfs_mount *mp,
> > diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
> > index 5191e9145e55..936d0c52d6af 100644
> > --- a/fs/xfs/xfs_error.h
> > +++ b/fs/xfs/xfs_error.h
> > @@ -45,6 +45,17 @@ extern bool xfs_errortag_test(struct xfs_mount *mp, const char *expression,
> > const char *file, int line, unsigned int error_tag);
> > #define XFS_TEST_ERROR(expr, mp, tag) \
> > ((expr) || xfs_errortag_test((mp), #expr, __FILE__, __LINE__, (tag)))
> > +bool xfs_errortag_enabled(struct xfs_mount *mp, unsigned int tag);
> > +#define XFS_ERRORTAG_DELAY(mp, tag) \
> > + do { \
> > + if (!xfs_errortag_enabled((mp), (tag))) \
> > + break; \
> > + xfs_warn_ratelimited((mp), \
> > +"Injecting %ums delay at file %s, line %d, on filesystem \"%s\"", \
> > + (mp)->m_errortag[(tag)], __FILE__, __LINE__, \
> > + (mp)->m_super->s_id); \
> > + mdelay((mp)->m_errortag[(tag)]); \
> > + } while (0)
>
> Putting a might_sleep() in this macro might be a good idea - that
> will catch delays being added inside spin lock contexts...
Done. Thanks for the review!
--D
> Other than that, it looks fine.
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
>
> --
> Dave Chinner
> david@fromorbit.com
next prev parent reply other threads:[~2022-11-29 21:53 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
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 [this message]
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=Y4Z/SRoONpVMv3dZ@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).