[PATCH 6/8] common/filter: fix _filter_file_attributes to handle xfs file flags

Darrick J. Wong
2025-10-15T16:38:17Z

From: Darrick J. Wong <djwong@kernel.org>

Currently, _filter_file_attributes can only filter ext4 lsattr flags.
Update it to handle XFS lsattr flags as well.

Cc: <fstests@vger.kernel.org> # v2025.10.05
Fixes: 4eb40174d77c1b ("generic: introduce test to test file_getattr/file_setattr syscalls")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
common/filter | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/filter b/common/filter
index b330b27827d005..c3a751dd0c398c 100644
--- a/common/filter
+++ b/common/filter
@@ -688,10 +688,11 @@ _filter_sysfs_error()
# ... | _filter_file_attributes X
# Or to filter all except X
# ... | _filter_file_attributes ~X
+# Be careful, we're filtering lsattr or xfs_io -c lsattr flags.
_filter_file_attributes()
{
if [[ $1 == ~* ]]; then
- regex=$(echo "[aAcCdDeEFijmNPsStTuxVX]" | tr -d "$1")
+ regex=$(echo "[aAcCdDeEfFijmNpPsrStTuxVX]" | tr -d "$1")
else
regex="$1"
fi