Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2011 17:52:01 -0800
From:      Stef Walter <stef@memberwebs.com>
To:        Pawel Jakub Dawidek <pjd@FreeBSD.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: 'zfs list' does abort in make_dataset_handle
Message-ID:  <4D2D0941.40002@memberwebs.com>
In-Reply-To: <20110111214619.GF1812@garage.freebsd.pl>
References:  <4D2B8616.4000503@memberwebs.com> <4D2B89C4.8080300@memberwebs.com> <20110111214619.GF1812@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D2D0941.40002>