svn commit: r302682 - head/sys/dev/ioat

Conrad E. Meyer cem at FreeBSD.org
Tue Jul 12 21:56:56 UTC 2016


Author: cem
Date: Tue Jul 12 21:56:55 2016
New Revision: 302682
URL: https://svnweb.freebsd.org/changeset/base/302682

Log:
  ioat_reserve_space: Recheck quiescing flag after dropping submit lock
  
  Fix a minor bound check error while here (ring can only hold 1 <<
  MAX_ORDER - 1 entries).

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==============================================================================
--- head/sys/dev/ioat/ioat.c	Tue Jul 12 21:56:52 2016	(r302681)
+++ head/sys/dev/ioat/ioat.c	Tue Jul 12 21:56:55 2016	(r302682)
@@ -1382,16 +1382,17 @@ ioat_reserve_space(struct ioat_softc *io
 	error = 0;
 	dug = FALSE;
 
-	if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) {
+	if (num_descs < 1 || num_descs >= (1 << IOAT_MAX_ORDER)) {
 		error = EINVAL;
 		goto out;
 	}
-	if (ioat->quiescing) {
-		error = ENXIO;
-		goto out;
-	}
 
 	for (;;) {
+		if (ioat->quiescing) {
+			error = ENXIO;
+			goto out;
+		}
+
 		if (ioat_get_ring_space(ioat) >= num_descs)
 			goto out;
 
@@ -1453,6 +1454,8 @@ ioat_reserve_space(struct ioat_softc *io
 
 out:
 	mtx_assert(&ioat->submit_lock, MA_OWNED);
+	KASSERT(!ioat->quiescing || error == ENXIO,
+	    ("reserved during quiesce"));
 	return (error);
 }
 


More information about the svn-src-head mailing list