From owner-freebsd-bugs@freebsd.org Sat May 14 21:52:35 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EA7BB3B3AE for ; Sat, 14 May 2016 21:52:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80F1A1C80 for ; Sat, 14 May 2016 21:52:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u4ELqZAo084102 for ; Sat, 14 May 2016 21:52:35 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 209508] zfs import assertion failed in avl_add() Date: Sat, 14 May 2016 21:52:35 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: natmanz@shaw.ca X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2016 21:52:35 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209508 Bug ID: 209508 Summary: zfs import assertion failed in avl_add() Product: Base System Version: 10.3-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: natmanz@shaw.ca Created attachment 170292 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D170292&action= =3Dedit Proposed patch to libzfs_import.c SUMMARY: Starting with 10.3-RELEASE, running "zpool import" or "zpool import name" crashes with: Assertion failed: (avl_find() succeeded inside avl_add()), file /usr/src/cddl/lib/libavl/../../../sys/cddl/contrib/opensolaris/common/avl/a= vl.c, line 649. Previously when running 10.2-RELEASE this did not happen. ENVIRONMENT: This system is running 10.3-RELEASE in a Xen domU. There are 4 disks attac= hed at boot time, ada0-3. These have GPT partitions, the largest of which is a= dded to a zfs pool. I also have two removable disks at that I add to the domU at runtime from t= he host, but the problem above occurs with just ada0-3 present ("zfs import" l= eads to the assertion failed instead of showing no pools), so I don't believe the removable disks are related. However, adding and removing the disks is the reason that I'm using zpool import. ANALYSIS: I believe the problem is in cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Around line 1225, it appears that the code is listing all of the geom provi= ders and adding them to the slice_cache avl tree. Placing some printfs in that code, I can see that it is trying to add ada0* twice: ... Adding geom to avl ada0p1 Adding geom to avl ada0p2 Adding geom to avl ada0p3 Already have geom in avl ada0p1 Already have geom in avl ada0p2 Already have geom in avl ada0p3 ... Adding geom to avl ada0 Already have geom in avl ada0 ... In svn, it looks like the assertion was added in base r287703 that prevents adding duplicate entries to the avl. I then modified libzfs_import.c to call avl_find() before trying to call avl_add: avl_index_t where; if (avl_find(&slice_cache, slice, &where) =3D=3D NULL) { avl_add(&slice_cache, slice); } (and the same lower down around line 1260) This allows the "zfs import" to list any available pools, and "zfs import n= ame" to import the pool successfully. I'm new to FreeBSD so I'm not sure if this the correct solution but it work= s in my case. A patch is attached. --=20 You are receiving this mail because: You are the assignee for the bug.=