Packet loss every 30.999 seconds

Kostik Belousov kostikbel at gmail.com
Mon Dec 24 05:19:22 PST 2007


On Sun, Dec 23, 2007 at 10:20:31AM +1100, Bruce Evans wrote:
> On Sat, 22 Dec 2007, Kostik Belousov wrote:
> >Ok, since you talked about this first :). I already made the following
> >patch, but did not published it since I still did not inspected all
> >callers of MNT_VNODE_FOREACH() for safety of dropping mount interlock.
> >It shall be safe, but better to check. Also, I postponed the check
> >until it was reported that yielding does solve the original problem.
> 
> Good.  I'd still like to unobfuscate the function call.
What do you mean there ? 

> Putting the count in the union seems fragile at best.  Even if nothing
> can access the marker vnode, you need to context-switch its old contents
> while using it for the count, in case its old contents is used.  Vnode-
> printing routines might still be confused.
Could you, please, describe what you mean by "contex-switch" for the
VMARKER ?


Mark, could you, please, retest the patch below in your setup ?
I want to put a change or some edition of it into the 7.0 release, and
we need to move fast to do this.

diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 14acc5b..046af82 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1994,6 +1994,12 @@ __mnt_vnode_next(struct vnode **mvp, struct mount *mp)
 	mtx_assert(MNT_MTX(mp), MA_OWNED);
 
 	KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
+	if ((*mvp)->v_yield++ == 500) {
+		MNT_IUNLOCK(mp);
+		(*mvp)->v_yield = 0;
+		uio_yield();
+		MNT_ILOCK(mp);
+	}
 	vp = TAILQ_NEXT(*mvp, v_nmntvnodes);
 	while (vp != NULL && vp->v_type == VMARKER)
 		vp = TAILQ_NEXT(vp, v_nmntvnodes);
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index dc70417..6e3119b 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -131,6 +131,7 @@ struct vnode {
 		struct socket	*vu_socket;	/* v unix domain net (VSOCK) */
 		struct cdev	*vu_cdev; 	/* v device (VCHR, VBLK) */
 		struct fifoinfo	*vu_fifoinfo;	/* v fifo (VFIFO) */
+		int		vu_yield;	/*   yield count (VMARKER) */
 	} v_un;
 
 	/*
@@ -185,6 +186,7 @@ struct vnode {
 #define	v_socket	v_un.vu_socket
 #define	v_rdev		v_un.vu_cdev
 #define	v_fifoinfo	v_un.vu_fifoinfo
+#define	v_yield		v_un.vu_yield
 
 /* XXX: These are temporary to avoid a source sweep at this time */
 #define v_object	v_bufobj.bo_object
-------------- 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-net/attachments/20071224/af343a27/attachment.pgp


More information about the freebsd-net mailing list