diff mbox series

xfs_repair: fix incorrect dabtree hashval comparison

Message ID 20230315010155.GE11376@frogsfrogsfrogs (mailing list archive)
State Superseded
Headers show
Series xfs_repair: fix incorrect dabtree hashval comparison | expand

Commit Message

Darrick J. Wong March 15, 2023, 1:01 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

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.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 repair/da_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Carlos Maiolino March 17, 2023, 10:27 a.m. UTC | #1
On Tue, Mar 14, 2023 at 06:01:55PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good. Will test.

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> ---
>  repair/da_util.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/repair/da_util.c b/repair/da_util.c
> index 7239c2e2c64..b229422c81e 100644
> --- a/repair/da_util.c
> +++ b/repair/da_util.c
> @@ -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"),
diff mbox series

Patch

diff --git a/repair/da_util.c b/repair/da_util.c
index 7239c2e2c64..b229422c81e 100644
--- a/repair/da_util.c
+++ b/repair/da_util.c
@@ -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"),