Skip to contentSkip to conversation

db: fix AGI ops definition in CRC type table

PATCH In review Dave Chinner 3 participants 3 messages Oct 13, 2015 – Oct 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 db: fix AGI ops definition in CRC type table

From: Dave Chinner <[email protected]>

The wrong buffer ops structure was added to the AGI field of the type table when initially committed. This was not noticed because it only affects manually setting the type of a buffer from xfs_db. e.g

xfs_db> agi 0
xfs_db> p
.....
crc = 0xbc58d757 (correct)
.....
xfs_db> fsb 2
xfs_db> type agi
Metadata CRC error detected at block 0x10/0x1000
xfs_db>

This is because (trimmed for clarity):

Breakpoint 1, xfs_verifier_error:
(gdb) bt

#0  xfs_verifier_error
#1  xfs_agfl_read_verify
#2  set_iocur_type
#3  type_f
#4  main

It's clear that the wrong verifier is being run (AGFL, not AGI). The fix is simple.

---
 db/type.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
db/type.c +2 -2
index 955986b..1da7ee1 100644
@@ -77,7 +77,7 @@ static const typ_t	__typtab[] = {
 static const typ_t	__typtab_crc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
@@ -113,7 +113,7 @@ static const typ_t	__typtab_crc[] = {
 static const typ_t	__typtab_spcrc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 20 lines · Dave Chinner

From: Dave Chinner <[email protected]>

The wrong buffer ops structure was added to the AGI field of the type table when initially committed. This was not noticed because it only affects manually setting the type of a buffer from xfs_db. e.g

xfs_db> agi 0
xfs_db> p
.....
crc = 0xbc58d757 (correct)
.....
xfs_db> fsb 2
xfs_db> type agi
Metadata CRC error detected at block 0x10/0x1000
xfs_db>

This is because (trimmed for clarity):

Breakpoint 1, xfs_verifier_error:
(gdb) bt

Quoted 8 lines
#0  xfs_verifier_error
#1  xfs_agfl_read_verify
#2  set_iocur_type
#3  type_f
#4  main

It's clear that the wrong verifier is being run (AGFL, not AGI). The fix is simple.

Looks reasonable, so you can add my reviewed-by if you like.

For my part I'm still figuring out how to fix this:

xfs_db> agf 2
xfs_db> type agi
Metadata CRC error detected at block 0x10/0x1000
xfs_db> p
Segmentation fault

Granted, trying to print the AGF fields of an AGI block doesn't make sense, but I feel like xfs_db should probably have a better reaction than crashing.

--D

Quoted 35 lines
---
 db/type.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
db/type.c +2 -2
index 955986b..1da7ee1 100644
@@ -77,7 +77,7 @@ static const typ_t	__typtab[] = {
 static const typ_t	__typtab_crc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
@@ -113,7 +113,7 @@ static const typ_t	__typtab_crc[] = {
 static const typ_t	__typtab_spcrc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#2 lore raw
In reply to Dave Chinner
Quoted 5 lines · Dave Chinner

From: Dave Chinner <[email protected]>

The wrong buffer ops structure was added to the AGI field of the type table when initially committed. This was not noticed because it only affects manually setting the type of a buffer from xfs_db. e.g

Quoted 58 lines

xfs_db> agi 0
xfs_db> p
.....
crc = 0xbc58d757 (correct)
.....
xfs_db> fsb 2
xfs_db> type agi
Metadata CRC error detected at block 0x10/0x1000
xfs_db>

This is because (trimmed for clarity):

Breakpoint 1, xfs_verifier_error:
(gdb) bt

#0  xfs_verifier_error
#1  xfs_agfl_read_verify
#2  set_iocur_type
#3  type_f
#4  main

It's clear that the wrong verifier is being run (AGFL, not AGI). The fix is simple.

---
 db/type.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
db/type.c +2 -2
index 955986b..1da7ee1 100644
@@ -77,7 +77,7 @@ static const typ_t	__typtab[] = {
 static const typ_t	__typtab_crc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
@@ -113,7 +113,7 @@ static const typ_t	__typtab_crc[] = {
 static const typ_t	__typtab_spcrc[] = {
 	{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
 	{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
-	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agfl_buf_ops },
+	{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
 	{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
 		&xfs_attr3_db_buf_ops },
 	{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
Signature · 6 lines
2.5.0

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Signature · 6 lines
Carlos

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs