From owner-cvs-src@FreeBSD.ORG Sat Dec 23 17:18:32 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 555D516A552; Sat, 23 Dec 2006 17:18:32 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 2363B13C4FC; Sat, 23 Dec 2006 17:18:29 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kBNHIIYC083786; Sat, 23 Dec 2006 17:18:18 GMT (envelope-from alfred@repoman.freebsd.org) Received: (from alfred@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kBNHIIdj083785; Sat, 23 Dec 2006 17:18:18 GMT (envelope-from alfred) Message-Id: <200612231718.kBNHIIdj083785@repoman.freebsd.org> From: Alfred Perlstein Date: Sat, 23 Dec 2006 17:18:18 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/dev/usb if_aue.c if_auereg.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Dec 2006 17:18:32 -0000 alfred 2006-12-23 17:18:18 UTC FreeBSD src repository Modified files: sys/dev/usb if_aue.c if_auereg.h Log: Fix a deadlock in detach/shutdown. The problem was that I was acquiring the driver sx lock and then waiting for a taskqueue to drain, however the taskqueue itself would try to acquire the lock as well leading to a deadlock. To fix the problem roll my own exclusive lock that allows for lock cancellation. This is a normal exclusive lock, however if someone marks it as "dead" then all waiters who request an error return will get back an error instead of continuing to wait for the lock. In this particular case, the shutdown and detach functions kill the lock while the async task thread tries to acquire the lock but will abort if the lock returns an error. The other option was to drop the driver lock mid-detach and mid-shutdown, mid-detach was a ok, however mid-shutdown was not. While I'm here, fix a bug in what appears to be the mii link status word in the softc going out to lunch. Explicitly set the status word to 1 after initializing the mii. This would result in an interface that would never respond to "if_start" requests as the mii interface would always look down. Revision Changes Path 1.104 +155 -15 src/sys/dev/usb/if_aue.c 1.26 +9 -5 src/sys/dev/usb/if_auereg.h