svn commit: r241469 - head/sys/dev/virtio

Peter Grehan grehan at FreeBSD.org
Thu Oct 11 23:03:43 UTC 2012


Author: grehan
Date: Thu Oct 11 23:03:42 2012
New Revision: 241469
URL: http://svn.freebsd.org/changeset/base/241469

Log:
  Patch from Bryan to fix a virtqueue issue:
  
      virtqueue: Fix non-indirect virtqueues
  
      We really must walk the entire descriptor chain in order
      to append the to be free'd chain to the existing free
      chain.
  
  Submitted by:	Bryan Venteicher (bryanv at daemoninthecloset.org)
  Reported by:	cognet

Modified:
  head/sys/dev/virtio/virtqueue.c

Modified: head/sys/dev/virtio/virtqueue.c
==============================================================================
--- head/sys/dev/virtio/virtqueue.c	Thu Oct 11 23:02:35 2012	(r241468)
+++ head/sys/dev/virtio/virtqueue.c	Thu Oct 11 23:03:42 2012	(r241469)
@@ -780,8 +780,8 @@ vq_ring_free_chain(struct virtqueue *vq,
 		VQ_RING_ASSERT_CHAIN_TERM(vq);
 
 	vq->vq_free_cnt += dxp->ndescs;
+	dxp->ndescs--;
 
-#ifdef INVARIANTS
 	if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) {
 		while (dp->flags & VRING_DESC_F_NEXT) {
 			VQ_RING_ASSERT_VALID_IDX(vq, dp->next);
@@ -789,10 +789,9 @@ vq_ring_free_chain(struct virtqueue *vq,
 			dxp->ndescs--;
 		}
 	}
-	VQASSERT(vq, dxp->ndescs == 1,
+
+	VQASSERT(vq, dxp->ndescs == 0,
 	    "failed to free entire desc chain, remaining: %d", dxp->ndescs);
-#endif
-	dxp->ndescs = 0;
 
 	/*
 	 * We must append the existing free chain, if any, to the end of


More information about the svn-src-head mailing list