10774d909SNed Bass#!/bin/ksh -p
20774d909SNed Bass#
30774d909SNed Bass# CDDL HEADER START
40774d909SNed Bass#
50774d909SNed Bass# The contents of this file are subject to the terms of the
60774d909SNed Bass# Common Development and Distribution License (the "License").
70774d909SNed Bass# You may not use this file except in compliance with the License.
80774d909SNed Bass#
90774d909SNed Bass# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100774d909SNed Bass# or http://www.opensolaris.org/os/licensing.
110774d909SNed Bass# See the License for the specific language governing permissions
120774d909SNed Bass# and limitations under the License.
130774d909SNed Bass#
140774d909SNed Bass# When distributing Covered Code, include this CDDL HEADER in each
150774d909SNed Bass# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160774d909SNed Bass# If applicable, add the following below this CDDL HEADER, with the
170774d909SNed Bass# fields enclosed by brackets "[]" replaced with your own identifying
180774d909SNed Bass# information: Portions Copyright [yyyy] [name of copyright owner]
190774d909SNed Bass#
200774d909SNed Bass# CDDL HEADER END
210774d909SNed Bass#
220774d909SNed Bass
23*946342a2SFabian Grünbichler#
24*946342a2SFabian Grünbichler# Copyright (c) 2016 by Lawrence Livermore National Security, LLC.
25*946342a2SFabian Grünbichler# Use is subject to license terms.
26*946342a2SFabian Grünbichler#
27*946342a2SFabian Grünbichler
280774d909SNed Bass. $STF_SUITE/include/libtest.shlib
290774d909SNed Bass
300774d909SNed Bassverify_runnable "both"
310774d909SNed Bass
320774d909SNed BassTEST_SEND_FS=$TESTPOOL/send_large_dnode
330774d909SNed BassTEST_RECV_FS=$TESTPOOL/recv_large_dnode
340774d909SNed BassTEST_SNAP=$TEST_SEND_FS@ldnsnap
350774d909SNed BassTEST_SNAPINCR=$TEST_SEND_FS@ldnsnap_incr
360774d909SNed BassTEST_STREAM=$TESTDIR/ldnsnap
370774d909SNed BassTEST_STREAMINCR=$TESTDIR/ldnsnap_incr
380774d909SNed BassTEST_FILE=foo
390774d909SNed BassTEST_FILEINCR=bar
400774d909SNed Bass
410774d909SNed Bassfunction cleanup
420774d909SNed Bass{
430774d909SNed Bass	if datasetexists $TEST_SEND_FS ; then
440774d909SNed Bass		log_must zfs destroy -r $TEST_SEND_FS
450774d909SNed Bass	fi
460774d909SNed Bass
470774d909SNed Bass	if datasetexists $TEST_RECV_FS ; then
480774d909SNed Bass		log_must zfs destroy -r $TEST_RECV_FS
490774d909SNed Bass	fi
500774d909SNed Bass
510774d909SNed Bass	rm -f $TEST_STREAM
520774d909SNed Bass	rm -f $TEST_STREAMINCR
530774d909SNed Bass}
540774d909SNed Bass
550774d909SNed Basslog_onexit cleanup
560774d909SNed Bass
570774d909SNed Basslog_assert "zfs send stream with large dnodes accepted by new pool"
580774d909SNed Bass
590774d909SNed Basslog_must zfs create -o dnodesize=1k $TEST_SEND_FS
600774d909SNed Basslog_must touch /$TEST_SEND_FS/$TEST_FILE
610774d909SNed Basslog_must zfs snap $TEST_SNAP
620774d909SNed Basslog_must zfs send $TEST_SNAP > $TEST_STREAM
630774d909SNed Basslog_must rm -f /$TEST_SEND_FS/$TEST_FILE
640774d909SNed Basslog_must touch /$TEST_SEND_FS/$TEST_FILEINCR
650774d909SNed Basslog_must zfs snap $TEST_SNAPINCR
660774d909SNed Basslog_must zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR
670774d909SNed Bass
680774d909SNed Basslog_must eval "zfs recv $TEST_RECV_FS < $TEST_STREAM"
690774d909SNed Bassinode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}')
700774d909SNed Bassdnsize=$(zdb -dddd $TEST_RECV_FS $inode | awk '/ZFS plain file/ {print $6}')
710774d909SNed Bassif [[ "$dnsize" != "1K" ]]; then
720774d909SNed Bass	log_fail "dnode size is $dnsize (expected 1K)"
730774d909SNed Bassfi
740774d909SNed Bass
750774d909SNed Basslog_must eval "zfs recv -F $TEST_RECV_FS < $TEST_STREAMINCR"
760774d909SNed Basslog_must diff -r /$TEST_SEND_FS /$TEST_RECV_FS
770774d909SNed Basslog_must zfs umount $TEST_SEND_FS
780774d909SNed Basslog_must zfs umount $TEST_RECV_FS
790774d909SNed Bass
800774d909SNed Basslog_pass
81