From owner-freebsd-stable@FreeBSD.ORG Wed Feb 18 23:12:43 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84BC4106566C; Wed, 18 Feb 2009 23:12:43 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10]) by mx1.freebsd.org (Postfix) with ESMTP id 431198FC0C; Wed, 18 Feb 2009 23:12:42 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from pd2ml1so-ssvc.prod.shaw.ca ([10.0.141.139]) by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 18 Feb 2009 16:12:42 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.0 c=0 a=6I5d2MoRAAAA:8 a=bK2CagvgAuzZbd-IqcsA:9 a=0wrXT-9zWFAfJo5mcnoA:7 a=EJMOD3vJA6Cmih7pfNCJzBi1kQgA:4 a=V7tsTZBp22UA:10 a=SV7veod9ZcQA:10 a=wAGQQ9Az6v0A:10 Received: from s01060002b31a8191.gv.shawcable.net (HELO spqr.komquats.com) ([24.68.166.226]) by pd2ml1so-dmz.prod.shaw.ca with ESMTP; 18 Feb 2009 16:12:41 -0700 Received: from cwsys.cwsent.com (cwsys [10.1.1.1]) by spqr.komquats.com (Postfix) with ESMTP id 62C55410FA; Wed, 18 Feb 2009 15:12:40 -0800 (PST) Received: from cwsys (localhost [127.0.0.1]) by cwsys.cwsent.com (8.14.3/8.14.3) with ESMTP id n1INCeb9002941; Wed, 18 Feb 2009 15:12:40 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <200902182312.n1INCeb9002941@cwsys.cwsent.com> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Kostik Belousov In-Reply-To: Message from Kostik Belousov of "Wed, 18 Feb 2009 18:21:26 +0200." <20090218162126.GQ41617@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 18 Feb 2009 15:12:40 -0800 Sender: Cy.Schubert@komquats.com Cc: pjd@freebsd.org, freebsd-stable@freebsd.org Subject: Re: ZFS Panic X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cy Schubert List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 23:12:44 -0000 In message <20090218162126.GQ41617@deviant.kiev.zoral.com.ua>, Kostik Belousov writes: > > --v+Mbu5iuT/5Blw/K > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > On Tue, Feb 17, 2009 at 09:43:31PM -0800, Cy Schubert wrote: > > I got this panic after issuing reboot(8). > >=20 > > FreeBSD 7.1-STABLE FreeBSD 7.1-STABLE #0: Tue Feb 17 19:29:23 PST 2009 = > =20 > > cy@cwsys:/export/obj/export/home/cy/test/test-stable7/sys/DEBUG i386 > >=20 > >=20 > > FreeBSD/i386 (bob) (ttyd0) > >=20 > > login: Feb 17 21:22:56 bob reboot: rebooted by root > > Feb 17 21:22:56 bob syslogd: exiting on signal 15 > > Waiting (max 60 seconds) for system process `vnlru' to stop...done > > Waiting (max 60 seconds) for system process `syncer' to stop... > > Syncing disks, vnodes remaining...2 2 2 2 1 1 1 1 0 0 0 0 0 0 done > > Waiting (max 60 seconds) for system process `bufdaemon' to stop...done > > All buffers synced. > > panic: insmntque() failed: error 16 > > cpuid =3D 0 > > KDB: enter: panic > > [thread pid 1086 tid 100090 ] > > Stopped at kdb_enter_why+0x3a: movl $0,kdb_why > > db> bt > > Tracing pid 1086 tid 100090 td 0xc2bfd230 > > kdb_enter_why(c087ef4a,c087ef4a,c2b1b5b4,ebf8da58,0,...) at=20 > > kdb_enter_why+0x3a > > panic(c2b1b5b4,10,c2b24a40,ebf8da64,c38e6000,...) at panic+0x136 > > gfs_file_create(84,c346d8a0,c342d5a0,c2b24a40,c346d8a0,...) at=20 > > gfs_file_create+0x86 > > gfs_dir_create(84,c346d8a0,c342d5a0,c2b24a40,0,...) at gfs_dir_create+0x2c > > zfsctl_mknode_snapdir(c346d8a0,c2b1b54f,275,25d,c3419520,...) at=20 > > zfsctl_mknode_snapdir+0x53 > > gfs_dir_lookup(c346d8a0,c2b21126,ebf8db74,c091521c,ebf8db38,...) at=20 > > gfs_dir_lookup+0xd1 > > zfsctl_root_lookup(c346d8a0,c2b21126,ebf8db74,0,0,...) at=20 > > zfsctl_root_lookup+0xdc > > zfsctl_umount_snapshots(c342d5a0,80000,c3acb800,c3216844,0,...) at=20 > > zfsctl_umount_snapshots+0x4e > > zfs_umount(c342d5a0,80000,c2bfd230,c2bfd230,c088a687,...) at zfs_umount+0= > x53 > > dounmount(c342d5a0,80000,c2bfd230,e26988ac,0,...) at dounmount+0x430 > > vfs_unmountall(c087ed87,0,c087edeb,128,0,...) at vfs_unmountall+0x4e > > boot(c090b5d0,0,c087edeb,ab,ebf8dd2c,...) at boot+0x44f > > reboot(c2bfd230,ebf8dcfc,4,c0885aef,c08c38a8,...) at reboot+0x4b > > syscall(ebf8dd38) at syscall+0x2b3 > > Xint0x80_syscall() at Xint0x80_syscall+0x20 > > --- syscall (55, FreeBSD ELF32, reboot), eip =3D 0x280bc947, esp =3D=20 > > 0xbfbfeb7c, ebp =3D 0xbfbfebb8 --- > > db>=20 > >=20 > > Forceably unmounting ZFS filesystems prior to issuing reboot(8) mitigates= > =20 > > the panic. > > The patch below would fix the problem, unless I mis-merged it. > Please note that I cannot test the patch myself, so I rely on ZFS > users testing before the commit. > > Property changes on: . > ___________________________________________________________________ > Modified: svn:mergeinfo > Merged /head/sys:r182781,182824,182840 > > > Property changes on: dev/cxgb > ___________________________________________________________________ > Modified: svn:mergeinfo > Merged /head/sys/dev/cxgb:r182781,182824,182840 > > > Property changes on: dev/ath/ath_hal > ___________________________________________________________________ > Modified: svn:mergeinfo > Merged /head/sys/dev/ath/ath_hal:r182781,182824,182840 > > > Property changes on: contrib/pf > ___________________________________________________________________ > Modified: svn:mergeinfo > Merged /head/sys/contrib/pf:r182781,182824,182840 > > Index: cddl/contrib/opensolaris/uts/common/fs/gfs.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cddl/contrib/opensolaris/uts/common/fs/gfs.c (revision 188748) > +++ cddl/contrib/opensolaris/uts/common/fs/gfs.c (working copy) > @@ -358,6 +358,7 @@ > fp =3D kmem_zalloc(size, KM_SLEEP); > error =3D getnewvnode("zfs", vfsp, ops, &vp); > ASSERT(error =3D=3D 0); > + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); > vp->v_data =3D (caddr_t)fp; > =20 > /* > @@ -368,7 +369,9 @@ > fp->gfs_size =3D size; > fp->gfs_type =3D GFS_FILE; > =20 > + vp->v_vflag |=3D VV_FORCEINSMQ; > error =3D insmntque(vp, vfsp); > + vp->v_vflag &=3D ~VV_FORCEINSMQ; > KASSERT(error =3D=3D 0, ("insmntque() failed: error %d", error)); > =20 > /* > Index: cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (revision 18874 > 8) > +++ cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c (working copy) > @@ -113,6 +113,7 @@ > if (cdrarg !=3D NULL) { > error =3D getnewvnode("zfs", vfsp, &zfs_vnodeops, &vp); > ASSERT(error =3D=3D 0); > + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); > zp->z_vnode =3D vp; > vp->v_data =3D (caddr_t)zp; > vp->v_vnlock->lk_flags |=3D LK_CANRECURSE; > @@ -348,7 +349,9 @@ > if (vp =3D=3D NULL) > return (zp); > =20 > + vp->v_vflag |=3D VV_FORCEINSMQ; > error =3D insmntque(vp, zfsvfs->z_vfs); > + vp->v_vflag &=3D ~VV_FORCEINSMQ; > KASSERT(error =3D=3D 0, ("insmntque() failed: error %d", error)); > =20 > vp->v_type =3D IFTOVT((mode_t)zp->z_phys->zp_mode); > @@ -535,8 +538,10 @@ > =20 > *zpp =3D zp; > } else { > - if (ZTOV(zp) !=3D NULL) > + if (ZTOV(zp) !=3D NULL) { > ZTOV(zp)->v_count =3D 0; > + VOP_UNLOCK(ZTOV(zp), 0, curthread); > + } > dmu_buf_rele(dbp, NULL); > zfs_znode_free(zp); > } > @@ -598,14 +603,18 @@ > &zp->z_vnode); > ASSERT(err =3D=3D 0); > vp =3D ZTOV(zp); > + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread); > vp->v_data =3D (caddr_t)zp; > vp->v_vnlock->lk_flags |=3D LK_CANRECURSE; > vp->v_vnlock->lk_flags &=3D ~LK_NOSHARE; > vp->v_type =3D IFTOVT((mode_t)zp->z_phys->zp_mode); > if (vp->v_type =3D=3D VDIR) > zp->z_zn_prefetch =3D B_TRUE; /* z_prefetch d > efault is enabled */ > + vp->v_vflag |=3D VV_FORCEINSMQ; > err =3D insmntque(vp, zfsvfs->z_vfs); > + vp->v_vflag &=3D ~VV_FORCEINSMQ; > KASSERT(err =3D=3D 0, ("insmntque() failed: error %d", > err)); > + VOP_UNLOCK(vp, 0, curthread); > } > mutex_exit(&zp->z_lock); > ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); > @@ -621,6 +630,8 @@ > zfs_znode_dmu_init(zp); > ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); > *zpp =3D zp; > + if ((vp =3D ZTOV(zp)) !=3D NULL) > + VOP_UNLOCK(vp, 0, curthread); > return (0); > } > =20 > Index: cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (revision 18874 > 8) > +++ cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (working copy) > @@ -1303,12 +1303,6 @@ > } > } > out: > - > - if (error =3D=3D 0) { > - *vpp =3D ZTOV(zp); > - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td); > - } > - > if (dl) > zfs_dirent_unlock(dl); > =20 > @@ -1588,8 +1582,6 @@ > zfs_log_create(zilog, tx, TX_MKDIR, dzp, zp, dirname); > dmu_tx_commit(tx); > =20 > - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread); > - > zfs_dirent_unlock(dl); > =20 > ZFS_EXIT(zfsvfs); > @@ -2773,7 +2765,6 @@ > if (error =3D=3D 0) { > zfs_log_symlink(zilog, tx, TX_SYMLINK, dzp, zp, name, link); > *vpp =3D ZTOV(zp); > - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td); > } > =20 > dmu_tx_commit(tx); > Index: cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c (revision 18874 > = > 8) > +++ cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c (working copy) > @@ -176,6 +176,8 @@ > vp->v_vflag &=3D ~VV_ROOT; > =20 > zfsvfs->z_ctldir =3D vp; > + > + VOP_UNLOCK(vp, 0, curthread); > } > =20 > /* > @@ -789,6 +791,7 @@ > mutex_init(&sdp->sd_lock, NULL, MUTEX_DEFAULT, NULL); > avl_create(&sdp->sd_snaps, snapentry_compare, > sizeof (zfs_snapentry_t), offsetof(zfs_snapentry_t, se_node)); > + VOP_UNLOCK(vp, 0, curthread); > return (vp); > } > =20 > @@ -862,6 +865,7 @@ > &zfsctl_ops_snapshot, NULL, NULL, MAXNAMELEN, NULL, NULL); > zcp =3D vp->v_data; > zcp->zc_id =3D objset; > + VOP_UNLOCK(vp, 0, curthread); > =20 > return (vp); > } > Problem solved! Thanks. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org e**(i*pi)+1=0