Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenZFS 7252 - create long versions of ZFS send / receive options #5951

Closed
wants to merge 3 commits into from
Closed

OpenZFS 7252 - create long versions of ZFS send / receive options #5951

wants to merge 3 commits into from

Conversation

bunder2015
Copy link
Contributor

@bunder2015 bunder2015 commented Mar 31, 2017

Authored by: Dan Kimmel [email protected]
Reviewed by: George Wilson [email protected]
Reviewed by: John Kennedy [email protected]
Reviewed by: Matthew Ahrens [email protected]
Reviewed by: Paul Dagnelie [email protected]
Reviewed by: Pavel Zakharov [email protected]
Reviewed by: Sebastien Roy [email protected]
Reviewed by: David Quigley [email protected]
Reviewed by: Thomas Caputi [email protected]
Approved by: Dan McDonald [email protected]
Ported by: bunder2015 [email protected]

Porting over some remaining changes from OpenZFS commit 5602294

OpenZFS-issue: https://www.illumos.org/issues/7628
OpenZFS-commit: openzfs/openzfs@5602294

Motivation and Context

Thought this would be an easy first attempt at porting, found it on the tracking page.

How Has This Been Tested?

Please be kind to me buildbots and reviewers. 😃
edit: I'll try to get a personal build box VM going this week, sorry for the buildbot noise.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

@mention-bot
Copy link

@bunder2015, thanks for your PR! By analyzing the history of the files in this pull request, we identified @behlendorf, @rlaager and @ahrens to be potential reviewers.

Copy link
Contributor

@dinatale2 dinatale2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bunder2015 Thank you for submitting this!

Commit messages for OpenZFS patch ports should have a subject line that starts with OpenZFS <issue #> - . Also, you need a - in your Ported-by: line. You can refer to the OpenZFS Patch Port section of the contributing guidelines for an example.

Edit: Looks like you corrected your Ported-by: as I was typing the above. :)

@bunder2015
Copy link
Contributor Author

Okay I think I got it right this time... but something seems off with that new formatting checker...

error: missing "Ported-by" error: missing "Ported-by"

It's there... but what is also odd, is it's saying that twice.

@bunder2015 bunder2015 changed the title 7628 create long versions of ZFS send / receive... OpenZFS 7628 - create long versions of ZFS send / receive options Apr 1, 2017
@dinatale2
Copy link
Contributor

@bunder2015 I noticed that. I'm looking into it. Thanks for the heads up.

@dinatale2
Copy link
Contributor

@bunder2015 The issues you were seeing should be corrected once #5952 lands. Sorry for the trouble!

@bunder2015
Copy link
Contributor Author

Looks like I missed some illumos-isms in the test scripts. I'll try to get these cleaned up.

known=${feature[$flag]}
[[ -z $known ]] && log_fail "Unknown feature: $flag"

derived=$($ECHO "$flags & ${feature[$flag]} = X" | mdb | $SED 's/ //g')
Copy link
Contributor Author

@bunder2015 bunder2015 Apr 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need a replacement for mdb, I tried using ksh directly but it doesn't provide the intended output.

log_must $ZFS create -o compress=lz4 $recvfs
typeset dir=$(get_prop mountpoint $sendfs)
# Don't use write_compressible: we want compressible but undedupable data here.
log_must $CP /kernel/genunix $dir/file
Copy link
Contributor Author

@bunder2015 bunder2015 Apr 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any recommendations for a replacement file to use that's available our Linux buildbots?

Copy link
Contributor Author

@bunder2015 bunder2015 Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been trying to think of a file that would be on every buildbot and that has a reasonable size, would something like awk, grep, mv, ls, tar, ps be large enough for this? Most of these are over 100kb in size. If we need bigger, ksh and git are around 2mb in size. (genunix is 3mb)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkfile may be useful to make a file in the size you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if mkfile puts any content in the file, or if its just an empty file? I imagine that would have the same problem as write_compressible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it may make a file full of 0s. Another option may be to use dd and with your input stream being /dev/urandom or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, urandom doesn't compress.

Compressed 4194304 bytes into 4194323 bytes ==> 100.00%

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use write_file which will write a single non-zero compressible pattern.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun fact, if you pass R to file_write's -d option, it will write psudorandom data:

./tests/zfs-tests/cmd/file_write/file_write -o overwrite -f randomdata.dat -d R

# For lz4, this method works for blocks up to 16k, but not larger
[[ $recsize -eq $((32 * 1024)) ]] && break

log_must mkholes -h 0:$((recsize - 8)) -d $((recsize - 8)):8 \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're also missing mkholes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkholes is part of the test suite. see usr/src/test/zfs-tests/cmd/mkholes on illumos

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it, thanks!

fl.l_whence = SEEK_SET;
fl.l_start = off;
fl.l_len = len;
if (fcntl(fd, F_FREESP, &fl) != 0) {
Copy link
Contributor Author

@bunder2015 bunder2015 Apr 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to find a Linux alternative for F_FREESP. Would FALLOC_FL_PUNCH_HOLE be sufficient?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallocate with the FALLOC_FL_PUNCH_HOLE mode might work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/zfs-tests/cmd/randfree_file/randfree_file.c has an example of using fallocate.

@dinatale2
Copy link
Contributor

@bunder2015 #5952 landed in master. If you rebase, the STYLE builder should begin to pass its style checking.

@bunder2015
Copy link
Contributor Author

Thanks.

Looks like we're down to 3 problems in the test scripts, fio is saying it needs --size, something to do with loop devices on some zpool creates, and a missing include to get within_percent to work. I'm not 100% on the loop devices but I think I got the other two working.

@behlendorf
Copy link
Contributor

@bunder2015 my expectation is that #5903 will get merged some time this week. At which point you won't need to make any of the zfs -> $ZFS changes in the test suite.

@bunder2015
Copy link
Contributor Author

@dinatale2 might want to check #5952 again, now it says I didn't sign off for a port. 😆

@dinatale2
Copy link
Contributor

dinatale2 commented Apr 4, 2017

@bunder2015 It looks like you merged master into your branch. So the buildbot is testing the commit with the message Merge branch 'master' into illumos-7628. That's why you are seeing the STYLE builder fail.

What you want to do is roll back to your previous commit (the one that has a commit message of OpenZFS 7628 - create long versions of ZFS..., it has a hash of 430ddc6). Then you'll want to do a git rebase onto master.

@bunder2015
Copy link
Contributor Author

bunder2015 commented Apr 4, 2017

Thanks, I think I got that sorted out.

Looked over the last set of logs and found a few things...
02:26:04.01 falloc_fl_punch_hole failed: Operation not supported
Unfortunately, that's not going to work it seems.

02:26:03.33 NOTE: Comparing 40960 and 28160 given 90% (calculated: 68.75%)
file_write doesn't seem compressible enough either.
typo, fixed

Missing loop/vdev stuff should be fixed. Need to look at fio again, doesn't look like its putting its files in the right places.

I'm gonna set up a personal buildbot VM in the morning to keep the noise down.

@behlendorf
Copy link
Contributor

@bunder2015 hole punching on Linux wasn't supported until the 2.6.38 kernel. My suggestion would be to update the test case to verify that FALLOC_FL_KEEP_SIZE works and if not skip the test case with log_unsupported. That way we still get good test coverage on the relevant distributions.

@loli10K
Copy link
Contributor

loli10K commented Apr 5, 2017

falloc_fl_punch_hole failed: Operation not supported

Shouldn't we call

fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, ...

instead of

fallocate(fd, FALLOC_FL_PUNCH_HOLE, ...

to punch holes? It seems that's what fallocate(1) with --punch-hole does.

fallocate:

(gdb) file ./fallocate 
Reading symbols from ./fallocate...done.
(gdb) b fallocate
Breakpoint 1 at 0x401170
(gdb) run --punch-hole -o 256 -l 256 /testpool/fs/urandom 
Starting program: /root/util-linux-2.25.2/fallocate --punch-hole -o 256 -l 256 /testpool/fs/urandom

Breakpoint 1, fallocate (fd=3, mode=3, offset=256, len=140737488349216) at ../sysdeps/unix/sysv/linux/wordsize-64/fallocate.c:28
28	../sysdeps/unix/sysv/linux/wordsize-64/fallocate.c: No such file or directory.

mkholes:

(gdb) file ./bin/mkholes
Reading symbols from ./bin/mkholes...done.
(gdb) b fallocate
Function "fallocate" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (fallocate) pending.
(gdb) run -h 256:256 /testpool/fs/urandom
Starting program: /usr/share/zfs/zfs-tests/bin/mkholes -h 256:256 /testpool/fs/urandom
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, fallocate (fd=fd@entry=3, mode=mode@entry=2, offset=offset@entry=256, len=140737488349424) at ../sysdeps/unix/sysv/linux/wordsize-64/fallocate.c:28
28	../sysdeps/unix/sysv/linux/wordsize-64/fallocate.c: No such file or directory.
(gdb) p mode
$1 = 2

It also seems our zpl_fallocate_common() doesn't like FALLOC_FL_PUNCH_HOLE without FALLOC_FL_KEEP_SIZE, https://github.com/zfsonlinux/zfs/blob/zfs-0.7.0-rc3/module/zfs/zpl_file.c#L659:

   649  zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len)
   650  {
   651          int error = -EOPNOTSUPP;
   652  
   653  #if defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE)
   654          cred_t *cr = CRED();
   655          flock64_t bf;
   656          loff_t olen;
   657          fstrans_cookie_t cookie;
   658  
   659          if (mode != (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
   660                  return (error);
   661  

and the VFS too, http://lxr.free-electrons.com/source/fs/open.c?v=4.6#L244:

244         /* Punch hole must have keep size set */
245         if ((mode & FALLOC_FL_PUNCH_HOLE) &&
246             !(mode & FALLOC_FL_KEEP_SIZE))
247                 return -EOPNOTSUPP;

@dinatale2
Copy link
Contributor

dinatale2 commented Apr 5, 2017

@loli10K @bunder2015 The man page also confirms the need to have FALLOC_FL_KEEP_SIZE

The  FALLOC_FL_PUNCH_HOLE flag must be ORed with FALLOC_FL_KEEP_SIZE in
mode; in other words, even when punching off the end of the  file,  the
file size (as reported by stat(2)) does not change.

@bunder2015
Copy link
Contributor Author

I'll take another look, thanks for the tips. Been busy since Monday, I'll try to get things updated tonight or tomorrow.

@bunder2015
Copy link
Contributor Author

bunder2015 commented Apr 6, 2017

Quick update, rebased on master, fixed fio, fixed file_write, and I think I fixed mkholes, although it got killed by the buildbot last night. Still need to update the embedded_blocks test to check for fallocate support.


buf = (char *)umem_alloc(readlen, UMEM_NOFAIL);
vbuf = (char *)umem_zalloc(readlen, UMEM_NOFAIL);
while (bytes_read < len) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, off, len) on an empty file won't extend it from off of len bytes because of FALLOC_FL_KEEP_SIZE: bytes_read will always be 0 and thus < len, this will cause an infinite loop here and is the reason the BB is hitting the 10m limit on send-c_embedded_blocks.

@behlendorf behlendorf changed the title OpenZFS 7628 - create long versions of ZFS send / receive options OpenZFS 7252 - create long versions of ZFS send / receive options Apr 6, 2017
module/zfs/lz4.c Outdated
@@ -87,7 +87,7 @@ lz4_decompress_zfs(void *s_start, void *d_start, size_t s_len,

/*
* Returns 0 on success (decompression function returned non-negative)
* and non-zero on failure (decompression function returned negative.
* and non-zero on failure (decompression function returned negative.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the . should be after the parenthesis, not before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks.

PS: I got my buildbot running, so I'm hoping to have some of the last few bugs ironed out soon.

shift

[[ -f $file ]] || log_fail "Couldn't find file: $file"
typeset flags=$(cat $file | zstreamdump | awk '/features =/ {print $3}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you disabled "send-cpL_varied_recsize" because you're getting "arithmetic syntax error" from ksh.

This seems to happen when we have multiple BEGIN records and the flags variable becomes a multiline string:

root@debian-8-zfs:~# zfs create $POOLNAME/fs
root@debian-8-zfs:~# zfs create $POOLNAME/fs/sub1
root@debian-8-zfs:~# zfs create $POOLNAME/fs/sub2
root@debian-8-zfs:~# zfs snap -r $POOLNAME/fs@snap1
root@debian-8-zfs:~# zfs send -cpLRDe $POOLNAME/fs@snap1 > $TMPDIR/zstream.dat
root@debian-8-zfs:~# #
root@debian-8-zfs:~# cat $TMPDIR/zstream.dat | zstreamdump | awk '/features =/ {print $3}'
7
430007
430007
430007
root@debian-8-zfs:~# ksh
# flags='7
> 430007
> 430007
> 430007'
# 
# printf "%x" $((0x$flags & 0x430007))
ksh: 0x7
430007
430007
430007 & 0x430007: arithmetic syntax error
# 

mdb seems to consider only the ending line:

[root@52-54-00-d3-7a-f3 ~]# echo -e "0\n0\n4 & 4 = X" | mdb
                4               
[root@52-54-00-d3-7a-f3 ~]# echo -e "0\n4\n0 & 4 = X" | mdb
                0               
[root@52-54-00-d3-7a-f3 ~]# echo -e "4\n0\n0 & 4 = X" | mdb
                0               
[root@52-54-00-d3-7a-f3 ~]# 

We should be able to "fix" the issue like this:

typeset flags=$(cat $file | zstreamdump | awk '/features =/ {features = $3} END {print features}')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was only intended to be temporary while I ironed out other test issues, but I'll give that a try, thanks.

@bunder2015
Copy link
Contributor Author

bunder2015 commented Apr 11, 2017

Ouch. send-cpL_varied_recsize gave me this during a zfs receive...

zfs recv testpool1.2852/1048576

[202038.186394] BUG: unable to handle kernel paging request at ffffc90003696000
[202038.186513] IP: [] dmu_write_impl+0x87/0xc1 [zfs]
[202038.186628] PGD 11f020067 PUD 11f021067 PMD b2268067 PTE 0
[202038.186712] Oops: 0000 [#1] SMP
[202038.186750] Modules linked in: zfs(PO) icp(PO) zcommon(PO) zunicode(PO) znvpair(PO) zavl(PO) splat(O) spl(O) video backlight [last unloaded: spl]
[202038.186990] CPU: 0 PID: 3689 Comm: receive_writer Tainted: P O 4.4.52-gentoo #4
[202038.187119] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[202038.187243] task: ffff880009db46c0 ti: ffff880019ae8000 task.ti: ffff880019ae8000
[202038.187354] RIP: 0010:[] [] dmu_write_impl+0x87/0xc1 [zfs]
[202038.187502] RSP: 0018:ffff880019aebcd8 EFLAGS: 00010286
[202038.187574] RAX: ffff880043400000 RBX: 0000000000020000 RCX: 000000000001f000
[202038.187679] RDX: ffffc9000633f000 RSI: ffffc90003696000 RDI: ffffc90006340000
[202038.187784] RBP: ffff880019aebd28 R08: ffffc90003695000 R09: ffffffffa05ac548
[202038.187889] R10: ffffffff815a1499 R11: 0000000000000001 R12: ffff8800b1e6c730
[202038.187994] R13: 0000000000000003 R14: 00000000000a0000 R15: 0000000000060000
[202038.188025] FS: 0000000000000000(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
[202038.188025] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[202038.188025] CR2: ffffc90003696000 CR3: 0000000081ec6000 CR4: 00000000000406f0
[202038.188191] Stack:
[202038.188520] ffffc90003695000 00000008a04bd8fe ffff88010475f380 0000000000000000
[202038.188943] ffff880070828c40 0000000000100000 0000000000000000 ffff8800a2290000
[202038.189389] 0000000000000007 ffff880019aebd50 ffff880019aebd80 ffffffffa04bda42
[202038.189792] Call Trace:
[202038.190122] [] dmu_write+0xa9/0xcb [zfs]
[202038.190510] [] dmu_assign_arcbuf+0x148/0x166 [zfs]
[202038.190883] [] receive_write+0x138/0x172 [zfs]
[202038.191245] [] ? receive_freeobjects.isra.12+0xa0/0xa0 [zfs]
[202038.191638] [] receive_writer_thread+0xbf/0x587 [zfs]
[202038.198073] [] ? receive_freeobjects.isra.12+0xa0/0xa0 [zfs]
[202038.198441] [] thread_generic_wrapper+0x69/0x73 [spl]
[202038.198795] [] ? __thread_exit+0x12/0x12 [spl]
[202038.199142] [] kthread+0xcd/0xd5
[202038.199471] [] ? kthread_create_on_node+0x16d/0x16d
[202038.199824] [] ret_from_fork+0x3f/0x70
[202038.200154] [] ? kthread_create_on_node+0x16d/0x16d
[202038.200518] Code: 49 0f 47 de 48 39 d3 75 07 e8 da b7 ff ff eb 05 e8 20 b5 ff ff 48 8b 55 c8 48 89 d9 49 03 54 24 18 4c 8b 45 b0 48 89 d7 4c 89 c6 a4 49 3b 5c 24 10 48 89 75 c8 75 0c 48 8b 75 d0 4c 89 e7 e8
[202038.201748] RIP [] dmu_write_impl+0x87/0xc1 [zfs]
[202038.202108] RSP
[202038.202407] CR2: ffffc90003696000
[202038.203409] ---[ end trace 62455ade86217e51 ]---

zstreamdump
BEGIN record
hdrtype = 1
features = 420004
magic = 2f5bacbac
creation_time = 58ed21e0
type = 2
flags = 0x4
toguid = a9a1ad90a565af79
fromguid = 0
toname = testpool.2852/1048576@snap
END checksum = 16891a04d8bd1b/7c6cf35bec827112/8e931705aee65950/343d624a836430af
SUMMARY:
Total DRR_BEGIN records = 1
Total DRR_END records = 1
Total DRR_OBJECT records = 7
Total DRR_FREEOBJECTS records = 4
Total DRR_WRITE records = 39
Total DRR_WRITE_BYREF records = 0
Total DRR_WRITE_EMBEDDED records = 0
Total DRR_FREE records = 13
Total DRR_SPILL records = 0
Total records = 65
Total write size = 11734528 (0xb30e00)
Total stream length = 11755144 (0xb35e88)

@loli10K
Copy link
Contributor

loli10K commented Apr 11, 2017

@bunder2015 that seems to be unrelated (well, at least not caused by) the code in this PR, i can reproduce the same issue with the very first commit that introduced compressed zfs send/receive 2aa3438. This also happens on Illumos.

More info from --enable-debug:

ZFS: Loaded module v0.7.0-rc1 (DEBUG mode), ZFS pool version 5000, ZFS filesystem version 5
SPL: using hostid 0x00000000
VERIFY3(arc_get_compression(buf) == ZIO_COMPRESS_OFF) failed (10 == 2)
PANIC at dmu.c:1378:dmu_assign_arcbuf()
Showing stack for process 1927
CPU: 1 PID: 1927 Comm: receive_writer Tainted: P           OE   4.6.4 #5
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 0000000000000286 000000007eeaa7a1 ffffffff8146a545 ffffffffc04668c1
 ffff8800d936bd70 ffffffffc01a19df 0000000000000007 ffffffff00000030
 ffff8800d936bd80 ffff8800d936bd20 2833594649524556 5f7465675f637261
Call Trace:
 [<ffffffff8146a545>] ? dump_stack+0x5c/0x77
 [<ffffffffc01a19df>] ? spl_panic+0xbf/0xf0 [spl]
 [<ffffffff818009b0>] ? __mutex_unlock_slowpath+0xd0/0x180
 [<ffffffff818009b0>] ? __mutex_unlock_slowpath+0xd0/0x180
 [<ffffffffc02cb693>] ? __dbuf_hold_impl+0x173/0xad0 [zfs]
 [<ffffffffc02d9261>] ? dmu_assign_arcbuf+0x121/0x250 [zfs]
 [<ffffffffc02e2c6d>] ? receive_write+0x14d/0x1d0 [zfs]
 [<ffffffffc02e4ae0>] ? receive_writer_thread+0x310/0x840 [zfs]
 [<ffffffff810b03c7>] ? dequeue_task_fair+0x57/0x8e0
 [<ffffffff810b4a7c>] ? pick_next_task_fair+0x10c/0x4a0
 [<ffffffff8102b76f>] ? __switch_to+0x26f/0x530
 [<ffffffff810a1f17>] ? set_user_nice+0x167/0x230
 [<ffffffffc02e47d0>] ? send_traverse_thread+0x140/0x140 [zfs]
 [<ffffffffc019d4ae>] ? thread_generic_wrapper+0x7e/0xc0 [spl]
 [<ffffffffc019d430>] ? __thread_exit+0x20/0x20 [spl]
 [<ffffffff81098ddf>] ? kthread+0xdf/0x100
 [<ffffffff81802eb2>] ? ret_from_fork+0x22/0x40
 [<ffffffff81098d00>] ? kthread_park+0x50/0x50

This needs more debugging. Let's keep send-cpL_varied_recsize disabled until someone figure this out.

@behlendorf
Copy link
Contributor

The failures hear are likely related to #6003 which @don-brady just opened a PR for.

@loli10K
Copy link
Contributor

loli10K commented Apr 12, 2017

I can still hit the same VERIFY running 5800a5b:

ZFS: Loaded module v0.7.0-rc3_193_g5800a5b (DEBUG mode), ZFS pool version 5000, ZFS filesystem version 5
SPL: using hostid 0x00000000
VERIFY3(arc_get_compression(buf) == ZIO_COMPRESS_OFF) failed (10 == 2)
PANIC at dmu.c:1495:dmu_assign_arcbuf()
Showing stack for process 2133
CPU: 1 PID: 2133 Comm: receive_writer Tainted: P           OE   4.6.4 #5
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 0000000000000286 000000004af464aa ffffffff8146a545 ffffffffc063e3b7
 ffff8800d3667d70 ffffffffc01b59df 0000000000000007 ffffffff00000030
 ffff8800d3667d80 ffff8800d3667d20 2833594649524556 5f7465675f637261
Call Trace:
 [<ffffffff8146a545>] ? dump_stack+0x5c/0x77
 [<ffffffffc01b59df>] ? spl_panic+0xbf/0xf0 [spl]
 [<ffffffff818009b0>] ? __mutex_unlock_slowpath+0xd0/0x180
 [<ffffffffc046c153>] ? __dbuf_hold_impl+0x173/0xad0 [zfs]
 [<ffffffffc0479b61>] ? dmu_assign_arcbuf+0x121/0x250 [zfs]
 [<ffffffffc04846cd>] ? receive_write+0x14d/0x1d0 [zfs]
 [<ffffffffc0486595>] ? receive_writer_thread+0x315/0x850 [zfs]
 [<ffffffff810b03c7>] ? dequeue_task_fair+0x57/0x8e0
 [<ffffffff810b4a7c>] ? pick_next_task_fair+0x10c/0x4a0
 [<ffffffff8102b76f>] ? __switch_to+0x26f/0x530
 [<ffffffff810a1f17>] ? set_user_nice+0x167/0x230
 [<ffffffffc0486280>] ? send_traverse_thread+0x150/0x150 [zfs]
 [<ffffffffc01b14ae>] ? thread_generic_wrapper+0x7e/0xc0 [spl]
 [<ffffffffc01b1430>] ? __thread_exit+0x20/0x20 [spl]
 [<ffffffff81098ddf>] ? kthread+0xdf/0x100
 [<ffffffff81802eb2>] ? ret_from_fork+0x22/0x40
 [<ffffffff81098d00>] ? kthread_park+0x50/0x50

Reproducer here: https://gist.github.com/loli10K/5dc583110136d1d4138706555ad1f8a5.

@behlendorf behlendorf added this to the 0.7.0 milestone Apr 12, 2017
@behlendorf
Copy link
Contributor

@loli10K @bunder2015 thanks for the reproducer! The issue is caused by an incorrect check in do_dump() regarding when to split large blocks. It looks like this was caused by a porting mistake in the original patch. I've added 34c27c9 to this PR which fixes the issue and does some minor updates to the do_dump() function to align it with the OpenZFS version.

@loli10K
Copy link
Contributor

loli10K commented Apr 12, 2017

@behlendorf nice, this seems to fix it from my limited testing. I thought this was an issue on the receiving side, the code seems to put a lot of trust (maybe too much) on the input data.

@behlendorf
Copy link
Contributor

@loli10K yes it does, the recv side could certainly benefit from some additional sanity checks and hardening.

@bunder2015
Copy link
Contributor Author

#6003 and 34c27c9 seem to work for me. thanks

@behlendorf
Copy link
Contributor

@bunder2015 feel free to remove the Requires-builders: none line from the commit and let the bots do their thing.

@bunder2015
Copy link
Contributor Author

I tried running it through the testbots, but without those 2 patches they all failed.

bunder2015 and others added 3 commits April 25, 2017 06:37
...nd / receive options

Authored by: Dan Kimmel <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: John Kennedy <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Reviewed by: Sebastien Roy <[email protected]>
Reviewed by: David Quigley <[email protected]>
Reviewed by: Thomas Caputi <[email protected]>
Approved by: Dan McDonald <[email protected]>
Ported-by: bunder2015 <[email protected]>

Porting over some remaining changes from OpenZFS commit 5602294

OpenZFS-issue: https://www.illumos.org/issues/7628
OpenZFS-commit: openzfs/openzfs@5602294
Resolve slight differences in the do_dump function between
Linux and OpenZFS.

Signed-off-by: Brian Behlendorf <[email protected]>
Authored by: Dan Kimmel <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: John Kennedy <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Reviewed by: Pavel Zakharov <[email protected]>
Reviewed by: Sebastien Roy <[email protected]>
Reviewed by: David Quigley <[email protected]>
Reviewed by: Thomas Caputi <[email protected]>
Approved by: Dan McDonald <[email protected]>

Ported-by: Don Brady <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/7252
OpenZFS-commit: openzfs/openzfs@5602294f

Porting Notes: most of 7252 was already picked up during ABD work.
This commit represents the gap from the final commit to openzfs.

Signed-off-by: Don Brady <[email protected]>
@behlendorf
Copy link
Contributor

Replaced by #6067. @bunder2015 I hope you don't mind but I've taken your work and @don-brady's from #6003 and used them as the basis for #6067. This updated PR is passing all the new tests after a few minor modifications to the test scripts. It would be great if you could review it.

@behlendorf behlendorf closed this Apr 25, 2017
@bunder2015 bunder2015 deleted the illumos-7628 branch April 25, 2017 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants