[Midnightbsd-cvs] src [8227] trunk/sys/cam/cam_queue.c: Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Sep 17 16:30:49 EDT 2016


Revision: 8227
          http://svnweb.midnightbsd.org/src/?rev=8227
Author:   laffer1
Date:     2016-09-17 16:30:48 -0400 (Sat, 17 Sep 2016)
Log Message:
-----------
Increase device CCB queue array size by CAM_RL_VALUES - 1 (4) elements.
It is required to store extra recovery requests in case of bus resets.
On ATA/SATA this fixes assertion panics on HEAD with INVARIANTS enabled or
possible memory corruptions otherwise if timeout/reset happens when device
CCB queue is already full.

Modified Paths:
--------------
    trunk/sys/cam/cam_queue.c

Modified: trunk/sys/cam/cam_queue.c
===================================================================
--- trunk/sys/cam/cam_queue.c	2016-09-17 20:30:17 UTC (rev 8226)
+++ trunk/sys/cam/cam_queue.c	2016-09-17 20:30:48 UTC (rev 8227)
@@ -316,7 +316,8 @@
 	 * same size once the outstanding entries have been processed.
 	 */
 	if (space_left < 0
-	 || camq_resize(&ccbq->queue, new_size) == CAM_REQ_CMP) {
+	 || camq_resize(&ccbq->queue, new_size + (CAM_RL_VALUES - 1)) ==
+	    CAM_REQ_CMP) {
 		ccbq->devq_openings += delta;
 		ccbq->dev_openings += delta;
 		return (CAM_REQ_CMP);
@@ -329,7 +330,7 @@
 cam_ccbq_init(struct cam_ccbq *ccbq, int openings)
 {
 	bzero(ccbq, sizeof(*ccbq));
-	if (camq_init(&ccbq->queue, openings) != 0) {
+	if (camq_init(&ccbq->queue, openings + (CAM_RL_VALUES - 1)) != 0) {
 		return (1);
 	}
 	ccbq->devq_openings = openings;



More information about the Midnightbsd-cvs mailing list