svn commit: r253370 - in head/sys/cam: . scsi
Alexander Motin
mav at FreeBSD.org
Mon Jul 15 18:17:33 UTC 2013
Author: mav
Date: Mon Jul 15 18:17:31 2013
New Revision: 253370
URL: http://svnweb.freebsd.org/changeset/base/253370
Log:
Make some improvements to r253322 to really rescan target, not a bus.
Add there and in two more places checks for NULL on xpt_alloc_ccb_nowait().
Modified:
head/sys/cam/cam_periph.c
head/sys/cam/cam_xpt.c
head/sys/cam/scsi/scsi_xpt.c
Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c Mon Jul 15 18:02:26 2013 (r253369)
+++ head/sys/cam/cam_periph.c Mon Jul 15 18:17:31 2013 (r253370)
@@ -1770,13 +1770,17 @@ cam_periph_error(union ccb *ccb, cam_fla
if (xpt_create_path(&newpath, NULL,
xpt_path_path_id(ccb->ccb_h.path),
xpt_path_target_id(ccb->ccb_h.path),
- -1) == CAM_REQ_CMP) {
+ CAM_LUN_WILDCARD) == CAM_REQ_CMP) {
scan_ccb = xpt_alloc_ccb_nowait();
- scan_ccb->ccb_h.path = newpath;
- scan_ccb->ccb_h.func_code = XPT_SCAN_BUS;
- scan_ccb->crcn.flags = 0;
- xpt_rescan(scan_ccb);
+ if (scan_ccb != NULL) {
+ scan_ccb->ccb_h.path = newpath;
+ scan_ccb->ccb_h.func_code = XPT_SCAN_TGT;
+ scan_ccb->crcn.flags = 0;
+ xpt_rescan(scan_ccb);
+ } else
+ xpt_print(newpath,
+ "Can't allocate CCB to rescan target\n");
}
}
Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c Mon Jul 15 18:02:26 2013 (r253369)
+++ head/sys/cam/cam_xpt.c Mon Jul 15 18:17:31 2013 (r253370)
@@ -3900,10 +3900,13 @@ xpt_bus_register(struct cam_sim *sim, de
xpt_async(AC_PATH_REGISTERED, path, &cpi);
/* Initiate bus rescan. */
scan_ccb = xpt_alloc_ccb_nowait();
- scan_ccb->ccb_h.path = path;
- scan_ccb->ccb_h.func_code = XPT_SCAN_BUS;
- scan_ccb->crcn.flags = 0;
- xpt_rescan(scan_ccb);
+ if (scan_ccb != NULL) {
+ scan_ccb->ccb_h.path = path;
+ scan_ccb->ccb_h.func_code = XPT_SCAN_BUS;
+ scan_ccb->crcn.flags = 0;
+ xpt_rescan(scan_ccb);
+ } else
+ xpt_print(path, "Can't allocate CCB to scan bus\n");
} else
xpt_free_path(path);
return (CAM_SUCCESS);
Modified: head/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- head/sys/cam/scsi/scsi_xpt.c Mon Jul 15 18:02:26 2013 (r253369)
+++ head/sys/cam/scsi/scsi_xpt.c Mon Jul 15 18:17:31 2013 (r253370)
@@ -1881,8 +1881,8 @@ scsi_scan_bus(struct cam_periph *periph,
if ((work_ccb->cpi.hba_inquiry &
(PI_WIDE_32|PI_WIDE_16|PI_SDTR_ABLE)) &&
!(work_ccb->cpi.hba_misc & PIM_NOBUSRESET) &&
- !timevalisset(&request_ccb->ccb_h.path->bus->last_reset)) {
- reset_ccb = xpt_alloc_ccb_nowait();
+ !timevalisset(&request_ccb->ccb_h.path->bus->last_reset) &&
+ (reset_ccb = xpt_alloc_ccb_nowait()) != NULL) {
xpt_setup_ccb(&reset_ccb->ccb_h, request_ccb->ccb_h.path,
CAM_PRIORITY_NONE);
reset_ccb->ccb_h.func_code = XPT_RESET_BUS;
More information about the svn-src-head
mailing list