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.
>
> --
> 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/ufs/ufs_vnops.c:138
> +KDB: stack backtrace:
> +kdb_backtrace(c07f9879,c45c22dc,c07fd31c,c07fd31c,c080c7b2,...) at
kdb_backtrace+0x2f
> +witness_checkorder(c45c22dc,9,c080c7b2,8a,c07fc6bd,...) at
witness_checkorder+0x5fe
> +_mtx_lock_flags(c45c22dc,0,c080c7b2,8a,e790ba20,...) at
_mtx_lock_flags+0x32
> +ufs_itimes(c47a0dd0,c47a0e90,e790ba78,c060e1cc,c47a0dd0,...) at
ufs_itimes+0x6c
> +ufs_getattr(e790ba54,e790baec,c0622af6,c0896f40,e790ba54,...) at
ufs_getattr+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+0x84
> +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 = 0x2831d727, esp = 0xbfbfea1c,
ebp = 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
==================================================================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 @@
};
+%% 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
Index: kern/vfs_default.c
==================================================================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 @@
static int vop_nolookup(struct vop_lookup_args *);
static int vop_nostrategy(struct vop_strategy_args *);
+static int vop_stdgetattrfast(struct vop_getattrfast_args *);
/*
* This vnode table stores what we want to do if the filesystem doesn't
@@ -96,6 +97,7 @@
.vop_revoke = VOP_PANIC,
.vop_strategy = vop_nostrategy,
.vop_unlock = vop_stdunlock,
+ .vop_getattrfast = vop_stdgetattrfast,
};
/*
@@ -511,6 +513,19 @@
ap->a_sync, ap->a_rtvals);
}
+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 values.
Index: kern/vfs_subr.c
==================================================================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);
}
- if (VOP_GETATTR(vp, &va, curthread->td_ucred, curthread))
+ if (VOP_GETATTRFAST(vp, &va, curthread->td_ucred, curthread))
return (0);
kn->kn_data = va.va_size - kn->kn_fp->f_offset;
Index: ufs/ufs/ufs_vnops.c
==================================================================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);
}
+/* 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 = ap->a_vp;
+ struct inode *ip = VTOI(vp);
+ struct vattr *vap = ap->a_vap;
+
+ if (ip->i_ump->um_fstype == UFS1) {
+ vap->va_size = ip->i_din1->di_size;
+ } else {
+ vap->va_size = ip->i_din2->di_size;
+ }
+ return (0);
+}
+
/*
* Set attribute vnode op. called from several syscalls
*/
@@ -2464,6 +2487,7 @@
.vop_close = ufs_close,
.vop_create = ufs_create,
.vop_getattr = ufs_getattr,
+ .vop_getattrfast = ufs_getattrfast,
.vop_inactive = ufs_inactive,
.vop_link = ufs_link,
.vop_lookup = vfs_cache_lookup,
@@ -2504,6 +2528,7 @@
.vop_access = ufs_access,
.vop_close = ufsfifo_close,
.vop_getattr = ufs_getattr,
+ .vop_getattrfast = ufs_getattrfast,
.vop_inactive = ufs_inactive,
.vop_kqfilter = ufsfifo_kqfilter,
.vop_print = ufs_print,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :
http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20061127/4803337b/attachment.pgp