OpenZFS 7404 - rootpool_007_neg, bootfs_006_pos and bootfs_008_neg tests fail with the loader project bits

Authored by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

Porting Notes:
- Removed gzip and zle compression restriction on bootfs
  datasets.  Grub added support for these long ago.  Ay
  version of grub which understands lz4 also supports this.
- Enabled rootpool tests in runfile but skipped by default
  in setup on Linux since they modify the rootpool.
- bootfs_006_pos.ksh, striped pools are allowed as bootfs.

OpenZFS-issue: https://www.illumos.org/issues/7404
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/55a424c
Closes #5982
This commit is contained in:
Toomas Soome 2016-12-02 23:13:44 -08:00 committed by Brian Behlendorf
parent 10f251191f
commit 8aab121821
11 changed files with 66 additions and 106 deletions

View File

@ -120,6 +120,16 @@ enum zio_checksum {
#define BOOTFS_COMPRESS_VALID(compress) \
((compress) == ZIO_COMPRESS_LZJB || \
(compress) == ZIO_COMPRESS_LZ4 || \
(compress) == ZIO_COMPRESS_GZIP_1 || \
(compress) == ZIO_COMPRESS_GZIP_2 || \
(compress) == ZIO_COMPRESS_GZIP_3 || \
(compress) == ZIO_COMPRESS_GZIP_4 || \
(compress) == ZIO_COMPRESS_GZIP_5 || \
(compress) == ZIO_COMPRESS_GZIP_6 || \
(compress) == ZIO_COMPRESS_GZIP_7 || \
(compress) == ZIO_COMPRESS_GZIP_8 || \
(compress) == ZIO_COMPRESS_GZIP_9 || \
(compress) == ZIO_COMPRESS_ZLE || \
(compress) == ZIO_COMPRESS_ON || \
(compress) == ZIO_COMPRESS_OFF)

View File

@ -28,12 +28,10 @@ tests = ['posix_003_pos']
[tests/functional/atime]
tests = ['atime_001_pos', 'atime_002_neg', 'atime_003_pos']
# DISABLED:
# bootfs_006_pos - needs investigation
# bootfs_008_neg - needs investigation
[tests/functional/bootfs]
tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos',
'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_007_neg']
'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos',
'bootfs_008_pos']
# DISABLED:
# cache_001_pos - needs investigation
@ -562,9 +560,8 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos',
'reservation_013_pos', 'reservation_014_pos', 'reservation_015_pos',
'reservation_016_pos', 'reservation_017_pos']
# DISABLED: Root pools must be handled differently under Linux
#[tests/functional/rootpool]
#tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_neg']
[tests/functional/rootpool]
tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos']
# DISABLED:
# rsend_008_pos - Fails for OpenZFS on illumos

View File

@ -2702,8 +2702,11 @@ function is_zfsroot
function get_rootfs
{
typeset rootfs=""
rootfs=$(awk '{if ($2 == "/" && $3 == "zfs") print $1}' \
/etc/mnttab)
if ! is_linux; then
rootfs=$(awk '{if ($2 == "/" && $3 == "zfs") print $1}' \
/etc/mnttab)
fi
if [[ -z "$rootfs" ]]; then
log_fail "Can not get rootfs"
fi
@ -2724,8 +2727,11 @@ function get_rootpool
{
typeset rootfs=""
typeset rootpool=""
rootfs=$(awk '{if ($2 == "/" && $3 =="zfs") print $1}' \
/etc/mnttab)
if ! is_linux; then
rootfs=$(awk '{if ($2 == "/" && $3 =="zfs") print $1}' \
/etc/mnttab)
fi
if [[ -z "$rootfs" ]]; then
log_fail "Can not get rootpool"
fi

View File

@ -8,5 +8,5 @@ dist_pkgdata_SCRIPTS = \
bootfs_004_neg.ksh \
bootfs_005_neg.ksh \
bootfs_006_pos.ksh \
bootfs_007_neg.ksh \
bootfs_008_neg.ksh
bootfs_007_pos.ksh \
bootfs_008_pos.ksh

View File

@ -117,30 +117,40 @@ verify_bootfs $TESTPOOL
log_must zpool create $TESTPOOL mirror $VDEV1 $VDEV2 spare $VDEV3
verify_bootfs $TESTPOOL
## the following configurations are not supported as bootable pools
if is_linux; then
# stripe
log_must zpool create $TESTPOOL $VDEV1 $VDEV2
verify_bootfs $TESTPOOL
# stripe
log_must zpool create $TESTPOOL $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# stripe + hotspare
log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
verify_bootfs $TESTPOOL
else
## the following configurations are not supported as bootable pools
# stripe + hotspare
log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
# stripe
log_must zpool create $TESTPOOL $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
# stripe + hotspare
log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
fi
# raidz
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2
verify_no_bootfs $TESTPOOL
verify_bootfs $TESTPOOL
# raidz + hotspare
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3
verify_no_bootfs $TESTPOOL
verify_bootfs $TESTPOOL
# raidz2
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3
verify_no_bootfs $TESTPOOL
verify_bootfs $TESTPOOL
# raidz2 + hotspare
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4
verify_no_bootfs $TESTPOOL
verify_bootfs $TESTPOOL
log_pass "Pools of correct vdev types accept boot property"

View File

@ -1,71 +0,0 @@
#!/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) 2013, 2016 by Delphix. All rights reserved.
#
. $STF_SUITE/include/libtest.shlib
#
# DESCRIPTION:
#
# Setting bootfs on a pool which was configured with the whole disk
# (i.e. EFI) will fail
#
# STRATEGY:
# 1. create a pool with a whole disk
# 2. create a filesystem on this pool
# 3. verify we can not set bootfs on the filesystem we just created.
#
verify_runnable "global"
function cleanup {
if poolexists $TESTPOOL ; then
destroy_pool "$TESTPOOL"
fi
}
log_onexit cleanup
DISK=${DISKS%% *}
typeset EFI_BOOTFS=$TESTPOOL/efs
typeset assert_mesg="setting bootfs on a pool which was configured with the \
whole disk will fail"
log_assert $assert_mesg
create_pool "$TESTPOOL" "$DISK"
log_must zfs create $EFI_BOOTFS
if is_linux; then
log_must zpool set bootfs=$EFI_BOOTFS $TESTPOOL
else
log_mustnot zpool set bootfs=$EFI_BOOTFS $TESTPOOL
fi
log_pass $assert_mesg

View File

View File

@ -34,13 +34,13 @@
#
# DESCRIPTION:
#
# setting bootfs on a dataset which has gzip compression enabled will fail
# setting bootfs on a dataset which has gzip compression enabled will not fail
#
# STRATEGY:
# 1. create pools based on a valid vdev
# 2. create a filesystem on this pool and set the compression property to gzip1-9
# 2. create a filesystem on this pool, set the compression property to gzip1-9
# 3. set the pool's bootfs property to filesystem we just configured which
# should fail
# should not fail
#
verify_runnable "global"
@ -56,9 +56,9 @@ function cleanup {
}
typeset assert_msg="setting bootfs on a dataset which has gzip \
compression enabled will fail"
compression enabled will not fail"
typeset VDEV=$TESTDIR/bootfs_008_neg_a.$$.dat
typeset VDEV=$TEST_BASE_DIR/bootfs_008_pos_a.$$.dat
typeset COMP_FS=$TESTPOOL/COMP_FS
log_onexit cleanup
@ -74,7 +74,7 @@ set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
while (( i < ${#gtype[@]} )); do
log_must zfs set compression=${gtype[i]} $COMP_FS
log_mustnot zpool set bootfs=$COMP_FS $TESTPOOL
log_must zpool set bootfs=$COMP_FS $TESTPOOL
log_must zfs set compression=off $COMP_FS
(( i += 1 ))
done

View File

@ -4,4 +4,4 @@ dist_pkgdata_SCRIPTS = \
cleanup.ksh \
rootpool_002_neg.ksh \
rootpool_003_neg.ksh \
rootpool_007_neg.ksh
rootpool_007_pos.ksh

View File

@ -34,12 +34,12 @@
#
# DESCRIPTION:
#
# the zfs rootfilesystem's compression property can not set to gzip[1-9]
# the zfs rootfilesystem's compression property can be set to gzip[1-9]
#
# STRATEGY:
# 1) check if the current system is installed as zfs root
# 2) get the rootfs
# 3) set the rootfs's compression to gzip 1-9 which should fail.
# 3) set the rootfs's compression to gzip 1-9 which should not fail.
#
verify_runnable "global"
@ -55,7 +55,7 @@ typeset rootpool=$(get_rootpool)
typeset rootfs=$(get_pool_prop bootfs $rootpool)
typeset orig_compress=$(get_prop compression $rootfs)
typeset assert_msg="the zfs rootfs's compression property can not set to \
typeset assert_msg="the zfs rootfs's compression property can be set to \
gzip and gzip[1-9]"
set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
@ -63,7 +63,7 @@ set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
typeset -i i=0
while (( i < ${#gtype[@]} )); do
log_mustnot zfs set compression=${gtype[i]} $rootfs
log_must zfs set compression=${gtype[i]} $rootfs
(( i += 1 ))
done

View File

@ -32,3 +32,11 @@
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
#
# This functionality is supported under Linux, but these test cases
# are disabled by default since they manipulate the systems root pool.
#
if is_linux; then
log_unsupported "Supported but disabled by default"
fi