Re: [PATCH 10/9] xfs: add debug knob to slow down writeback for fun

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > 
> > 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@xxxxxxxxxx>
> > ---
> >  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@xxxxxxxxxxxxx



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux