]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Add delay between zpool add zvol and zpool destroy
authoryouzhongyang <youzhong@gmail.com>
Fri, 21 Oct 2022 17:05:13 +0000 (13:05 -0400)
committerGitHub <noreply@github.com>
Fri, 21 Oct 2022 17:05:13 +0000 (10:05 -0700)
As investigated by #14026, the zpool_add_004_pos can reliably hang if
the timing is not right. This is caused by a race condition between
zed doing zpool reopen (due to the zvol being added to the zpool),
and the command zpool destroy.

This change adds a delay between zpool add zvol and zpool destroy to
avoid these issue, but does not address the underlying problem.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Issue #14026
Closes #14052

tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_004_pos.ksh

index fbaed2af13c57b842d2bb6cf3980d848654f12f2..646edc1a4557c11e3dc70e2202d2f076ce01ecdd 100755 (executable)
@@ -74,4 +74,8 @@ log_must zpool add $TESTPOOL $ZVOL_DEVDIR/$TESTPOOL1/$TESTVOL
 
 log_must vdevs_in_pool "$TESTPOOL" "$ZVOL_DEVDIR/$TESTPOOL1/$TESTVOL"
 
+# Give zed a chance to finish processing the event, otherwise
+# a race condition can lead to stuck "zpool destroy $TESTPOOL"
+sleep 1
+
 log_pass "'zpool add <pool> <vdev> ...' adds zfs volume to the pool successfully"