From owner-svn-src-all@FreeBSD.ORG Thu May 21 12:36:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDF64106566C; Thu, 21 May 2009 12:36:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAD578FC12; Thu, 21 May 2009 12:36:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4LCae3Z066867; Thu, 21 May 2009 12:36:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4LCaeDN066866; Thu, 21 May 2009 12:36:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905211236.n4LCaeDN066866@svn.freebsd.org> From: John Baldwin Date: Thu, 21 May 2009 12:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192534 - head/sys/dev/mpt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 12:36:41 -0000 Author: jhb Date: Thu May 21 12:36:40 2009 New Revision: 192534 URL: http://svn.freebsd.org/changeset/base/192534 Log: Largely revert the earlier change to use a single CCB for the RAID recovery thread. Multiple RAID events in quick succession can cause an additional bus rescan to be scheduled before an earlier scan has completed. In this case the driver was attempting to use the same CCB storage for two requests. PR: kern/130330 Reviewed by: Riccardo Torrini riccardo.torrini | esaote com MFC after: 1 week Modified: head/sys/dev/mpt/mpt_raid.c Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Thu May 21 12:05:15 2009 (r192533) +++ head/sys/dev/mpt/mpt_raid.c Thu May 21 12:36:40 2009 (r192534) @@ -658,19 +658,19 @@ mpt_terminate_raid_thread(struct mpt_sof static void mpt_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb) { + xpt_free_path(ccb->ccb_h.path); + xpt_free_ccb(ccb); } static void mpt_raid_thread(void *arg) { struct mpt_softc *mpt; - union ccb *ccb; int firstrun; mpt = (struct mpt_softc *)arg; firstrun = 1; - ccb = xpt_alloc_ccb(); MPT_LOCK(mpt); while (mpt->shutdwn_raid == 0) { @@ -698,15 +698,21 @@ mpt_raid_thread(void *arg) } if (mpt->raid_rescan != 0) { + union ccb *ccb; struct cam_path *path; int error; mpt->raid_rescan = 0; + MPT_UNLOCK(mpt); + ccb = xpt_alloc_ccb(); + + MPT_LOCK(mpt); error = xpt_create_path(&path, xpt_periph, cam_sim_path(mpt->phydisk_sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); if (error != CAM_REQ_CMP) { + xpt_free_ccb(ccb); mpt_prt(mpt, "Unable to rescan RAID Bus!\n"); } else { xpt_setup_ccb(&ccb->ccb_h, path, 5); @@ -719,7 +725,6 @@ mpt_raid_thread(void *arg) } } } - xpt_free_ccb(ccb); mpt->raid_thread = NULL; wakeup(&mpt->raid_thread); MPT_UNLOCK(mpt);