Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jul 2009 07:42:20 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Rene Ladan <rene@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: kern/136945: [ufs] [lor] filedesc structure/ufs (poll)
Message-ID:  <200907290742.20838.jhb@freebsd.org>
In-Reply-To: <e890cae60907290252n409c1503g9a15cfe0de43a845@mail.gmail.com>
References:  <200907271400.n6RE05Rv056472@freefall.freebsd.org> <200907281038.30277.jhb@freebsd.org> <e890cae60907290252n409c1503g9a15cfe0de43a845@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 29 July 2009 5:52:24 am Rene Ladan wrote:
> 2009/7/28 John Baldwin <jhb@freebsd.org>:
> > On Tuesday 28 July 2009 10:03:40 am Rene Ladan wrote:
> >> 2009/7/28 John Baldwin <jhb@freebsd.org>:
> >> > On Monday 27 July 2009 10:00:05 am Rene Ladan wrote:
> >> >> The following reply was made to PR kern/136945; it has been noted by
> > GNATS.
> >> >>
> >> >> From: Rene Ladan <rene@freebsd.org>
> >> >> To: John Baldwin <jhb@freebsd.org>
> >> >> Cc: bug-followup@freebsd.org
> >> >> Subject: Re: kern/136945: [ufs] [lor] filedesc structure/ufs (poll)
> >> >> Date: Mon, 27 Jul 2009 15:51:15 +0200
> >> >>
> >> >> =A02009/7/27 John Baldwin <jhb@freebsd.org>:
> >> >> =A0> I would actually expect this to be the correct order for these=
 two
> >> > locks.=3D
> >> >> =A0 =3DA0Can
> >> >> =A0> you capture the output of the 'debug.witness.fullgraph' sysctl=
 to a
> > file?
> >> >> =A0>
> >> >> =A0Yes, see attachment. =A0I'm still running the same 8.0-BETA2.
> >> >
> >> > Hmm, the attachment was eaten by a grue, can you post the file=20
somewhere?
> >> >
> >> Yes, see ftp://rene-ladan.nl/pub/freebsd/kern_136945.txt
> >
> > Ok, it looks like it did encounter a UFS -> filedesc order at some=20
point. =A0Can
> > you patch sys/kern/subr_witness.c to add a section to the order_lists[]=
=20
array
> > after the 'ZFS locking list' and before the spin locks list that looks=
=20
like
> > this:
> >
> > =A0 =A0 =A0 =A0{ "filedesc structure", &lock_class_sx },
> > =A0 =A0 =A0 =A0{ "ufs", &lock_class_lockmgr},
> > =A0 =A0 =A0 =A0{ NULL, NULL },
> >
> The LOR seems to be gone, previously it showed up only once right
> after booting the system.
>=20
> But now a new LOR (according to the LOR page) seems pop up:
> Trying to mount root from ufs:/dev/ad0s1a
> lock order reversal:
>  1st 0xffffff0002a4ad80 ufs (ufs) @ /usr/src/sys/ufs/ffs/ffs_vfsops.c:1465
>  2nd 0xffffff0002b29a48 filedesc structure (filedesc structure) @
> /usr/src/sys/kern/kern_descrip.c:2478
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
> _witness_debugger() at _witness_debugger+0x49
> witness_checkorder() at witness_checkorder+0x7ea
> _sx_xlock() at _sx_xlock+0x44
> mountcheckdirs() at mountcheckdirs+0x80
> vfs_donmount() at vfs_donmount+0xfbf
> kernel_mount() at kernel_mount+0xa1
> vfs_mountroot_try() at vfs_mountroot_try+0x177
> vfs_mountroot() at vfs_mountroot+0x47d
> start_init() at start_init+0x62
> fork_exit() at fork_exit+0x12a
> fork_trampoline() at fork_trampoline+0xe
> --- trap 0, rip =3D 0, rsp =3D 0xffffff800001ad30, rbp =3D 0 ---
>=20
> The output of `df' and `mount' looks ok.

Yes, this is the "real" LOR as "filedesc" -> "ufs" in the poll() case shoul=
d=20
be the normal order.  I believe this should fix it.  mountcheckdirs() doesn=
't=20
need the vnodes locked, it just needs the caller to hold references on them=
=20
so they aren't recycled:

=2D-- //depot/projects/smpng/sys/kern/vfs_mount.c#96
+++ /home/jhb/work/p4/smpng/sys/kern/vfs_mount.c
@@ -1069,9 +1069,10 @@
 		vfs_event_signal(NULL, VQ_MOUNT, 0);
 		if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp))
 			panic("mount: lost mount");
+		VOP_UNLOCK(newdp, 0);
+		VOP_UNLOCK(vp, 0);
 		mountcheckdirs(vp, newdp);
=2D		vput(newdp);
=2D		VOP_UNLOCK(vp, 0);
+		vrele(newdp);
 		if ((mp->mnt_flag & MNT_RDONLY) =3D=3D 0)
 			error =3D vfs_allocate_syncvnode(mp);
 		vfs_unbusy(mp);

=2D-=20
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907290742.20838.jhb>