From owner-svn-src-all@freebsd.org Wed Sep 11 03:25:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6705CEC7FD; Wed, 11 Sep 2019 03:25:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46SnNC23Kvz4MMM; Wed, 11 Sep 2019 03:25:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1863B3; Wed, 11 Sep 2019 03:25:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8B3PVj1010086; Wed, 11 Sep 2019 03:25:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8B3PUtB010085; Wed, 11 Sep 2019 03:25:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909110325.x8B3PUtB010085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 11 Sep 2019 03:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352201 - in head/sys/cam: . scsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/cam: . scsi X-SVN-Commit-Revision: 352201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2019 03:25:31 -0000 Author: mav Date: Wed Sep 11 03:25:30 2019 New Revision: 352201 URL: https://svnweb.freebsd.org/changeset/base/352201 Log: Fix assumptions of only one device per SES slot. It is typical to have one, but no longer true for multi-actuator HDDs with separate LUN for each actuator. MFC after: 4 days Sponsored by: iXsystems, Inc. Modified: head/sys/cam/cam_periph.c head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Tue Sep 10 23:51:46 2019 (r352200) +++ head/sys/cam/cam_periph.c Wed Sep 11 03:25:30 2019 (r352201) @@ -402,7 +402,9 @@ retry: } xpt_unlock_buses(); sbuf_finish(&local_sb); - sbuf_cpy(sb, sbuf_data(&local_sb)); + if (sbuf_len(sb) != 0) + sbuf_cat(sb, ","); + sbuf_cat(sb, sbuf_data(&local_sb)); sbuf_delete(&local_sb); return (count); } Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Tue Sep 10 23:51:46 2019 (r352200) +++ head/sys/cam/scsi/scsi_enc_ses.c Wed Sep 11 03:25:30 2019 (r352201) @@ -883,6 +883,7 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele struct device_match_result *device_match; struct device_match_pattern *device_pattern; ses_path_iter_args_t *args; + struct cam_path *path; args = (ses_path_iter_args_t *)arg; match_pattern.type = DEV_MATCH_DEVICE; @@ -908,23 +909,26 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele cdm.match_buf_len = sizeof(match_result); cdm.matches = &match_result; - xpt_action((union ccb *)&cdm); - xpt_free_path(cdm.ccb_h.path); + do { + xpt_action((union ccb *)&cdm); - if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP - || (cdm.status != CAM_DEV_MATCH_LAST - && cdm.status != CAM_DEV_MATCH_MORE) - || cdm.num_matches == 0) - return; + if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP || + (cdm.status != CAM_DEV_MATCH_LAST && + cdm.status != CAM_DEV_MATCH_MORE) || + cdm.num_matches == 0) + break; - device_match = &match_result.result.device_result; - if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, - device_match->path_id, - device_match->target_id, - device_match->target_lun) != CAM_REQ_CMP) - return; + device_match = &match_result.result.device_result; + if (xpt_create_path(&path, /*periph*/NULL, + device_match->path_id, + device_match->target_id, + device_match->target_lun) == CAM_REQ_CMP) { - args->callback(enc, elem, cdm.ccb_h.path, args->callback_arg); + args->callback(enc, elem, path, args->callback_arg); + + xpt_free_path(path); + } + } while (cdm.status == CAM_DEV_MATCH_MORE); xpt_free_path(cdm.ccb_h.path); }