From owner-freebsd-scsi@FreeBSD.ORG Tue Oct 26 16:46:04 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A035106567A for ; Tue, 26 Oct 2010 16:46:04 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id AF9948FC08 for ; Tue, 26 Oct 2010 16:46:03 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA02925; Tue, 26 Oct 2010 19:46:00 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <4CC705C8.9050604@icyb.net.ua> Date: Tue, 26 Oct 2010 19:46:00 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.11) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.5 MIME-Version: 1.0 To: Ryan Stone References: In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-scsi@freebsd.org Subject: Re: camcontrol rescan all fails if there is no bus 0 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Oct 2010 16:46:04 -0000 on 25/10/2010 19:59 Ryan Stone said the following: > If you issue a "camcontrol rescan all" on a system that does not have > scsi bus 0, camcontrol gets a EINVAL from a CAMIOCOMMAND ioctl and > exits after printing an error while trying to do a XPT_DEV_MATCH. > This is because camcontrol passes a bzero'd ccb to the ioctl without > ever setting the path_id, so CAM looks up path 0 and returns EINVAL if > that bus does not exist. > > This is just slightly annoying if there are no CAM devices on the > system. If you had a system with CAM devices, but no bus 0, then > camcontrol rescan all would always fail. I'm not sure if it's > actually possible to skip path 0, though. Oh, I remember this issue: http://thread.gmane.org/gmane.os.freebsd.devel.scsi/4405 > The following patch resolves the issue for me: > Index: camcontrol.c > =================================================================== > --- camcontrol.c (revision 214271) > +++ camcontrol.c (working copy) > @@ -1519,6 +1519,7 @@ rescan_or_reset_bus(int bus, int rescan) > bzero(&(&matchccb.ccb_h)[1], > sizeof(struct ccb_dev_match) - sizeof(struct ccb_hdr)); > matchccb.ccb_h.func_code = XPT_DEV_MATCH; > + matchccb.ccb_h.path_id = CAM_BUS_WILDCARD; > bufsize = sizeof(struct dev_match_result) * 20; > matchccb.cdm.match_buf_len = bufsize; > matchccb.cdm.matches=(struct dev_match_result *)malloc(bufsize); > > > (by the way, should I be using CAM_BUS_WILDCARD or CAM_XPT_PATH_ID? > By the name WILDCARD seems more appropriate but I see that camcontrol > uses CAM_XPT_PATH_ID in getdevtree. -- Andriy Gapon