From owner-cvs-all@FreeBSD.ORG Fri Feb 9 14:04:08 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EA5EB16A400; Fri, 9 Feb 2007 14:04:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5E113C481; Fri, 9 Feb 2007 14:04:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id l19E3plf096573; Fri, 9 Feb 2007 09:03:59 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Tai-hwa Liang Date: Fri, 9 Feb 2007 08:43:36 -0500 User-Agent: KMail/1.9.4 References: <200702090254.l192sDJs085116@repoman.freebsd.org> In-Reply-To: <200702090254.l192sDJs085116@repoman.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200702090843.37371.jhb@freebsd.org> Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Fri, 09 Feb 2007 09:04:00 -0500 (EST) X-Virus-Scanned: ClamAV 0.88.3/2544/Fri Feb 9 03:44:48 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/netsmb smb_dev.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Feb 2007 14:04:09 -0000 On Thursday 08 February 2007 21:54, Tai-hwa Liang wrote: > avatar 2007-02-09 02:54:13 UTC > > FreeBSD src repository > > Modified files: > sys/netsmb smb_dev.c > Log: > It turns out that devfs_close() does a dev_refthread() before invoking > device specific d_close(), which makes subsequent destroy_dev() being > blocked in the "devdrn" loop. > > This bandaid should fix the smbfs hang/crashing observed on -CURRENT since > the introduction of sys/kern/kern_conf.c:1.199: > > # mount_smbfs -I server //server/share /mnt > Password: > [hang] > > Reviewed by: bp > See also: http://lists.freebsd.org/pipermail/cvs-src/2006-November/071379.html No, this is the completely wrong fix for this. Defer the destroy_dev() to a taskqueue or some such. Alternatively, try to get kib@ and other devfs folks to really allow this. One possibility is for dev_destroy() to "know" that it is in a close routine (devfs can set a flag) and defer the work to an internal taskqueue in devfs. Another alternative is to "know" and set a different flag indicating a pending destroy, and devfs can really destroy it when the close routine returns. However, manually dinking with the reference count is completely wrong. What happens when devfs tries to drop the reference count when your close routine returns, does it trash memory? I think you should back this change out and work on a more correct fix. -- John Baldwin