Whamcloud - gitweb
LU-17733 tests: sanity test_45 fix dirty count 63/54763/3
authorCyrus Ramavarapu <cramavarapu@microsoft.com>
Wed, 15 Nov 2023 14:30:37 +0000 (14:30 +0000)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Jun 2024 06:10:46 +0000 (06:10 +0000)
Change test comparisons to ge (>=) instead of gt (>). A comment was
added identifying the race condition within the test related to the
completion of async io.  Also updated sync condition to check dirty
bytes after sync is equal to 0

Test-Parameters: testlist=sanity env=ONLY=45
Signed-off-by: Cyrus Ramavarapu <cramavarapu@microsoft.com>
Change-Id: I5826d82a16e20101a2eb8d415bdbde1b6bcc8d69
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54763
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index f158339..db72a9e 100755 (executable)
@@ -5842,22 +5842,33 @@ test_45() {
        echo blah > ${f}_grant
        stop_writeback
        sync
+
+       # cur_dirty_bytes is related and modified by the OSC cache granting
+       # code. It is possible for the grants to be freed during async IO
+       # completion resulting in 0 vs 0 comparisons for truncates and sync.
+       # Since it can't be reliably proven that the operation did lower the
+       # count, the comparisons are changed to >= (ge) rather than > (gt).
+       #
+       # N.B. This whole test seems flawed as the process doesn't hold file
+       # descriptors, syscalls are not explicit, and dirty data is subject to
+       # async changes outside of the MM subsystem. Some consideration should
+       # be given to removing/rewriting this test.
        do_dirty_record "echo blah > $f"
-       [[ $before -eq $after ]] && error "write wasn't cached"
+       (( before == after )) && error "write wasn't cached"
        do_dirty_record "> $f"
-       [[ $before -gt $after ]] || error "truncate didn't lower dirty count"
+       (( before >= after )) || error "truncate didn't lower dirty count"
        do_dirty_record "echo blah > $f"
-       [[ $before -eq $after ]] && error "write wasn't cached"
+       (( before == after )) && error "write wasn't cached"
        do_dirty_record "sync"
-       [[ $before -gt $after ]] || error "writeback didn't lower dirty count"
+       (( after == 0 )) || error "writeback didn't zero dirty count"
        do_dirty_record "echo blah > $f"
-       [[ $before -eq $after ]] && error "write wasn't cached"
+       (( before == after )) && error "write wasn't cached"
        do_dirty_record "cancel_lru_locks osc"
-       [[ $before -gt $after ]] ||
+       (( before >= after )) ||
                error "lock cancellation didn't lower dirty count"
        start_writeback
 }
-run_test 45 "osc io page accounting ============================"
+run_test 45 "osc io page accounting"
 
 # in a 2 stripe file (lov.sh), page 1023 maps to page 511 in its object.  this
 # test tickles a bug where re-dirtying a page was failing to be mapped to the