From 9dc0dc502a1529d221318d97e53a8d1572b0484c Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Tue, 22 Aug 2023 16:25:07 +0200 Subject: [PATCH] cirrus: kill zfs dataset owner only when there is one Commit 224f0b93d28c 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 --- contrib/cirrus/build_and_test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/cirrus/build_and_test.sh b/contrib/cirrus/build_and_test.sh index 8b1f3ad10..7d8f3e1fb 100755 --- a/contrib/cirrus/build_and_test.sh +++ b/contrib/cirrus/build_and_test.sh @@ -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))"