Module Name:    src
Committed By:   snj
Date:           Thu Jul 30 15:53:39 UTC 2015

Modified Files:
        src/sys/dev/ic [netbsd-7]: mpt_netbsd.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #910):
        sys/dev/ic/mpt_netbsd.c: revision 1.32
Adapter leaks requests when mpt_event_notify_reply() has to acknowledge
an event leading to "adapter resource shortage" messages when the scsipi
subsystem tries to use all adapt_openings.
Change mpt_ctlop() to free the request on event MPI_FUNCTION_EVENT_ACK.
Tested on a SunFire X4275 with Symbios Logic SAS1068E (1000:0058, rev. 4).


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.1 -r1.25.2.2 src/sys/dev/ic/mpt_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.25.2.1 src/sys/dev/ic/mpt_netbsd.c:1.25.2.2
--- src/sys/dev/ic/mpt_netbsd.c:1.25.2.1	Mon Sep 29 16:15:58 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Thu Jul 30 15:53:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.25.2.2 2015/07/30 15:53:39 snj Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25.2.2 2015/07/30 15:53:39 snj Exp $");
 
 #include "bio.h"
 
@@ -1270,8 +1270,16 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, 
 		break;
 
 	case MPI_FUNCTION_EVENT_ACK:
+	    {
+		MSG_EVENT_ACK_REPLY *msg = vmsg;
+		int index = le32toh(msg->MsgContext) & ~0x80000000;
 		mpt_free_reply(mpt, (reply << 1));
+		if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) {
+			request_t *req = &mpt->request_pool[index];
+			mpt_free_request(mpt, req);
+		}
 		break;
+	    }
 
 	case MPI_FUNCTION_PORT_ENABLE:
 	    {

Reply via email to