Whamcloud - gitweb
LU-17736 tests: Fix sanityn/73 for test machines with auditd 09/54809/3
authorEllis Wilson <elliswilson@microsoft.com>
Fri, 8 Oct 2021 14:27:39 +0000 (10:27 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Apr 2024 06:58:13 +0000 (06:58 +0000)
getfattr performs one stat followed by two getxattr syscalls against
the provided file.  Normally, the stat results in no getxattr calls
internally (as it's not something stat is required to return).

However, if auditd is enabled AND one of the rules includes a
filesystem-specific rule such as watch directory X and record if it's
modified, then for every lookup (each of the three syscalls includes
one) an additional getxattr will be performed, resulting in 5 total
getxattrs.

Because there is significant fuzz here, revise the check to be
at minimum the two "expected" getxattrs but allow for more.
Comments have been added explaining this.

Signed-off-by: Ellis Wilson <elliswilson@microsoft.com>
Test-Parameters: trivial testlist=sanityn env=ONLY=73,ONLY_REPEAT=10
Change-Id: I0da5c2a5331f7dba4e65051a073e2bec05327a25
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54809
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanityn.sh

index 4c76231..896dce9 100755 (executable)
@@ -4028,12 +4028,15 @@ test_73() {
        clear_stats llite.*.stats
        # PR lock should be cached by now on both clients
        getfattr -n user.attr1 $DIR1/$tfile || error "getfattr3 failed"
-       # 2 hits for getfattr(0)+getfattr(size)
-       [ $(calc_stats llite.*.stats getxattr_hits) -eq 2 ] ||
+       # At least 2 hits for getfattr(0)+getfattr(size)
+       # There may be more if auditd has a filesystem-related rule enabled
+       (( $(calc_stats llite.*.stats getxattr_hits) >= 2 )) ||
                error "not cached in $DIR1"
+       clear_stats llite.*.stats
        getfattr -n user.attr1 $DIR2/$tfile || error "getfattr4 failed"
-       # 4 hits for more getfattr(0)+getfattr(size)
-       [ $(calc_stats llite.*.stats getxattr_hits) -eq 4 ] ||
+       # At least 2 hits for getfattr(0)+getfattr(size)
+       # There may be more if auditd has a filesystem-related rule enabled
+       (( $(calc_stats llite.*.stats getxattr_hits) >= 2 )) ||
                error "not cached in $DIR2"
        rm -f $DIR2/$tfile