On Thu, Nov 11, 2021 at 12:17:16AM +0000, Catherine Hoang wrote: > Add an error tag on xfs_attr3_leaf_to_node to test log attribute > recovery and replay. > > Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx> > --- > fs/xfs/libxfs/xfs_attr_leaf.c | 6 ++++++ > fs/xfs/libxfs/xfs_errortag.h | 4 +++- > fs/xfs/xfs_error.c | 3 +++ > 3 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c > index 74b76b09509f..fdeb09de74ca 100644 > --- a/fs/xfs/libxfs/xfs_attr_leaf.c > +++ b/fs/xfs/libxfs/xfs_attr_leaf.c > @@ -28,6 +28,7 @@ > #include "xfs_dir2.h" > #include "xfs_log.h" > #include "xfs_ag.h" > +#include "xfs_errortag.h" > > > /* > @@ -1189,6 +1190,11 @@ xfs_attr3_leaf_to_node( > > trace_xfs_attr_leaf_to_node(args); > > + if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_LEAF_TO_NODE)) { > + error = -EIO; > + goto out; > + } > + > error = xfs_da_grow_inode(args, &blkno); > if (error) > goto out; > diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h > index 31aeeb94dd5b..cc1650b58723 100644 > --- a/fs/xfs/libxfs/xfs_errortag.h > +++ b/fs/xfs/libxfs/xfs_errortag.h > @@ -61,7 +61,8 @@ > #define XFS_ERRTAG_AG_RESV_FAIL 38 > #define XFS_ERRTAG_LARP 39 > #define XFS_ERRTAG_LEAF_SPLIT 40 > -#define XFS_ERRTAG_MAX 41 > +#define XFS_ERRTAG_LEAF_TO_NODE 41 > +#define XFS_ERRTAG_MAX 42 Same again about naming. THis is an attribute fork injection point, not a generic "leaf-to-node" error injection point. Whihc makes me wonder: this is testing just the initial leaf split shape change. There are other shape changes - inline -> leaf, leaf -> multi-level tree (xfs_da3_split()) and multi-level -> single level leaf, leaf -> inline - for the attr tree, and there are even more shape changes for the directory tree (inline, leaf, leafN, node) As a general infrastructure question, are we really going to now add separate error injections for each different shape change on each different type of btree? That explodes the number of injection points quite quickly.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx