diff options
author | mav <mav@FreeBSD.org> | 2015-06-20 13:02:57 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-06-20 13:02:57 +0000 |
commit | cb167b45a82327b0d6d88e85e3d6e2e326291ee4 (patch) | |
tree | b8cb13eee338f60cee345271b5a5a83a87b300a3 | |
parent | af681a3020b9e04a4415de9a2d00fbcd2eb3047e (diff) | |
download | FreeBSD-src-cb167b45a82327b0d6d88e85e3d6e2e326291ee4.zip FreeBSD-src-cb167b45a82327b0d6d88e85e3d6e2e326291ee4.tar.gz |
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
-rw-r--r-- | sys/cam/ctl/ctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 652dfd4..3d562d0 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -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)); |