summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-07-15 18:17:31 +0000
committermav <mav@FreeBSD.org>2013-07-15 18:17:31 +0000
commit1f49e221e7839234da418c5e13c0af79dddc4c41 (patch)
tree4a09e31498b06704d29bd9d57a04692603291f00 /sys/cam
parentb8930f9894200728d68dab5751a9611333d3caba (diff)
downloadFreeBSD-src-1f49e221e7839234da418c5e13c0af79dddc4c41.zip
FreeBSD-src-1f49e221e7839234da418c5e13c0af79dddc4c41.tar.gz
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().
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_periph.c14
-rw-r--r--sys/cam/cam_xpt.c11
-rw-r--r--sys/cam/scsi/scsi_xpt.c4
3 files changed, 18 insertions, 11 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 8d0d470..ef0f5a7 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -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");
}
}
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 3511265..8f2c93e 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -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);
diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c
index 9269f36..609742b 100644
--- a/sys/cam/scsi/scsi_xpt.c
+++ b/sys/cam/scsi/scsi_xpt.c
@@ -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;
OpenPOWER on IntegriCloud