summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-11-08 16:37:17 -0800
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 10:11:18 -0800
commitae19972d368b6a3d9ea239c6c77411ce0ecfcc00 (patch)
tree36d8ebc9a6cbfc5b0d21093bb50e901527c151af /fs/xfs/xfs_iomap.c
parent2ede1a74dfbfcea89b3bacb5bc2f130b68d85882 (diff)
xfs: add debug knob to slow down write for funiomap-write-races-6.2_2022-11-09
Add a new error injection knob so that we can arbitrarily slow down pagecahe writes 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 XXXXXXXXXXXX that fixes write racing with reclaim writeback. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 5e746df2c63f..048e7d9a739b 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -27,6 +27,8 @@
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"
#include "xfs_reflink.h"
+#include "xfs_error.h"
+#include "xfs_errortag.h"
#define XFS_ALLOC_ALIGN(mp, off) \
(((off) >> mp->m_allocsize_log) << mp->m_allocsize_log)
@@ -1368,11 +1370,17 @@ xfs_buffered_write_iomap_valid(
struct xfs_iomap_buffered_ctx *ibc = iter->private;
struct xfs_inode *ip = XFS_I(iter->inode);
- if (ibc->data_seq != READ_ONCE(ip->i_df.if_seq))
+ if (ibc->data_seq != READ_ONCE(ip->i_df.if_seq)) {
+ XFS_ERRORTAG_REPORT(ip->i_mount, XFS_ERRTAG_WRITE_DELAY_MS);
return false;
+ }
if (ibc->has_cow_seq &&
- ibc->cow_seq != READ_ONCE(ip->i_cowfp->if_seq))
+ ibc->cow_seq != READ_ONCE(ip->i_cowfp->if_seq)) {
+ XFS_ERRORTAG_REPORT(ip->i_mount, XFS_ERRTAG_WRITE_DELAY_MS);
return false;
+ }
+
+ XFS_ERRORTAG_DELAY(ip->i_mount, XFS_ERRTAG_WRITE_DELAY_MS);
return true;
}