Skip to content
Permalink
Browse files

Develop tests for issues #5866 and #8858

Provide zfstest coverage for these two issues which
were a panic accessing extended attributes and
a problem comparing 64 bit and 32 bit generation
numbers.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
  • Loading branch information...
PaulZ-98 committed Sep 24, 2019
1 parent 7238cbd commit b048293fe3451524ef2a83a4cc6f78e5b0b5148c
@@ -194,6 +194,7 @@ AC_CONFIG_FILES([
tests/zfs-tests/cmd/mmap_libaio/Makefile
tests/zfs-tests/cmd/mmapwrite/Makefile
tests/zfs-tests/cmd/nvlist_to_lua/Makefile
tests/zfs-tests/cmd/online_recv/Makefile
tests/zfs-tests/cmd/randfree_file/Makefile
tests/zfs-tests/cmd/randwritecomp/Makefile
tests/zfs-tests/cmd/readmmap/Makefile
@@ -354,6 +355,7 @@ AC_CONFIG_FILES([
tests/zfs-tests/tests/functional/vdev_zaps/Makefile
tests/zfs-tests/tests/functional/write_dirs/Makefile
tests/zfs-tests/tests/functional/xattr/Makefile
tests/zfs-tests/tests/functional/xattr/blockfiles/Makefile
tests/zfs-tests/tests/functional/zvol/Makefile
tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile
tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile
@@ -914,7 +914,7 @@ tags = ['functional', 'write_dirs']
tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos',
'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg', 'xattr_008_pos',
'xattr_009_neg', 'xattr_010_neg', 'xattr_011_pos', 'xattr_012_pos',
'xattr_013_pos']
'xattr_013_pos', 'xattr_zfs_zreget']
tags = ['functional', 'xattr']

[tests/functional/zvol/zvol_ENOSPC]
@@ -19,6 +19,7 @@ SUBDIRS = \
mmap_libaio \
mmapwrite \
nvlist_to_lua \
online_recv \
randfree_file \
randwritecomp \
readmmap \
@@ -0,0 +1 @@
/online_recv
@@ -0,0 +1,15 @@
include $(top_srcdir)/config/Rules.am

pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin

DEFAULT_INCLUDES += \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/libspl/include

pkgexec_PROGRAMS = online_recv

online_recv_SOURCES = online_recv.c
online_recv_LDADD = \
$(top_builddir)/lib/libspl/libspl.la \
$(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libzfs_core/libzfs_core.la
@@ -0,0 +1,52 @@
/*
* CDDL HEADER START
*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2019 by Datto, Inc. All rights reserved.
*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <libzfs_core.h>

int zfs_fd;

/*
* Use libzfs_core to do a "zfs receive". This allows us to
* bypass certain checks in the zfs command utility and
* perform an online receive into an existing filesystem for
* testing purposes.
*/
int
main(int argc, const char *argv[])
{
int err = 0;

if (argc < 2) {
fprintf(stderr, "usage: online_recv <destination>\n");
exit(2);
}

(void) libzfs_core_init();

err = lzc_receive(argv[1], NULL, NULL, B_TRUE, B_FALSE, 0);

libzfs_core_fini();

return (err);
}
@@ -175,6 +175,7 @@ export ZFSTEST_FILES='chg_usr_exec
mmap_libaio
mmapwrite
nvlist_to_lua
online_recv
randfree_file
randwritecomp
readmmap
@@ -1,3 +1,5 @@
SUBDIRS = blockfiles

pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/xattr
dist_pkgdata_SCRIPTS = \
setup.ksh \
@@ -14,7 +16,8 @@ dist_pkgdata_SCRIPTS = \
xattr_010_neg.ksh \
xattr_011_pos.ksh \
xattr_012_pos.ksh \
xattr_013_pos.ksh
xattr_013_pos.ksh \
xattr_zfs_zreget.ksh

dist_pkgdata_DATA = \
xattr_common.kshlib \
@@ -0,0 +1,3 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/xattr/blockfiles
dist_pkgdata_DATA = \
zfs-txg-number.dat.bz2
Binary file not shown.
@@ -0,0 +1,78 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#

#
# Copyright (c) 2019 Datto, Inc. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
# DESCRIPTION:
# See ZoL issues #5866 and #8858. This test will ensure the fixes for
# these specific issues have no regression.
#
# Exercise the functions zfs_suspend_fs / zfs_resume_fs / zfs_rezget.
# The test will ensure that we reach zfs code that compares file
# generation numbers and fetches extended attributes.
#
# STRATEGY:
# 1. Import a pool that has txg number > 2^32.
# 2. Take snapshot and do send with an online receive.
# 3. EIO is expected when accessing the received file-system.
# 4. Access extended attribute. (previously this would panic)
# 5. Take second snapshot, write some data.
# 6. Rollback.
# 7. Access the resulting file-system. (previously every accesss would give EIO)
#

verify_runnable "global"

function cleanup
{
log_must zpool destroy -f txg-number-pool
log_must rm $TEST_BASE_DIR/zfs-txg-number.dat
}


log_assert "zfs can handle suspend/resume with large generation number"

log_onexit cleanup

log_must bzcat \
$STF_SUITE/tests/functional/xattr/blockfiles/zfs-txg-number.dat.bz2 \
>$TEST_BASE_DIR/zfs-txg-number.dat

log_must zpool import txg-number-pool -d $TEST_BASE_DIR

log_must zfs create txg-number-pool/fs1
log_must zfs snapshot txg-number-pool/fs1@snap1
log_must zfs create txg-number-pool/fs2

log_must eval "zfs send txg-number-pool/fs1@snap1 |
online_recv txg-number-pool/fs2@snap1"

log_mustnot stat /txg-number-pool/fs2
log_mustnot attr -l /txg-number-pool/fs2

log_must zfs snapshot txg-number-pool/fs1@snap2
log_must fill_fs /txg-number-pool/fs1 2 2 1024 1 R
log_must sync
log_must zfs rollback txg-number-pool/fs1@snap2

log_must stat /txg-number-pool/fs1

log_pass "suspend/resume works with large generation number"

0 comments on commit b048293

Please sign in to comment.
You can’t perform that action at this time.