From 36afd11a790891444ccf34393537efca72e79502 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 25 Aug 2022 23:22:10 +0200 Subject: [PATCH] ZTS: zvol_stress: fix race condition with zinject usage In automated ZTS runs, I'd occasionally hit log_fail "Expected to see some write errors" because there weren't any write errors. The reason is that we're not syncing the zpool before `zinject -c`. If the writes by `dd` aren't synced out at the time `zinject -c` runs, they will not hit an error and we'll hit the log_fail above. Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Christian Schwarz Closes #13793 --- .../zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh b/tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh index 883d9984be43..3431d33d97d0 100755 --- a/tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh +++ b/tests/zfs-tests/tests/functional/zvol/zvol_stress/zvol_stress.ksh @@ -151,6 +151,7 @@ for DISK in $DISKS ; do log_must zinject -d $DISK -f 10 -e io -T write $TESTPOOL done log_must dd if=/dev/zero of=$ZVOL_DEVDIR/$TESTPOOL/testvol1 bs=512 count=50 +sync_pool $TESTPOOL log_must zinject -c all # We should see write errors