Date: Mon, 27 Nov 2006 11:21:46 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: V??clav Haisman <V.Haisman@sh.cvut.cz> Cc: tegge@freebsd.org, freebsd-current@freebsd.org, freebsd-stable@freebsd.org, bde@freebsd.org Subject: Re: kqueue LOR Message-ID: <20061127092146.GA69556@deviant.kiev.zoral.com.ua> In-Reply-To: <456950AF.3090308@sh.cvut.cz> References: <456950AF.3090308@sh.cvut.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
--x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 26, 2006 at 09:30:39AM +0100, V??clav Haisman wrote: > Hi, > the attached lor.txt contains LOR I got this yesterday. It is FreeBSD 6.1 > with relatively recent kernel, from last week or so. >=20 > -- > VH > +lock order reversal: > + 1st 0xc537f300 kqueue (kqueue) @ /usr/src/sys/kern/kern_event.c:1547 > + 2nd 0xc45c22dc struct mount mtx (struct mount mtx) @ /usr/src/sys/ufs/u= fs/ufs_vnops.c:138 > +KDB: stack backtrace: > +kdb_backtrace(c07f9879,c45c22dc,c07fd31c,c07fd31c,c080c7b2,...) at kdb_b= acktrace+0x2f > +witness_checkorder(c45c22dc,9,c080c7b2,8a,c07fc6bd,...) at witness_check= order+0x5fe > +_mtx_lock_flags(c45c22dc,0,c080c7b2,8a,e790ba20,...) at _mtx_lock_flags+= 0x32 > +ufs_itimes(c47a0dd0,c47a0e90,e790ba78,c060e1cc,c47a0dd0,...) at ufs_itim= es+0x6c > +ufs_getattr(e790ba54,e790baec,c0622af6,c0896f40,e790ba54,...) at ufs_get= attr+0x20 > +VOP_GETATTR_APV(c0896f40,e790ba54,c08a5760,c47a0dd0,e790ba74,...) at VOP= _GETATTR_APV+0x3a > +filt_vfsread(c4cf261c,6,c07f445e,60b,0,...) at filt_vfsread+0x75 > +knote(c4f57114,6,1,1f30c2af,1f30c2af,...) at knote+0x75 > +VOP_WRITE_APV(c0896f40,e790bbec,c47a0dd0,227,e790bcb4,...) at VOP_WRITE_= APV+0x148 > +vn_write(c45d5120,e790bcb4,c5802a00,0,c4b73a80,...) at vn_write+0x201 > +dofilewrite(c4b73a80,1b,c45d5120,e790bcb4,ffffffff,...) at dofilewrite+0= x84 > +kern_writev(c4b73a80,1b,e790bcb4,8220c71,0,...) at kern_writev+0x65 > +write(c4b73a80,e790bd04,c,c07d899c,3,...) at write+0x4f > +syscall(3b,3b,bfbf003b,0,bfbfeae4,...) at syscall+0x295 > +Xint0x80_syscall() at Xint0x80_syscall+0x1f > +--- syscall (4, FreeBSD ELF32, write), eip =3D 0x2831d727, esp =3D 0xbfb= fea1c, ebp =3D 0xbfbfea48 --- Thank you for the report. The LOR is caused by my commit into sys/ufs/ufs/ufs_vnops.c, rev. 1.280. What application you run that triggers the LOR ? Patch below is one possible approach to fixing it. Index: kern/vnode_if.src =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 RCS file: /usr/local/arch/ncvs/src/sys/kern/vnode_if.src,v retrieving revision 1.84 diff -u -r1.84 vnode_if.src --- kern/vnode_if.src 13 Nov 2006 05:51:22 -0000 1.84 +++ kern/vnode_if.src 26 Nov 2006 15:20:44 -0000 @@ -164,6 +164,16 @@ }; =20 =20 +%% getattrfast vp L L L + +vop_getattrfast { + IN struct vnode *vp; + OUT struct vattr *vap; + IN struct ucred *cred; + IN struct thread *td; +}; + + %% setattr vp E E E %! setattr post vop_setattr_post =20 Index: kern/vfs_default.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 RCS file: /usr/local/arch/ncvs/src/sys/kern/vfs_default.c,v retrieving revision 1.135 diff -u -r1.135 vfs_default.c --- kern/vfs_default.c 13 Nov 2006 05:51:22 -0000 1.135 +++ kern/vfs_default.c 26 Nov 2006 15:20:44 -0000 @@ -62,6 +62,7 @@ =20 static int vop_nolookup(struct vop_lookup_args *); static int vop_nostrategy(struct vop_strategy_args *); +static int vop_stdgetattrfast(struct vop_getattrfast_args *); =20 /* * This vnode table stores what we want to do if the filesystem doesn't @@ -96,6 +97,7 @@ .vop_revoke =3D VOP_PANIC, .vop_strategy =3D vop_nostrategy, .vop_unlock =3D vop_stdunlock, + .vop_getattrfast =3D vop_stdgetattrfast, }; =20 /* @@ -511,6 +513,19 @@ ap->a_sync, ap->a_rtvals); } =20 +static int +vop_stdgetattrfast(ap) + struct vop_getattrfast_args /* { + struct vnode *vp; + struct vattr *vap; + struct ucred *cred; + struct thread *td; + } */ *ap; +{ + + return VOP_GETATTR(ap->a_vp, ap->a_vap, ap->a_cred, ap->a_td); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return va= lues. Index: kern/vfs_subr.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 RCS file: /usr/local/arch/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.692 diff -u -r1.692 vfs_subr.c --- kern/vfs_subr.c 13 Nov 2006 05:51:22 -0000 1.692 +++ kern/vfs_subr.c 26 Nov 2006 15:20:44 -0000 @@ -3828,7 +3828,7 @@ return (1); } =20 - if (VOP_GETATTR(vp, &va, curthread->td_ucred, curthread))=20 + if (VOP_GETATTRFAST(vp, &va, curthread->td_ucred, curthread))=20 return (0); =20 kn->kn_data =3D va.va_size - kn->kn_fp->f_offset; Index: ufs/ufs/ufs_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 RCS file: /usr/local/arch/ncvs/src/sys/ufs/ufs/ufs_vnops.c,v retrieving revision 1.283 diff -u -r1.283 ufs_vnops.c --- ufs/ufs/ufs_vnops.c 6 Nov 2006 13:42:09 -0000 1.283 +++ ufs/ufs/ufs_vnops.c 26 Nov 2006 15:20:44 -0000 @@ -97,6 +97,7 @@ static vop_close_t ufs_close; static vop_create_t ufs_create; static vop_getattr_t ufs_getattr; +static vop_getattrfast_t ufs_getattrfast; static vop_link_t ufs_link; static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct= componentname *); static vop_mkdir_t ufs_mkdir; @@ -437,6 +438,28 @@ return (0); } =20 +/* ARGSUSED */ +static int +ufs_getattrfast(ap) + struct vop_getattrfast_args /* { + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct thread *a_td; + } */ *ap; +{ + struct vnode *vp =3D ap->a_vp; + struct inode *ip =3D VTOI(vp); + struct vattr *vap =3D ap->a_vap; + + if (ip->i_ump->um_fstype =3D=3D UFS1) { + vap->va_size =3D ip->i_din1->di_size; + } else { + vap->va_size =3D ip->i_din2->di_size; + } + return (0); +} + /* * Set attribute vnode op. called from several syscalls */ @@ -2464,6 +2487,7 @@ .vop_close =3D ufs_close, .vop_create =3D ufs_create, .vop_getattr =3D ufs_getattr, + .vop_getattrfast =3D ufs_getattrfast, .vop_inactive =3D ufs_inactive, .vop_link =3D ufs_link, .vop_lookup =3D vfs_cache_lookup, @@ -2504,6 +2528,7 @@ .vop_access =3D ufs_access, .vop_close =3D ufsfifo_close, .vop_getattr =3D ufs_getattr, + .vop_getattrfast =3D ufs_getattrfast, .vop_inactive =3D ufs_inactive, .vop_kqfilter =3D ufsfifo_kqfilter, .vop_print =3D ufs_print, --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFaq4pC3+MBN1Mb4gRAvPlAJ92/03gIvFbuPdyBTWRIqtlzYRpowCg8w7X Bl+rG7JU3xmQu5uLXFG501Q= =VynZ -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061127092146.GA69556>