From owner-svn-src-releng@FreeBSD.ORG Mon Oct 6 20:38:56 2014 Return-Path: Delivered-To: svn-src-releng@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E5F7FE5; Mon, 6 Oct 2014 20:38:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 523386C3; Mon, 6 Oct 2014 20:38:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96KcuhX094888; Mon, 6 Oct 2014 20:38:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96KcuIL094887; Mon, 6 Oct 2014 20:38:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410062038.s96KcuIL094887@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 20:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r272669 - releng/10.1/sys/dev/iscsi_initiator X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 20:38:56 -0000 Author: mav Date: Mon Oct 6 20:38:55 2014 New Revision: 272669 URL: https://svnweb.freebsd.org/changeset/base/272669 Log: MFC r272308: Fix old iSCSI initiator to work with new CAM locking. This switches code to using xpt_rescan() routine, irrelevant to locking. Using xpt_action() directly requires knowledge about higher level locks, that SIM does not need to have. This code is obsolete, but that is not a reason to crash. Approved by: re (marius) Modified: releng/10.1/sys/dev/iscsi_initiator/isc_cam.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/dev/iscsi_initiator/isc_cam.c ============================================================================== --- releng/10.1/sys/dev/iscsi_initiator/isc_cam.c Mon Oct 6 18:16:45 2014 (r272668) +++ releng/10.1/sys/dev/iscsi_initiator/isc_cam.c Mon Oct 6 20:38:55 2014 (r272669) @@ -125,7 +125,7 @@ scan_callback(struct cam_periph *periph, debug_called(8); - free(ccb, M_TEMP); + xpt_free_ccb(ccb); if(sp->flags & ISC_SCANWAIT) { sp->flags &= ~ISC_SCANWAIT; @@ -141,30 +141,15 @@ ic_scan(isc_session_t *sp) debug_called(8); sdebug(2, "scanning sid=%d", sp->sid); - if((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { - xdebug("scan failed (can't allocate CCB)"); - return ENOMEM; // XXX - } - sp->flags &= ~ISC_CAMDEVS; sp->flags |= ISC_SCANWAIT; - CAM_LOCK(sp); - if(xpt_create_path(&sp->cam_path, NULL, cam_sim_path(sp->cam_sim), - 0, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { - xdebug("can't create cam path"); - CAM_UNLOCK(sp); - free(ccb, M_TEMP); - return ENODEV; // XXX - } - xpt_setup_ccb(&ccb->ccb_h, sp->cam_path, 5/*priority (low)*/); - ccb->ccb_h.func_code = XPT_SCAN_BUS; + ccb = xpt_alloc_ccb(); + ccb->ccb_h.path = sp->cam_path; ccb->ccb_h.cbfcnp = scan_callback; - ccb->crcn.flags = CAM_FLAG_NONE; ccb->ccb_h.spriv_ptr0 = sp; - xpt_action(ccb); - CAM_UNLOCK(sp); + xpt_rescan(ccb); while(sp->flags & ISC_SCANWAIT) tsleep(sp, PRIBIO, "ffp", 5*hz); // the timeout time should @@ -374,6 +359,16 @@ ic_init(isc_session_t *sp) return ENXIO; } sp->cam_sim = sim; + if(xpt_create_path(&sp->cam_path, NULL, cam_sim_path(sp->cam_sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_bus_deregister(cam_sim_path(sp->cam_sim)); + cam_sim_free(sim, /*free_devq*/TRUE); + CAM_UNLOCK(sp); +#if __FreeBSD_version >= 700000 + mtx_destroy(&sp->cam_mtx); +#endif + return ENXIO; + } CAM_UNLOCK(sp); sdebug(1, "cam subsystem initialized");