Bug 160283

Summary: [zfs] [patch] 'zfs list' does abort in make_dataset_handle
Product: Base System Reporter: Stef Walter <stef>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 8.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Stef Walter 2011-08-29 17:00:24 UTC
After a failed zfs receive, zfs list now aborts in make_dataset_handle()
in libzfs.so.2.

# zfs list
Abort trap: 6 (core dumped)

The backtrace is:

#0  0x0000000800fe63cc in kill () from /lib/libc.so.7
#1  0x0000000800fe51cb in abort () from /lib/libc.so.7
#2  0x000000080067400f in make_dataset_handle () from /lib/libzfs.so.2
#3  0x0000000800674346 in zfs_iter_filesystems () from /lib/libzfs.so.2
#4  0x000000000040ad51 in ?? ()
#5  0x0000000800674354 in zfs_iter_filesystems () from /lib/libzfs.so.2
#6  0x000000000040ad51 in ?? ()
#7  0x000000080066642c in zfs_iter_root () from /lib/libzfs.so.2

Running on:

FreeBSD m1.bay.npubs.net 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Wed Jul 27 12:49:35 UTC 2011     sam@m1.bay.npubs.net:/usr/obj/usr/src/sys/RACK1  amd64

'zfs scrub' did not fix the error. 'zfs create' and other zfs commands
still work, as do access to the various zfs file systems on this system.

After poking around a bit, I find that in make_dataset_handle()
zhp->zfs_dmustats.dds_type is equal to 0 (and this is the cause of the
abort). Additionally zhp->zfs_dmustats.dds_inconsistent is not TRUE.

Fix: Will attach a patch which fixes the issue.

Patch attached with submission follows:
How-To-Repeat: Hard to repeat. Depends on zfs recv aborting at specific times in specific circumstances, possibly involving prior reboots.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-08-30 03:09:45 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:38 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:35:30 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>