Skip to contentSkip to conversation

xfs: add error tags for log attribute replay test

RFC PATCH Superseded Catherine Hoang 3 participants 8 messages Jan 10, 2022 – Jan 19, 2022 XFS filesystem

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover xfs: add error tags for log attribute replay test

Hi all,

Just wanted to get this sent out again after the holidays. Original text below:

These are the corresponding kernel changes for the new log attribute replay test. These are built on top of Allison’s logged attribute patch sets, which can be viewed here:
https://github.com/allisonhenderson/xfs_work/tree/delayed_attrs_v25_extended

This set adds the new error tags larp_leaf_split and larp_leaf_to_node, which are used to inject errors in the tests.

v2 changes:
Updated naming scheme to make it clear that these error tags are meant to trigger on the attribute code path for a replay

Suggestions and feedback are appreciated!

Catherine

Catherine Hoang (2):
xfs: add leaf split error tag
xfs: add leaf to node error tag

 fs/xfs/libxfs/xfs_attr_leaf.c | 6 ++++++
 fs/xfs/libxfs/xfs_da_btree.c  | 5 +++++
 fs/xfs/libxfs/xfs_errortag.h  | 6 +++++-
 fs/xfs/xfs_error.c            | 6 ++++++
 4 files changed, 22 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH v2 1/2 xfs: add leaf split error tag

Add an error tag on xfs_da3_split to test log attribute recovery and replay.

---
 fs/xfs/libxfs/xfs_da_btree.c | 5 +++++
 fs/xfs/libxfs/xfs_errortag.h | 4 +++-
 fs/xfs/xfs_error.c           | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_da_btree.c +5 -0
index dd7a2dbce1d1..258a5fef64b2 100644
@@ -22,6 +22,7 @@
 #include "xfs_trace.h"
 #include "xfs_buf_item.h"
 #include "xfs_log.h"
+#include "xfs_errortag.h"
 
 /*
  * xfs_da_btree.c
@@ -482,6 +483,10 @@ xfs_da3_split(
 
 	trace_xfs_da_split(state->args);
 
+	if (XFS_TEST_ERROR(false, state->mp, XFS_ERRTAG_LARP_LEAF_SPLIT)) {
+		return -EIO;
+	}
+
 	/*
 	 * Walk back up the tree splitting/inserting/adjusting as necessary.
 	 * If we need to insert and there isn't room, split the node, then
fs/xfs/libxfs/xfs_errortag.h +3 -1
index c15d2340220c..970f3a3f3750 100644
@@ -60,7 +60,8 @@
 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT		37
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
-#define XFS_ERRTAG_MAX					40
+#define XFS_ERRTAG_LARP_LEAF_SPLIT			40
+#define XFS_ERRTAG_MAX					41
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -105,5 +106,6 @@
 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT		1
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
+#define XFS_RANDOM_LARP_LEAF_SPLIT			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index d4b2256ba00b..9cb6743a5ae3 100644
@@ -58,6 +58,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT,
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
+	XFS_RANDOM_LARP_LEAF_SPLIT,
 };
 
 struct xfs_errortag_attr {
@@ -172,6 +173,7 @@ XFS_ERRORTAG_ATTR_RW(reduce_max_iextents,	XFS_ERRTAG_REDUCE_MAX_IEXTENTS);
 XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT);
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -214,6 +216,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent),
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
 	NULL,
 };
 
Signature · 1 line
2.25.1
#2 lore raw

Re: [RFC PATCH v2 1/2] xfs: add leaf split error tag

Quoted 24 lines · Catherine Hoang

Add an error tag on xfs_da3_split to test log attribute recovery and replay.

---
 fs/xfs/libxfs/xfs_da_btree.c | 5 +++++
 fs/xfs/libxfs/xfs_errortag.h | 4 +++-
 fs/xfs/xfs_error.c           | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_da_btree.c +1 -0
index dd7a2dbce1d1..258a5fef64b2 100644
@@ -22,6 +22,7 @@
 #include "xfs_trace.h"
 #include "xfs_buf_item.h"
 #include "xfs_log.h"
+#include "xfs_errortag.h"
 
 /*
  * xfs_da_btree.c

fs/xfs/libxfs/xfs_da_btree.c xfs_da3_split( · line 486

Quoted 4 lines
fs/xfs/libxfs/xfs_da_btree.c +1 -0
@@ -482,6 +483,10 @@ xfs_da3_split(
 
 	trace_xfs_da_split(state->args);
 
+	if (XFS_TEST_ERROR(false, state->mp, XFS_ERRTAG_LARP_LEAF_SPLIT)) {

This error injection knob is in the middle of the dabtree code, so it really ought to be namespaced _DA_ and not _LARP_:

XFS_ERRTAG_DA_LEAF_SPLIT

A bit of background: in XFS, directories and extended file attributes both start their lives as arrays of variable length records that map a name to some sort of binary data. Directory entries map a human- readable bytestring to an inode number, and xattrs map a namespaced human-readable bytestring to a blob of binary data.

To speed up lookups by name, both structures support adding a btree index that maps the human-readable name to a hash value, then maps the hash value(s) to positions within the array. Within the xfs codebase, that btree is called the "dabtree" to distinguish it from xfs_btree, which is a totally different animal.

Hence, any error injection knobs touching xfs_da* functions really should be namespaced _DA_ to match.

(And for everyone else following along at home, "LARP" refers to Logging extended Attributes that are Replayable on Purpose or something like that.)

fs/xfs/libxfs/xfs_da_btree.c xfs_da3_split( · line 488

Quoted 2 lines
fs/xfs/libxfs/xfs_da_btree.c +2 -0
+		return -EIO;
+	}

Nit: don't need braces for a single-line if body.

Other than those two things, this looks good to me.

--D

Quoted 56 lines
fs/xfs/libxfs/xfs_da_btree.c +1 -0
+
 	/*
 	 * Walk back up the tree splitting/inserting/adjusting as necessary.
 	 * If we need to insert and there isn't room, split the node, then
fs/xfs/libxfs/xfs_errortag.h +3 -1
index c15d2340220c..970f3a3f3750 100644
@@ -60,7 +60,8 @@
 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT		37
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
-#define XFS_ERRTAG_MAX					40
+#define XFS_ERRTAG_LARP_LEAF_SPLIT			40
+#define XFS_ERRTAG_MAX					41
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -105,5 +106,6 @@
 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT		1
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
+#define XFS_RANDOM_LARP_LEAF_SPLIT			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index d4b2256ba00b..9cb6743a5ae3 100644
@@ -58,6 +58,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT,
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
+	XFS_RANDOM_LARP_LEAF_SPLIT,
 };
 
 struct xfs_errortag_attr {
@@ -172,6 +173,7 @@ XFS_ERRORTAG_ATTR_RW(reduce_max_iextents,	XFS_ERRTAG_REDUCE_MAX_IEXTENTS);
 XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT);
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -214,6 +216,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent),
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
 	NULL,
 };
 
Signature · 1 line
2.25.1
#3 lore raw

Re: [RFC PATCH v2 1/2] xfs: add leaf split error tag

Quoted 28 lines · Darrick J. Wong
Quoted 25 lines · Catherine Hoang

Add an error tag on xfs_da3_split to test log attribute recovery and replay.

---

fs/xfs/libxfs/xfs_da_btree.c | 5 +++++
fs/xfs/libxfs/xfs_errortag.h | 4 +++-
fs/xfs/xfs_error.c           | 3 +++
3 files changed, 11 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_da_btree.c +1 -0
index dd7a2dbce1d1..258a5fef64b2 100644
@@ -22,6 +22,7 @@
 #include "xfs_trace.h"
 #include "xfs_buf_item.h"
 #include "xfs_log.h"
+#include "xfs_errortag.h"
 
 /*
 * xfs_da_btree.c
@@ -482,6 +483,10 @@ xfs_da3_split(
 
Quoted 8 lines

fs/xfs/libxfs/xfs_da_btree.c xfs_da3_split( · line 486

Quoted 3 lines
fs/xfs/libxfs/xfs_da_btree.c +1 -0
 	trace_xfs_da_split(state->args);
 
+	if (XFS_TEST_ERROR(false, state->mp, XFS_ERRTAG_LARP_LEAF_SPLIT)) {

This error injection knob is in the middle of the dabtree code, so it really ought to be namespaced _DA_ and not _LARP_:

XFS_ERRTAG_DA_LEAF_SPLIT

Ok, this makes sense. Will fix, thanks for the explanation!

Quoted 20 lines

A bit of background: in XFS, directories and extended file attributes both start their lives as arrays of variable length records that map a name to some sort of binary data. Directory entries map a human- readable bytestring to an inode number, and xattrs map a namespaced human-readable bytestring to a blob of binary data.

To speed up lookups by name, both structures support adding a btree index that maps the human-readable name to a hash value, then maps the hash value(s) to positions within the array. Within the xfs codebase, that btree is called the "dabtree" to distinguish it from xfs_btree, which is a totally different animal.

Hence, any error injection knobs touching xfs_da* functions really should be namespaced _DA_ to match.

(And for everyone else following along at home, "LARP" refers to Logging extended Attributes that are Replayable on Purpose or something like that.)

Quoted 8 lines

fs/xfs/libxfs/xfs_da_btree.c xfs_da3_split( · line 488

Quoted 2 lines
fs/xfs/libxfs/xfs_da_btree.c +2 -0
+		return -EIO;
+	}

Nit: don't need braces for a single-line if body.

Other than those two things, this looks good to me.

--D

Sure, I’ll remove the braces here.

Quoted 57 lines
Quoted 57 lines
fs/xfs/libxfs/xfs_da_btree.c +1 -0
+
 	/*
 	 * Walk back up the tree splitting/inserting/adjusting as necessary.
 	 * If we need to insert and there isn't room, split the node, then
fs/xfs/libxfs/xfs_errortag.h +3 -1
index c15d2340220c..970f3a3f3750 100644
@@ -60,7 +60,8 @@
 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT		37
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
-#define XFS_ERRTAG_MAX					40
+#define XFS_ERRTAG_LARP_LEAF_SPLIT			40
+#define XFS_ERRTAG_MAX					41
 
 /*
 * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -105,5 +106,6 @@
 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT		1
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
+#define XFS_RANDOM_LARP_LEAF_SPLIT			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index d4b2256ba00b..9cb6743a5ae3 100644
@@ -58,6 +58,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT,
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
+	XFS_RANDOM_LARP_LEAF_SPLIT,
 };
 
 struct xfs_errortag_attr {
@@ -172,6 +173,7 @@ XFS_ERRORTAG_ATTR_RW(reduce_max_iextents,	XFS_ERRTAG_REDUCE_MAX_IEXTENTS);
 XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT);
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -214,6 +216,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent),
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
 	NULL,
 };
 
Signature · 1 line
2.25.1
#4 lore raw

RFC PATCH v2 2/2 xfs: add leaf to node error tag

In reply to Catherine Hoang

Add an error tag on xfs_attr3_leaf_to_node to test log attribute recovery and replay.

---
 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(-)
fs/xfs/libxfs/xfs_attr_leaf.c +6 -0
index 74b76b09509f..0fe028d95c77 100644
@@ -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_LARP_LEAF_TO_NODE)) {
+		error = -EIO;
+		goto out;
+	}
+
 	error = xfs_da_grow_inode(args, &blkno);
 	if (error)
 		goto out;
fs/xfs/libxfs/xfs_errortag.h +3 -1
index 970f3a3f3750..6d90f06442e8 100644
@@ -61,7 +61,8 @@
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
 #define XFS_ERRTAG_LARP_LEAF_SPLIT			40
-#define XFS_ERRTAG_MAX					41
+#define XFS_ERRTAG_LARP_LEAF_TO_NODE			41
+#define XFS_ERRTAG_MAX					42
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -107,5 +108,6 @@
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
 #define XFS_RANDOM_LARP_LEAF_SPLIT			1
+#define XFS_RANDOM_LARP_LEAF_TO_NODE			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index 9cb6743a5ae3..ae2003a95324 100644
@@ -59,6 +59,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
 	XFS_RANDOM_LARP_LEAF_SPLIT,
+	XFS_RANDOM_LARP_LEAF_TO_NODE,
 };
 
 struct xfs_errortag_attr {
@@ -174,6 +175,7 @@ XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTE
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
 XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_to_node,	XFS_ERRTAG_LARP_LEAF_TO_NODE);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -217,6 +219,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
 	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_to_node),
 	NULL,
 };
 
Signature · 1 line
2.25.1
Reviewed-by on v2 2/2
#5 lore raw

Re: [RFC PATCH v2 2/2] xfs: add leaf to node error tag

Quoted 5 lines · Catherine Hoang

Add an error tag on xfs_attr3_leaf_to_node to test log attribute recovery and replay.

This one actually /is/ an error injection knob for specific xattr activities, so the naming is appropriate.

--D

Quoted 82 lines
---
 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(-)
fs/xfs/libxfs/xfs_attr_leaf.c +6 -0
index 74b76b09509f..0fe028d95c77 100644
@@ -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_LARP_LEAF_TO_NODE)) {
+		error = -EIO;
+		goto out;
+	}
+
 	error = xfs_da_grow_inode(args, &blkno);
 	if (error)
 		goto out;
fs/xfs/libxfs/xfs_errortag.h +3 -1
index 970f3a3f3750..6d90f06442e8 100644
@@ -61,7 +61,8 @@
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
 #define XFS_ERRTAG_LARP_LEAF_SPLIT			40
-#define XFS_ERRTAG_MAX					41
+#define XFS_ERRTAG_LARP_LEAF_TO_NODE			41
+#define XFS_ERRTAG_MAX					42
 
 /*
  * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -107,5 +108,6 @@
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
 #define XFS_RANDOM_LARP_LEAF_SPLIT			1
+#define XFS_RANDOM_LARP_LEAF_TO_NODE			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index 9cb6743a5ae3..ae2003a95324 100644
@@ -59,6 +59,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
 	XFS_RANDOM_LARP_LEAF_SPLIT,
+	XFS_RANDOM_LARP_LEAF_TO_NODE,
 };
 
 struct xfs_errortag_attr {
@@ -174,6 +175,7 @@ XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTE
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
 XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_to_node,	XFS_ERRTAG_LARP_LEAF_TO_NODE);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -217,6 +219,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
 	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_to_node),
 	NULL,
 };
 
Signature · 1 line
2.25.1
#6 lore raw

Re: [External] : Re: [RFC PATCH v2 2/2] xfs: add leaf to node error tag

Quoted 9 lines · Darrick J. Wong
Quoted 5 lines · Catherine Hoang

Add an error tag on xfs_attr3_leaf_to_node to test log attribute recovery and replay.

Quoted 6 lines

This one actually /is/ an error injection knob for specific xattr activities, so the naming is appropriate.

--D

Thanks for the review!

Quoted 83 lines
Quoted 83 lines

---

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(-)
fs/xfs/libxfs/xfs_attr_leaf.c +6 -0
index 74b76b09509f..0fe028d95c77 100644
@@ -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_LARP_LEAF_TO_NODE)) {
+		error = -EIO;
+		goto out;
+	}
+
 	error = xfs_da_grow_inode(args, &blkno);
 	if (error)
 		goto out;
fs/xfs/libxfs/xfs_errortag.h +3 -1
index 970f3a3f3750..6d90f06442e8 100644
@@ -61,7 +61,8 @@
 #define XFS_ERRTAG_AG_RESV_FAIL				38
 #define XFS_ERRTAG_LARP					39
 #define XFS_ERRTAG_LARP_LEAF_SPLIT			40
-#define XFS_ERRTAG_MAX					41
+#define XFS_ERRTAG_LARP_LEAF_TO_NODE			41
+#define XFS_ERRTAG_MAX					42
 
 /*
 * Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
@@ -107,5 +108,6 @@
 #define XFS_RANDOM_AG_RESV_FAIL				1
 #define XFS_RANDOM_LARP					1
 #define XFS_RANDOM_LARP_LEAF_SPLIT			1
+#define XFS_RANDOM_LARP_LEAF_TO_NODE			1
 
 #endif /* __XFS_ERRORTAG_H_ */
fs/xfs/xfs_error.c +3 -0
index 9cb6743a5ae3..ae2003a95324 100644
@@ -59,6 +59,7 @@ static unsigned int xfs_errortag_random_default[] = {
 	XFS_RANDOM_AG_RESV_FAIL,
 	XFS_RANDOM_LARP,
 	XFS_RANDOM_LARP_LEAF_SPLIT,
+	XFS_RANDOM_LARP_LEAF_TO_NODE,
 };
 
 struct xfs_errortag_attr {
@@ -174,6 +175,7 @@ XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent,	XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTE
 XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL);
 XFS_ERRORTAG_ATTR_RW(larp,		XFS_ERRTAG_LARP);
 XFS_ERRORTAG_ATTR_RW(larp_leaf_split,	XFS_ERRTAG_LARP_LEAF_SPLIT);
+XFS_ERRORTAG_ATTR_RW(larp_leaf_to_node,	XFS_ERRTAG_LARP_LEAF_TO_NODE);
 
 static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(noerror),
@@ -217,6 +219,7 @@ static struct attribute *xfs_errortag_attrs[] = {
 	XFS_ERRORTAG_ATTR_LIST(ag_resv_fail),
 	XFS_ERRORTAG_ATTR_LIST(larp),
 	XFS_ERRORTAG_ATTR_LIST(larp_leaf_split),
+	XFS_ERRORTAG_ATTR_LIST(larp_leaf_to_node),
 	NULL,
 };
 
Signature · 1 line
2.25.1
#7 lore raw
In reply to Catherine Hoang

Hi Catherine,

I know I've already rvb'd these, but these all look great to me. So, if no one else has any complaints I am happy to add these error tags to the larp series. I am getting ready to send out another revision soon. Thanks for all your help here :-)

Allison

Quoted 31 lines · Catherine Hoang

Hi all,

Just wanted to get this sent out again after the holidays. Original text below:

These are the corresponding kernel changes for the new log attribute replay test. These are built on top of Allison’s logged attribute patch sets, which can be viewed here:
https://github.com/allisonhenderson/xfs_work/tree/delayed_attrs_v25_extended

This set adds the new error tags larp_leaf_split and larp_leaf_to_node, which are used to inject errors in the tests.

v2 changes:
Updated naming scheme to make it clear that these error tags are meant to trigger on the attribute code path for a replay

Suggestions and feedback are appreciated!

Catherine

Catherine Hoang (2):
xfs: add leaf split error tag
xfs: add leaf to node error tag

  fs/xfs/libxfs/xfs_attr_leaf.c | 6 ++++++
  fs/xfs/libxfs/xfs_da_btree.c  | 5 +++++
  fs/xfs/libxfs/xfs_errortag.h  | 6 +++++-
  fs/xfs/xfs_error.c            | 6 ++++++
  4 files changed, 22 insertions(+), 1 deletion(-)