From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 29 16:00:25 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 200FB1065678 for ; Mon, 29 Aug 2011 16:00:25 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E24228FC1D for ; Mon, 29 Aug 2011 16:00:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TG0ONq060699 for ; Mon, 29 Aug 2011 16:00:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7TG0OeF060698; Mon, 29 Aug 2011 16:00:24 GMT (envelope-from gnats) Resent-Date: Mon, 29 Aug 2011 16:00:24 GMT Resent-Message-Id: <201108291600.p7TG0OeF060698@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stef Walter Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC0E31065673 for ; Mon, 29 Aug 2011 15:58:23 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id DBE948FC13 for ; Mon, 29 Aug 2011 15:58:23 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7TFwNdQ095434 for ; Mon, 29 Aug 2011 15:58:23 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p7TFwNpu095433; Mon, 29 Aug 2011 15:58:23 GMT (envelope-from nobody) Message-Id: <201108291558.p7TFwNpu095433@red.freebsd.org> Date: Mon, 29 Aug 2011 15:58:23 GMT From: Stef Walter To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/160283: 'zfs list' does abort in make_dataset_handle X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2011 16:00:25 -0000 >Number: 160283 >Category: kern >Synopsis: 'zfs list' does abort in make_dataset_handle >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 29 16:00:24 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Stef Walter >Release: 8.2-RELEASE-p2 >Organization: >Environment: 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 >Description: 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. >How-To-Repeat: Hard to repeat. Depends on zfs recv aborting at specific times in specific circumstances, possibly involving prior reboots. >Fix: Will attach a patch which fixes the issue. Patch attached with submission follows: --- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c.orig 2011-01-10 22:29:45.000000000 +0000 +++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c 2011-01-12 01:49:13.000000000 +0000 @@ -404,4 +404,24 @@ } + /* + * We've managed to open the dataset and gather statistics. Determine + * the high-level type. + */ + if (zhp->zfs_dmustats.dds_type == DMU_OST_ZVOL) + zhp->zfs_head_type = ZFS_TYPE_VOLUME; + else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS) + zhp->zfs_head_type = ZFS_TYPE_FILESYSTEM; + else + zhp->zfs_dmustats.dds_inconsistent = 1; + + if (zhp->zfs_dmustats.dds_is_snapshot) + zhp->zfs_type = ZFS_TYPE_SNAPSHOT; + else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZVOL) + zhp->zfs_type = ZFS_TYPE_VOLUME; + else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS) + zhp->zfs_type = ZFS_TYPE_FILESYSTEM; + else + zhp->zfs_dmustats.dds_inconsistent = 1; + if (zhp->zfs_dmustats.dds_inconsistent) { zfs_cmd_t zc = { 0 }; @@ -446,24 +466,4 @@ } - /* - * We've managed to open the dataset and gather statistics. Determine - * the high-level type. - */ - if (zhp->zfs_dmustats.dds_type == DMU_OST_ZVOL) - zhp->zfs_head_type = ZFS_TYPE_VOLUME; - else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS) - zhp->zfs_head_type = ZFS_TYPE_FILESYSTEM; - else - abort(); - - if (zhp->zfs_dmustats.dds_is_snapshot) - zhp->zfs_type = ZFS_TYPE_SNAPSHOT; - else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZVOL) - zhp->zfs_type = ZFS_TYPE_VOLUME; - else if (zhp->zfs_dmustats.dds_type == DMU_OST_ZFS) - zhp->zfs_type = ZFS_TYPE_FILESYSTEM; - else - abort(); /* we should never see any other types */ - zhp->zfs_hdl->libzfs_log_str = logstr; zhp->zpool_hdl = zpool_handle(zhp); >Release-Note: >Audit-Trail: >Unformatted: