From owner-svn-src-all@FreeBSD.ORG Sat Oct 13 17:55:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BDC80193; Sat, 13 Oct 2012 17:55:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DFC98FC14; Sat, 13 Oct 2012 17:55:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9DHt7Z8074670; Sat, 13 Oct 2012 17:55:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9DHt7TA074668; Sat, 13 Oct 2012 17:55:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201210131755.q9DHt7TA074668@svn.freebsd.org> From: Alexander Motin Date: Sat, 13 Oct 2012 17:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241508 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 13 Oct 2012 17:55:07 -0000 Author: mav Date: Sat Oct 13 17:55:06 2012 New Revision: 241508 URL: http://svn.freebsd.org/changeset/base/241508 Log: Extend SIM lock coverage during the bus registration process. Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Oct 13 14:45:42 2012 (r241507) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Oct 13 17:55:06 2012 (r241508) @@ -175,8 +175,8 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_frontend_register() failed with error %d!\n", __func__, retval); - retval = 1; - goto bailout; + mtx_destroy(&softc->lock); + return (1); } /* @@ -207,7 +207,7 @@ cfcs_init(void) softc->wwpn = fe->wwpn; } - + mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(fe->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -224,9 +224,7 @@ cfcs_init(void) goto bailout; } - mtx_lock(&softc->lock); if (xpt_bus_register(softc->sim, NULL, 0) != CAM_SUCCESS) { - mtx_unlock(&softc->lock); printf("%s: error registering SIM\n", __func__); retval = ENOMEM; goto bailout; @@ -236,15 +234,12 @@ cfcs_init(void) cam_sim_path(softc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - mtx_unlock(&softc->lock); printf("%s: error creating path\n", __func__); xpt_bus_deregister(cam_sim_path(softc->sim)); retval = 1; goto bailout; } - mtx_unlock(&softc->lock); - xpt_setup_ccb(&csa.ccb_h, softc->path, /*priority*/ 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; @@ -252,6 +247,8 @@ cfcs_init(void) csa.callback_arg = softc->sim; xpt_action((union ccb *)&csa); + mtx_unlock(&softc->lock); + return (retval); bailout: @@ -259,6 +256,8 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); + mtx_unlock(&softc->lock); + mtx_destroy(&softc->lock); return (retval); }