From owner-freebsd-current@FreeBSD.ORG Sun Nov 9 15:33:22 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FD3716A4CE for ; Sun, 9 Nov 2003 15:33:22 -0800 (PST) Received: from smtp02.syd.iprimus.net.au (smtp02.syd.iprimus.net.au [210.50.76.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id E59D343F85 for ; Sun, 9 Nov 2003 15:33:21 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from robbins.dropbear.id.au (210.50.217.153) by smtp02.syd.iprimus.net.au (7.0.020) id 3F8F522A007D11C4; Mon, 10 Nov 2003 10:33:19 +1100 Received: by robbins.dropbear.id.au (Postfix, from userid 1000) id 4527A611E; Mon, 10 Nov 2003 10:33:52 +1100 (EST) Date: Mon, 10 Nov 2003 10:33:52 +1100 From: Tim Robbins To: Kris Kennaway Message-ID: <20031109233352.GA53005@wombat.robbins.dropbear.id.au> References: <20031109175416.Y58774@korben.in.tern> <20031109213052.GA99478@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031109213052.GA99478@xor.obsecurity.org> User-Agent: Mutt/1.4.1i cc: current@freebsd.org cc: Lukas Ertl Subject: Re: panic: Most recently used by mount X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2003 23:33:22 -0000 On Sun, Nov 09, 2003 at 01:30:52PM -0800, Kris Kennaway wrote: > On Sun, Nov 09, 2003 at 06:05:06PM +0100, Lukas Ertl wrote: > > > --- > > panic: Most recently used by mount > > I reported this the other day..tjr has a fix in his p4 branch. Here's the patch: (http://perforce.freebsd.org/chv.cgi?CH=41739) --- kern/vfs_mount.c.old Mon Nov 10 10:30:14 2003 +++ kern/vfs_mount.c Sun Nov 9 00:26:03 2003 @@ -700,6 +700,8 @@ mac_destroy_mount(mp); #endif crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); } vrele(vp); @@ -794,6 +796,8 @@ mac_destroy_mount(mp); #endif crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); vput(vp); goto bad; @@ -1066,6 +1070,8 @@ mac_destroy_mount(mp); #endif crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); } vrele(vp); @@ -1147,6 +1153,8 @@ mac_destroy_mount(mp); #endif crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); vput(vp); } @@ -1587,11 +1595,14 @@ free(path, M_MOUNT); if (error != 0) { if (mp != NULL) { + mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, curthread); #ifdef MAC mac_destroy_mount(mp); #endif crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); } printf("Root mount failed: %d\n", error); --- nfsclient/nfs_vfsops.c.old Mon Nov 10 10:31:08 2003 +++ nfsclient/nfs_vfsops.c Sun Nov 9 00:26:03 2003 @@ -510,8 +510,15 @@ printf("nfs_mountroot: mount %s on %s: %d", path, which, error); mp->mnt_vfc->vfc_refcount--; vfs_unbusy(mp, td); - if (didalloc) + if (didalloc) { +#ifdef MAC + mac_destroy_mount(mp); +#endif + crfree(mp->mnt_cred); + lockdestroy(&mp->mnt_lock); + mtx_destroy(&mp->mnt_mtx); free(mp, M_MOUNT); + } FREE(nam, M_SONAME); return (error); }