All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Iliopoulos <ailiop@suse.com>
To: fstests@vger.kernel.org
Subject: [PATCH v2] xfs/191: fix xattr leaf block emptying on 64k blocksized fses
Date: Fri,  3 Feb 2023 18:47:44 +0100	[thread overview]
Message-ID: <20230203174744.151270-1-ailiop@suse.com> (raw)

This test is failing on filesystems with 64k blocksize since the leaf
hdr.firstused field is 16 bit and as such trying to reset it to $dbsize
overflows and is rejected by xfs_db. The leaf is never properly resetted
and the discrepancy is picked up by xfs_repair, thus failing the test.

Fix it by setting it to XFS_ATTR3_LEAF_NULLOFF (0) as this is the proper
on-disk value to indicate an empty leaf on 64k blocksized fses.

Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 tests/xfs/191 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

v2:
- moved upstream commit comment into a _fixed_by_kernel_commit
- removed trailing semicolons from assignment statements
- add rvbs

diff --git a/tests/xfs/191 b/tests/xfs/191
index 4f0a9b9eeef5..7a02f1be217c 100755
--- a/tests/xfs/191
+++ b/tests/xfs/191
@@ -30,6 +30,7 @@ _supported_fs xfs
 _require_scratch
 _require_scratch_xfs_crc # V4 is deprecated
 _fixed_by_kernel_commit 7be3bd8856fb "xfs: empty xattr leaf header blocks are not corruption"
+_fixed_by_kernel_commit e87021a2bc10 "xfs: use larger in-core attr firstused field and detect overflow"
 _fixed_by_git_commit xfsprogs f50d3462c654 "xfs_repair: ignore empty xattr leaf blocks"
 
 _scratch_mkfs_xfs | _filter_mkfs >$seqres.full 2>$tmp.mkfs
@@ -78,10 +79,19 @@ make_empty_leaf() {
 
 	base=$(_scratch_xfs_get_metadata_field "hdr.freemap[0].base" "inode $inum" "ablock 0")
 
+	# 64k dbsize is a special case since it overflows the 16 bit firstused
+	# field and it needs to be set to the special XFS_ATTR3_LEAF_NULLOFF (0)
+	# value to indicate a null leaf.
+	if [ $dbsize -eq 65536 ]; then
+		firstused=0
+	else
+		firstused=$dbsize
+	fi
+
 	_scratch_xfs_db -x -c "inode $inum" -c "ablock 0" \
 		-c "write -d hdr.count 0" \
 		-c "write -d hdr.usedbytes 0" \
-		-c "write -d hdr.firstused $dbsize" \
+		-c "write -d hdr.firstused $firstused" \
 		-c "write -d hdr.freemap[0].size $((dbsize - base))" \
 		-c print >> $seqres.full
 }
-- 
2.35.3


                 reply	other threads:[~2023-02-03 17:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203174744.151270-1-ailiop@suse.com \
    --to=ailiop@suse.com \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.