Created
December 5, 2016 22:55
-
-
Save loli10K/3828245287eb6405bfc661c17a458166 to your computer and use it in GitHub Desktop.
ZFS: test property restore on error in zfs_ioc_recv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# setup | |
export POOLNAME='testpool' | |
export TMPDIR='/var/tmp' | |
mountpoint -q $TMPDIR || mount -t tmpfs tmpfs $TMPDIR | |
zpool destroy $POOLNAME | |
fallocate -l 65m $TMPDIR/zpool.dat | |
zpool create $POOLNAME $TMPDIR/zpool.dat | |
zfs create $POOLNAME/send | |
zfs set compression=on $POOLNAME/send | |
zfs snap -r $POOLNAME/send@snap1 | |
zfs send -R $POOLNAME/send@snap1 > $TMPDIR/snap_full.dat | |
zfs recv $POOLNAME/recv < $TMPDIR/snap_full.dat | |
# | |
# received compression is 'on' | |
zfs get -r -o all compression $POOLNAME/recv | |
zfs snap -r $POOLNAME/send@snap2 | |
zfs snap -r $POOLNAME/send@snap3 | |
zfs set compression=gzip-2 $POOLNAME/send | |
zfs send -RI $POOLNAME/send@snap1 $POOLNAME/send@snap2 > $TMPDIR/snap_incr1.dat | |
zfs set compression=gzip-3 $POOLNAME/send | |
zfs send -RI $POOLNAME/send@snap2 $POOLNAME/send@snap3 > $TMPDIR/snap_incr2.dat | |
# | |
# now receive incrementals | |
zfs recv -F $POOLNAME/recv < $TMPDIR/snap_incr1.dat | |
# | |
# received compression is 'gzip-2' | |
zfs get -r -o all compression $POOLNAME/recv | |
# | |
# inject err in zfs_ioc_recv_impl(), fail to receive incr with compression='gzip-3' | |
stap \ | |
-d kernel -d zfs -d spl \ | |
-g \ | |
-c bash -c "zfs recv -F $POOLNAME/recv < $TMPDIR/snap_incr2.dat" \ | |
<(echo ' | |
#!/usr/bin/env stap | |
probe module("zfs").function("zfs_ioc_recv_impl").call | |
{ | |
printf(" --> %s\n", probefunc()); | |
$zfs_ioc_recv_inject_err = 1; | |
} | |
') | |
# zfs receive failed, compression should be 'gzip-2' ... right? | |
zfs get -r -o all compression $POOLNAME/recv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment