Author: mav
Date: Fri Sep 13 15:48:11 2019
New Revision: 352298
URL: https://svnweb.freebsd.org/changeset/base/352298

Log:
  MFC r352201: 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.

Modified:
  stable/12/sys/cam/cam_periph.c
  stable/12/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_periph.c
==============================================================================
--- stable/12/sys/cam/cam_periph.c      Fri Sep 13 15:21:36 2019        
(r352297)
+++ stable/12/sys/cam/cam_periph.c      Fri Sep 13 15:48:11 2019        
(r352298)
@@ -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: stable/12/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- stable/12/sys/cam/scsi/scsi_enc_ses.c       Fri Sep 13 15:21:36 2019        
(r352297)
+++ stable/12/sys/cam/scsi/scsi_enc_ses.c       Fri Sep 13 15:48:11 2019        
(r352298)
@@ -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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to