From owner-freebsd-fs@FreeBSD.ORG Wed Jan 12 01:52:09 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0277A106564A; Wed, 12 Jan 2011 01:52:09 +0000 (UTC) (envelope-from stef@memberwebs.com) Received: from thewalter.net (thewalter.net [94.75.203.97]) by mx1.freebsd.org (Postfix) with ESMTP id BB5608FC17; Wed, 12 Jan 2011 01:52:08 +0000 (UTC) Received: from [172.17.182.217] (adsl-75-12-188-41.dsl.pltn13.sbcglobal.net [75.12.188.41]) by thewalter.net (Postfix) with ESMTPA id 358823660A; Wed, 12 Jan 2011 01:52:05 +0000 (UTC) Message-ID: <4D2D0941.40002@memberwebs.com> Date: Tue, 11 Jan 2011 17:52:01 -0800 From: Stef Walter User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <4D2B8616.4000503@memberwebs.com> <4D2B89C4.8080300@memberwebs.com> <20110111214619.GF1812@garage.freebsd.pl> In-Reply-To: <20110111214619.GF1812@garage.freebsd.pl> Content-Type: multipart/mixed; boundary="------------060706040903030701070909" Cc: freebsd-fs@freebsd.org Subject: Re: 'zfs list' does abort in make_dataset_handle X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2011 01:52:09 -0000 This is a multi-part message in MIME format. --------------060706040903030701070909 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 01/11/2011 01:46 PM, Pawel Jakub Dawidek wrote: > On Mon, Jan 10, 2011 at 02:35:48PM -0800, Stef Walter wrote: >> On 01/10/2011 02:20 PM, Stef Walter wrote: >>> After a failed zfs receive, zfs list now aborts in make_dataset_handle() >>> in libzfs.so.2. >> >> The following patch suppresses the problem, and may give a clear >> indication of how the problem manifests. > > I'd more threat such situation as if dds_inconsistent would be true and > destroy/rollback offending dataset. Could you try something like that? Sounds like a good plan. Attached is a patch which does that. Cheers, Stef --------------060706040903030701070909 Content-Type: text/x-patch; name="zfs-data-set-bad-head-type-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="zfs-data-set-bad-head-type-2.patch" --- 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); --------------060706040903030701070909--