cirrus: kill zfs dataset owner only when there is one

Commit 224f0b93d2 added the kill but it seems to not always be the
case there's process holding the datasets which ultimately leads to the
kill to fail and in turn CI to turn red.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2023-08-22 16:25:07 +02:00
parent 8d9f5c7062
commit 9dc0dc502a
1 changed files with 4 additions and 1 deletions

View File

@ -71,7 +71,10 @@ case $TEST_DRIVER in
zfs create $zpool/tmp
TMPDIR="/$zpool/tmp" showrun make STORAGE_DRIVER=$TEST_DRIVER local-test-integration local-test-unit
# Ensure no datasets are held open prior to `zfs destroy` trap.
kill $(lsns -J -t mnt --output-all | jq '.namespaces[]|select(.command=="sleep 1000s").pid')
datasets=$(lsns -J -t mnt --output-all | jq '.namespaces[]|select(.command=="sleep 1000s").pid')
if [[ -n "$datasets" ]]; then
kill $datasets
fi
;;
*)
die "Unknown/Unsupported \$TEST_DRIVER=$TEST_DRIVER (see .cirrus.yml and $(basename $0))"