From owner-p4-projects@FreeBSD.ORG Sat May 14 17:40:52 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 347881065670; Sat, 14 May 2011 17:40:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBE1F106566B for ; Sat, 14 May 2011 17:40:51 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id BEECB8FC17 for ; Sat, 14 May 2011 17:40:51 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EHepCv098513 for ; Sat, 14 May 2011 17:40:51 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p4EHepib098509 for perforce@freebsd.org; Sat, 14 May 2011 17:40:51 GMT (envelope-from mjacob@freebsd.org) Date: Sat, 14 May 2011 17:40:51 GMT Message-Id: <201105141740.p4EHepib098509@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 193136 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 17:40:52 -0000 http://p4web.freebsd.org/@@193136?ac=10 Change 193136 by mjacob@mjacob-sandbox on 2011/05/14 17:39:58 Sync up mpt2sas Affected files ... .. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#5 edit .. //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#5 edit Differences ... ==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.c#5 (text+ko) ==== @@ -1068,18 +1068,21 @@ if (dp->AttachedDevHandle == 0) { return (0); } + if (dp->state == DRAINING) { + mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: handle 0x%x already draining\n", __func__, hdl); + return (0); + } KASSERT(hdl == dp->AttachedDevHandle, ("%s: oops2", __func__)); if (dp->internal_tm_bsy) { mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: internal task management busy for handle 0x%x- retrying\n", __func__, hdl); return (EBUSY); } - nreq = dp->active; req = mpt2sas_get_request(mpt); if (req == NULL) { mpt2sas_prt(mpt, MP2PRT_ERR, "%s: cannot allocate request\n", __func__); return (ENOBUFS); } - dp->destroy_needed = 1; + dp->state = DRAINING; req->flags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; reset = MPT2_REQ2RQS(mpt, req); memset(reset, 0, sizeof (MPI2_SCSI_TASK_MANAGE_REQUEST)); @@ -1088,12 +1091,15 @@ reset->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET; mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: sending target reset for handle 0x%x\n", __func__, hdl); mpt2sas_send_cmd(mpt, req); + nreq = dp->active; error = mpt2sas_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, 10000); MPT2SAS_SYNC_ERR_NORET(mpt, error); mpt2sas_prt(mpt, MP2PRT_CONFIG, "%s: %d requests were still in play at reset target reset time, %s mpt2sas_destroy_dev_part2\n", __func__, nreq, - (nreq == 0 && dp->destroy_needed)? "calling" : "*not* calling"); - if (nreq == 0 && dp->destroy_needed) { + dp->active? "calling" : "*not* calling"); + if (dp->active == 0) { mpt2sas_destroy_dev_part2(dp); + } else { + dp->destroy_needed = 1; } return (0); } ==== //depot/projects/mjacob-dev/sys/dev/mpt2sas/mpt2sas.h#5 (text+ko) ==== @@ -362,7 +362,7 @@ set_qfull : 1; uint16_t active; uint16_t qdepth; - enum { NIL, NEW, ATTACHING, VALIDATING, VALIDATING_DONE, STABLE, FAILED, DETACHING } state; + enum { NIL, NEW, ATTACHING, VALIDATING, VALIDATING_DONE, STABLE, FAILED, DRAINING, DETACHING } state; }; #define ClearSasDev(x) \ (x)->AttachedDevHandle = 0; \