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().
This commit is contained in:
Alexander Motin 2013-07-15 18:17:31 +00:00
parent d993ba1291
commit e5736ac88c
3 changed files with 18 additions and 11 deletions

View File

@ -1770,13 +1770,17 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
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");
}
}

View File

@ -3900,10 +3900,13 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
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);

View File

@ -1881,8 +1881,8 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
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;