aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include
diff options
context:
space:
mode:
authorAlek P <[email protected]>2017-05-19 12:33:11 -0700
committerBrian Behlendorf <[email protected]>2017-05-19 12:33:11 -0700
commitbec1067d54a004cb52a4a6762bfa1d4a30300865 (patch)
treea464efb9e42d172cabbe66e7c2fb5296c5e6023d /tests/zfs-tests/include
parent4a283c7f77eb5065e9f03b122bf8ead4f4a1e2be (diff)
Implemented zpool sync command
This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to 'sync(2)' but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the 'sync(2)' cmd. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Alek Pinchuk <[email protected]> Closes #6122
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r--tests/zfs-tests/include/libtest.shlib29
1 files changed, 12 insertions, 17 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 4ad375e9d..5a9da2735 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -26,6 +26,7 @@
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
# Copyright 2016 Nexenta Systems, Inc.
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
+# Copyright (c) 2017 Datto Inc.
#
. ${STF_TOOLS}/include/logapi.shlib
@@ -3203,29 +3204,23 @@ function get_objnum
}
#
-# Synchronize all the data in pool
+# Sync data to the pool
#
# $1 pool name
+# $2 boolean to force uberblock (and config including zpool cache file) update
#
-function sync_pool #pool
+function sync_pool #pool <force>
{
typeset pool=${1:-$TESTPOOL}
+ typeset force=${2:-false}
- log_must $SYNC
- log_must sleep 2
- # Flush all the pool data.
- typeset -i ret
- zpool scrub $pool >/dev/null 2>&1
- ret=$?
- (( $ret != 0 )) && \
- log_fail "zpool scrub $pool failed."
-
- while ! is_pool_scrubbed $pool; do
- if is_pool_resilvered $pool ; then
- log_fail "$pool should not be resilver completed."
- fi
- log_must sleep 2
- done
+ if [[ $force == true ]]; then
+ log_must zpool sync -f $pool
+ else
+ log_must zpool sync $pool
+ fi
+
+ return 0
}
#