Skip to contentSkip to conversation

xfs_repair: fix incorrect dabtree hashval comparison

PATCH In review Darrick J. Wong 2 participants 2 messages Mar 15, 2023 – Mar 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_repair: fix incorrect dabtree hashval comparison

From: Darrick J. Wong <[email protected]>

If an xattr structure contains enough names with the same hash value to fill multiple xattr leaf blocks with names all hashing to the same value, then the dabtree nodes will contain consecutive entries with the same hash value.

This causes false corruption reports in xfs_repair because it's not expecting such a huge same-hashing structure. Fix that.

---
 repair/da_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
repair/da_util.c +1 -1
index 7239c2e2c64..b229422c81e 100644
@@ -330,7 +330,7 @@ _("%s block used/count inconsistency - %d/%hu\n"),
 	/*
 	 * hash values monotonically increasing ???
 	 */
-	if (cursor->level[this_level].hashval >=
+	if (cursor->level[this_level].hashval >
 				be32_to_cpu(nodehdr.btree[entry].hashval)) {
 		do_warn(
 _("%s block hashvalue inconsistency, expected > %u / saw %u\n"),
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

If an xattr structure contains enough names with the same hash value to fill multiple xattr leaf blocks with names all hashing to the same value, then the dabtree nodes will contain consecutive entries with the same hash value.

This causes false corruption reports in xfs_repair because it's not expecting such a huge same-hashing structure. Fix that.

Looks good. Will test.

Quoted 17 lines
---
 repair/da_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
repair/da_util.c +1 -1
index 7239c2e2c64..b229422c81e 100644
@@ -330,7 +330,7 @@ _("%s block used/count inconsistency - %d/%hu\n"),
 	/*
 	 * hash values monotonically increasing ???
 	 */
-	if (cursor->level[this_level].hashval >=
+	if (cursor->level[this_level].hashval >
 				be32_to_cpu(nodehdr.btree[entry].hashval)) {
 		do_warn(
 _("%s block hashvalue inconsistency, expected > %u / saw %u\n"),
Signature · 1 line
Carlos Maiolino