From owner-freebsd-current@FreeBSD.ORG Tue Aug 21 14:43:14 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB48E16A420 for ; Tue, 21 Aug 2007 14:43:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id 7088213C478 for ; Tue, 21 Aug 2007 14:43:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=deviant.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1INUwn-000IFX-LU; Tue, 21 Aug 2007 17:43:12 +0300 Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l7LEh4nn038544; Tue, 21 Aug 2007 17:43:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l7LEh3RU038543; Tue, 21 Aug 2007 17:43:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Aug 2007 17:43:03 +0300 From: Kostik Belousov To: Peter Jeremy Message-ID: <20070821144303.GD2738@deviant.kiev.zoral.com.ua> References: <20070817073321.GA6321@turion.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0IfLThn+1cz+gOna" Content-Disposition: inline In-Reply-To: <20070817073321.GA6321@turion.vk2pj.dyndns.org> User-Agent: Mutt/1.4.2.3i X-Scanner-Signature: 21f1cdc77deae757bfd40713fd6c3781 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Info: Profiles 1394 [August 21 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {received from trusted relay: not dialup} X-SpamTest-Method: none X-SpamTest-Method: Local Lists X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Cc: freebsd-current@freebsd.org, tegge@freebsd.org Subject: insmntque for syncvnode panic [Was: Re: panic unmounting filesystems] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 21 Aug 2007 14:43:14 -0000 --0IfLThn+1cz+gOna Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 17, 2007 at 05:33:21PM +1000, Peter Jeremy wrote: > After upgrading to current as of about 24 hours ago, I now consistently > get panics when I try to unmount filesystems with pending I/O. If I > just mount and unmount a filesystem, it works but if I try to unmount > a filesystem that has been active, I get: >=20 > handle_workitem_remove: vget: got error 16 while accessing filesystem > softdep_waitidle: Failed to flush worklist for 0xc2c6429c I think that this errors are supposed to happen on busy fs. > panic: vfs_allocate_syncvnode: insmntque failed This one is the real problem. >=20 > I have a crashdump and the backtrace looks like: > #8 0xc055c545 in panic (fmt=3D0xc07309f1 "vfs_allocate_syncvnode: insmnt= que failed") > at /usr/src/sys/kern/kern_shutdown.c:547 > #9 0xc05d6b9a in vfs_allocate_syncvnode (mp=3D0xc2c6429c) at /usr/src/sy= s/kern/vfs_subr.c:3111 > #10 0xc05d1222 in dounmount (mp=3D0xc2c6429c, flags=3D0x8000000, td=3D0xc= 2d9c600) at /usr/src/sys/kern/vfs_mount.c:1289 > #11 0xc05d16ff in unmount (td=3D0xc2d9c600, uap=3D0xd6218cfc) at /usr/src= /sys/kern/vfs_mount.c:1170 > #12 0xc06de9ea in syscall (frame=3D0xd6218d38) at /usr/src/sys/i386/i386/= trap.c:1008 > #13 0xc06cc5c0 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception= .s:196 >=20 > According to kgdb, insmntque() returned both EXDEV and EBUSY. The former > is impossible so I suspect kgdb is confused and the latter is correct. >=20 > The mountpoint shows as in the process of being unmounted and has > mnt_nvnodelistsize =3D=3D 0 so insmntque() makes sense at the micro level. > Having a system panic as a result does not make sense. Sure. I think that syncvnode shall be allocated after the MNTK_UNMOUNT flag is cleared. Could you, please, test the patch below ? >=20 > The softdep_waitidle() error looks suspicious - at a quick glance, it > appears to only wait for 10 ticks (10msec) for the dependency chain to > empty. This seems unreasonably short for an operation that probably > includes physical I/O. Is my reasoning correct? >=20 > Does anyone have any suggestions on where to look next? >=20 diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 702efc3..09f4d1e 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1285,14 +1285,16 @@ dounmount(mp, flags, td) } vput(fsrootvp); } - if ((mp->mnt_flag & MNT_RDONLY) =3D=3D 0 && mp->mnt_syncer =3D=3D NULL) - (void) vfs_allocate_syncvnode(mp); MNT_ILOCK(mp); mp->mnt_kern_flag &=3D ~(MNTK_UNMOUNT | MNTK_UNMOUNTF); mp->mnt_flag |=3D async_flag; if ((mp->mnt_flag & MNT_ASYNC) !=3D 0 && mp->mnt_noasync =3D=3D 0) mp->mnt_kern_flag |=3D MNTK_ASYNC; + MNT_IUNLOCK(mp); + if ((mp->mnt_flag & MNT_RDONLY) =3D=3D 0 && mp->mnt_syncer =3D=3D NULL) + (void) vfs_allocate_syncvnode(mp); lockmgr(&mp->mnt_lock, LK_RELEASE, NULL, td); + MNT_ILOCK(mp); if (mp->mnt_kern_flag & MNTK_MWAIT) wakeup(mp); MNT_IUNLOCK(mp); --0IfLThn+1cz+gOna Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGyvn2C3+MBN1Mb4gRApm0AKDOJc8LZMCJ91aHYj8LB6uf3XVjUgCeP0AD VaeIyVZaEWrraDXskGguDtE= =BWF7 -----END PGP SIGNATURE----- --0IfLThn+1cz+gOna--