--- old/usr/src/test/zfs-tests/runfiles/delphix.run	2014-06-21 08:48:47.977703980 +1000
+++ new/usr/src/test/zfs-tests/runfiles/delphix.run	2014-06-21 08:48:47.992912017 +1000
@@ -229,7 +229,7 @@
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_expand]
 tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos',
-    'zpool_expand_003_neg']
+    'zpool_expand_003_neg', 'zpool_expand_004_pos']
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_export]
 tests = ['zpool_export_001_pos', 'zpool_export_002_pos',
--- old/usr/src/test/zfs-tests/runfiles/omnios.run	2014-06-21 08:48:48.419315843 +1000
+++ new/usr/src/test/zfs-tests/runfiles/omnios.run	2014-06-21 08:48:48.432619387 +1000
@@ -229,7 +229,7 @@
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_expand]
 tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos',
-    'zpool_expand_003_neg']
+    'zpool_expand_003_neg', 'zpool_expand_004_pos']
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_export]
 tests = ['zpool_export_001_pos', 'zpool_export_002_pos',
--- old/usr/src/test/zfs-tests/runfiles/openindiana.run	2014-06-21 08:48:48.888763263 +1000
+++ new/usr/src/test/zfs-tests/runfiles/openindiana.run	2014-06-21 08:48:48.903088361 +1000
@@ -229,7 +229,7 @@
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_expand]
 tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos',
-    'zpool_expand_003_neg']
+    'zpool_expand_003_neg', 'zpool_expand_004_pos']
 
 [/opt/zfs-tests/tests/functional/cli_root/zpool_export]
 tests = ['zpool_export_001_pos', 'zpool_export_002_pos',
--- /dev/null	2014-06-21 08:48:49.000000000 +1000
+++ new/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_004_pos	2014-06-21 08:48:49.369022372 +1000
@@ -0,0 +1,120 @@
+#! /bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_expand/zpool_expand.cfg
+
+#
+# DESCRIPTION:
+# vdev retains asize when 2nd last mirror child is removed while autoexpand=off
+#
+#
+# STRATEGY:
+# 1) Create a pool
+# 2) Create different sized volumes on top of the pool
+# 3) Create pool with autoepand=off using the zvols in a 2-way mirror
+# 4) Detach the smaller of the 2 vdev's from the mirror 
+# 5) Ensure that smaller vdev can be re-attached
+# 6) Detach the smaller vdev again to ensure no expand at import 
+# 7) Export pool
+# 8) Import pool 
+# 9) Check that the pool size has not expanded
+# 10) Ensure that smaller vdev can be re-attached
+#
+
+verify_runnable "global"
+
+function cleanup
+{
+	if poolexists $TESTPOOL1; then
+		log_must $ZPOOL destroy $TESTPOOL1
+	fi
+
+	for i in 1 2; do
+		if datasetexists $VFS/vol$i; then
+			log_must $ZFS destroy $VFS/vol$i
+		fi
+	done
+}
+
+log_onexit cleanup
+
+log_assert "vdev retains asize when 2nd last mirror child is removed while" \
+    "autoexpand=off"
+
+log_must $ZFS create -V $org_size $VFS/vol1
+log_must $ZFS create -V $exp_size $VFS/vol2
+
+log_must $ZPOOL create -f -o autoexpand=off $TESTPOOL1 mirror \
+    /dev/zvol/dsk/$VFS/vol1  /dev/zvol/dsk/$VFS/vol2
+
+typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1)
+if [[ $autoexp != "off" ]]; then
+	log_fail "zpool $TESTPOOL1 autoexpand should off but is $autoexp"
+fi
+
+typeset prev_size=$(get_pool_prop size $TESTPOOL1)
+typeset zfs_prev_size=$($ZFS get -p avail $TESTPOOL1 | $TAIL -1 | \
+    $AWK '{print $3}')
+
+log_must $ZPOOL detach $TESTPOOL1 /dev/zvol/dsk/$VFS/vol1 
+
+$SYNC
+$SLEEP 10
+$SYNC
+
+log_must $ZPOOL attach $TESTPOOL1 /dev/zvol/dsk/$VFS/vol2 \
+    /dev/zvol/dsk/$VFS/vol1
+
+log_must $ZPOOL detach $TESTPOOL1 /dev/zvol/dsk/$VFS/vol1 
+
+log_must $ZPOOL export $TESTPOOL1
+
+log_must $ZPOOL import -d /dev/zvol/dsk/$VFS $TESTPOOL1
+
+typeset post_size=$(get_pool_prop size $TESTPOOL1)
+typeset zfs_post_size=$($ZFS get -p avail $TESTPOOL1 | $TAIL -1 | \
+    $AWK '{print $3}')
+
+log_note "$TESTPOOL1 mirror had previous size: $prev_size and " \
+    "after detach has size: $post_size"
+# compare available pool size from zfs
+if [[ $zfs_post_size > $zfs_prev_size ]]; then
+	log_fail "pool $TESTPOOL1 has autoexpanded with " \
+	    "autoexpand=off when smaller mirror child removed"
+fi
+
+log_must $ZPOOL attach $TESTPOOL1 /dev/zvol/dsk/$VFS/vol2 /dev/zvol/dsk/$VFS/vol1 
+
+log_must $ZPOOL destroy $TESTPOOL1
+
+log_pass "pool $TESTPOOL1 retained size after smaller child" \
+    "was removed from mirror with autoexpand=off"
