Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jun 2015 13:02:57 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284641 - head/sys/cam/ctl
Message-ID:  <201506201302.t5KD2vNH033067@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Jun 20 13:02:57 2015
New Revision: 284641
URL: https://svnweb.freebsd.org/changeset/base/284641

Log:
  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.
  
  MFC after:	1 week

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Sat Jun 20 12:43:54 2015	(r284640)
+++ head/sys/cam/ctl/ctl.c	Sat Jun 20 13:02:57 2015	(r284641)
@@ -9348,11 +9348,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) {
@@ -9395,7 +9400,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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506201302.t5KD2vNH033067>