From nobody@FreeBSD.org  Tue Nov  5 17:45:20 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 3B2F4616
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Nov 2013 17:45:20 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 0FE9C293F
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  5 Nov 2013 17:45:20 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA5HjJF5038249
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 5 Nov 2013 17:45:19 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA5HjJOK038247;
	Tue, 5 Nov 2013 17:45:19 GMT
	(envelope-from nobody)
Message-Id: <201311051745.rA5HjJOK038247@oldred.freebsd.org>
Date: Tue, 5 Nov 2013 17:45:19 GMT
From: "Edward O'Callaghan" <eocallaghan@alterapraxis.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [lock order reversal] when umounting a ZFS disk.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         183689
>Category:       kern
>Synopsis:       [lor] lock order reversal when umounting a ZFS disk.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 05 17:50:00 UTC 2013
>Closed-Date:    Wed Nov 06 07:59:11 UTC 2013
>Last-Modified:  Wed Nov  6 08:00:00 UTC 2013
>Originator:     Edward O'Callaghan
>Release:        ~ FreeBSD 10.0-BETA3
>Organization:
Altera Praxis Pty Ltd
>Environment:
FreeBSD acid.alterapraxis.com 11.0-CURRENT FreeBSD 11.0-CURRENT #3 r257709: Tue Nov  5 16:40:15 EST 2013     root@acid.alterapraxis.com:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
On reboot when unmounting a ZFS root there seems to be a lock order reversal between,
 1st 0xfffff800145fd7c8 zfs (zfs) @ /usr/src/sys/kern/vfs_mount.c:1237
 2nd 0xfffff800142ac240 devfs (devfs) @ /usr/src/sys/kern/vfs_subr.c:210

Since I can't understand the insane locking in vfs_mount.c:1237 I have no idea how to fix this.

----

Waiting (max 60 seconds) for system process `syncer' to stop...Syncing disks, vnodes remaining...0 0 0 0 0 0 0 done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
All buffers synced.
lock order reversal:
 1st 0xfffff800145fd7c8 zfs (zfs) @ /usr/src/sys/kern/vfs_mount.c:1237
 2nd 0xfffff800142ac240 devfs (devfs) @ /usr/src/sys/kern/vfs_subr.c:2101
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe084d734460
kdb_backtrace() at kdb_backtrace+0x39/frame 0xfffffe084d734510
witness_checkorder() at witness_checkorder+0xd23/frame 0xfffffe084d7345a0
__lockmgr_args() at __lockmgr_args+0x86c/frame 0xfffffe084d7346d0
vop_stdlock() at vop_stdlock+0x3c/frame 0xfffffe084d7346f0
VOP_LOCK1_APV() at VOP_LOCK1_APV+0xf5/frame 0xfffffe084d734720
_vn_lock() at _vn_lock+0xab/frame 0xfffffe084d734790
vget() at vget+0x70/frame 0xfffffe084d7347e0
devfs_allocv() at devfs_allocv+0xfd/frame 0xfffffe084d734830
devfs_root() at devfs_root+0x43/frame 0xfffffe084d734860
dounmount() at dounmount+0x35a/frame 0xfffffe084d7348e0
vfs_unmountall() at vfs_unmountall+0x61/frame 0xfffffe084d734910
kern_reboot() at kern_reboot+0x548/frame 0xfffffe084d734980
sys_reboot() at sys_reboot+0x58/frame 0xfffffe084d7349a0
amd64_syscall() at amd64_syscall+0x265/frame 0xfffffe084d734ab0
Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe084d734ab0
--- syscall (55, FreeBSD ELF64, sys_reboot), rip = 0x80085f3fc, rsp = 0x7fffffffda38, rbp = 0x7fffffffdba0 ---

---
>How-To-Repeat:
reboot
>Fix:
N/A.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Nov 6 04:19:56 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183689 
State-Changed-From-To: open->closed 
State-Changed-By: avg 
State-Changed-When: Wed Nov 6 07:59:09 UTC 2013 
State-Changed-Why:  
Not a problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=183689 

From: Andriy Gapon <avg@FreeBSD.org>
To: bug-followup@FreeBSD.org, eocallaghan@alterapraxis.com
Cc:  
Subject: Re: kern/183689: [lor] lock order reversal when umounting a ZFS disk.
Date: Wed, 06 Nov 2013 09:57:41 +0200

 This is a harmless LOR and happens with any fs, not just ZFS.
 
 -- 
 Andriy Gapon
>Unformatted:
