Revert "zpool reopen should detect expanded devices"

This reverts commit 2a16d4cfaf.

The commit was causing a "attempt to access beyond the end
of device" error:

list.zfsonlinux.org/pipermail/zfs-discuss/2018-September/032217.html
This commit is contained in:
Tony Hutter
2018-09-13 10:11:42 -07:00
parent d126980e5f
commit 99310c0aa0
6 changed files with 41 additions and 106 deletions
@@ -26,7 +26,7 @@
#
#
# Copyright (c) 2012, 2018 by Delphix. All rights reserved.
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
# Copyright (c) 2017 Lawrence Livermore National Security, LLC.
#
@@ -43,9 +43,8 @@
# 1) Create 3 files
# 2) Create a pool backed by the files
# 3) Expand the files' size with truncate
# 4) Use zpool reopen to check the expandsize
# 5) Use zpool online -e to online the vdevs
# 6) Check that the pool size was expanded
# 4) Use zpool online -e to online the vdevs
# 5) Check that the pool size was expanded
#
verify_runnable "global"
@@ -65,8 +64,8 @@ log_onexit cleanup
log_assert "zpool can expand after zpool online -e zvol vdevs on LUN expansion"
for type in " " mirror raidz raidz2; do
# Initialize the file devices and the pool
for i in 1 2 3; do
log_must truncate -s $org_size ${TEMPFILE}.$i
done
@@ -81,35 +80,13 @@ for type in " " mirror raidz raidz2; do
"$autoexp"
fi
typeset prev_size=$(get_pool_prop size $TESTPOOL1)
typeset zfs_prev_size=$(get_prop avail $TESTPOOL1)
typeset zfs_prev_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
awk '{print $3}')
# Increase the size of the file devices
for i in 1 2 3; do
log_must truncate -s $exp_size ${TEMPFILE}.$i
done
# Reopen the pool and check that the `expandsize` property is set
log_must zpool reopen $TESTPOOL1
typeset zpool_expandsize=$(get_pool_prop expandsize $TESTPOOL1)
if [[ $type == "mirror" ]]; then
typeset expected_zpool_expandsize=$(($exp_size-$org_size))
else
typeset expected_zpool_expandsize=$((3*($exp_size-$org_size)))
fi
if [[ "$zpool_expandsize" = "-" ]]; then
log_fail "pool $TESTPOOL1 did not detect any " \
"expandsize after reopen"
fi
if [[ $zpool_expandsize -ne $expected_zpool_expandsize ]]; then
log_fail "pool $TESTPOOL1 did not detect correct " \
"expandsize after reopen: found $zpool_expandsize," \
"expected $expected_zpool_expandsize"
fi
# Online the devices to add the new space to the pool
for i in 1 2 3; do
log_must zpool online -e $TESTPOOL1 ${TEMPFILE}.$i
done
@@ -119,7 +96,8 @@ for type in " " mirror raidz raidz2; do
sync
typeset expand_size=$(get_pool_prop size $TESTPOOL1)
typeset zfs_expand_size=$(get_prop avail $TESTPOOL1)
typeset zfs_expand_size=$(zfs get -p avail $TESTPOOL1 | tail -1 | \
awk '{print $3}')
log_note "$TESTPOOL1 $type has previous size: $prev_size and " \
"expanded size: $expand_size"
@@ -134,8 +112,8 @@ for type in " " mirror raidz raidz2; do
grep "(+${expansion_size}" | wc -l)
if [[ $size_addition -ne $i ]]; then
log_fail "pool $TESTPOOL1 did not expand " \
"after LUN expansion and zpool online -e"
log_fail "pool $TESTPOOL1 is not autoexpand " \
"after LUN expansion"
fi
elif [[ $type == "mirror" ]]; then
typeset expansion_size=$(($exp_size-$org_size))
@@ -145,8 +123,8 @@ for type in " " mirror raidz raidz2; do
grep "(+${expansion_size})" >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
log_fail "pool $TESTPOOL1 did not expand " \
"after LUN expansion and zpool online -e"
log_fail "pool $TESTPOOL1 is not autoexpand " \
"after LUN expansion"
fi
else
typeset expansion_size=$((3*($exp_size-$org_size)))
@@ -156,13 +134,13 @@ for type in " " mirror raidz raidz2; do
grep "(+${expansion_size})" >/dev/null 2>&1
if [[ $? -ne 0 ]] ; then
log_fail "pool $TESTPOOL1 did not expand " \
"after LUN expansion and zpool online -e"
log_fail "pool $TESTPOOL1 is not autoexpand " \
"after LUN expansion"
fi
fi
else
log_fail "pool $TESTPOOL1 did not expand after LUN expansion " \
"and zpool online -e"
log_fail "pool $TESTPOOL1 is not autoexpanded after LUN " \
"expansion"
fi
log_must zpool destroy $TESTPOOL1
done