From owner-svn-src-stable-10@freebsd.org Thu Jun 25 07:08:47 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BDA598C755; Thu, 25 Jun 2015 07:08:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) 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 4CFD318DC; Thu, 25 Jun 2015 07:08:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5P78l9M086958; Thu, 25 Jun 2015 07:08:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5P78lSj086957; Thu, 25 Jun 2015 07:08:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201506250708.t5P78lSj086957@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 25 Jun 2015 07:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r284795 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2015 07:08:47 -0000 Author: mav Date: Thu Jun 25 07:08:46 2015 New Revision: 284795 URL: https://svnweb.freebsd.org/changeset/base/284795 Log: MFC r284641: Fix REPORT LUNS command output for the case when same LUN mapped to same port several times. While it is unusual configuration, it is not illegal. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jun 25 07:07:32 2015 (r284794) +++ stable/10/sys/cam/ctl/ctl.c Thu Jun 25 07:08:46 2015 (r284795) @@ -9452,11 +9452,16 @@ ctl_report_luns(struct ctl_scsiio *ctsio well_known = 0; cdb = (struct scsi_report_luns *)ctsio->cdb; + port = ctl_io_port(&ctsio->io_hdr); CTL_DEBUG_PRINT(("ctl_report_luns\n")); mtx_lock(&softc->ctl_lock); - num_luns = softc->num_luns; + num_luns = 0; + for (targ_lun_id = 0; targ_lun_id < CTL_MAX_LUNS; targ_lun_id++) { + if (ctl_lun_map_from_port(port, targ_lun_id) < CTL_MAX_LUNS) + num_luns++; + } mtx_unlock(&softc->ctl_lock); switch (cdb->select_report) { @@ -9499,7 +9504,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio request_lun = (struct ctl_lun *) ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - port = ctl_io_port(&ctsio->io_hdr); lun_datalen = sizeof(*lun_data) + (num_luns * sizeof(struct scsi_report_luns_lundata));