diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2019-03-26 15:47:13 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2019-03-26 15:47:13 +0000 |
commit | 7000d321e8619f9a2962e4a011d2c3d86307e852 (patch) | |
tree | 312a4ca3ef62cc080602430df876a70ab03f3758 /sys/dev/smartpqi | |
parent | fd5795b23a9c129b053a6ca2c4801102303efb50 (diff) | |
download | src-7000d321e8619f9a2962e4a011d2c3d86307e852.tar.gz src-7000d321e8619f9a2962e4a011d2c3d86307e852.zip |
Make smartpqi(4) behave better when running out of memory, by returning
CAM_RESRC_UNAVAIL instead of CAM_REQUEUE_REQ. This makes CAM delay a bit
before retrying, so that the retries actually get a chance to succeed.
Reviewed by: sbruno
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19696
Notes
Notes:
svn path=/head/; revision=345549
Diffstat (limited to 'sys/dev/smartpqi')
-rw-r--r-- | sys/dev/smartpqi/smartpqi_cam.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/smartpqi/smartpqi_cam.c b/sys/dev/smartpqi/smartpqi_cam.c index 343b70540a53..e9795ea14a39 100644 --- a/sys/dev/smartpqi/smartpqi_cam.c +++ b/sys/dev/smartpqi/smartpqi_cam.c @@ -458,6 +458,15 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_info_elem_t *err_info) DBG_IO("OUT\n"); } +static void +pqi_freeze_ccb(union ccb *ccb) +{ + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } +} + /* * Command-mapping helper function - populate this command's s/g table. */ @@ -472,9 +481,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) if( error || nseg > softs->pqi_cap.max_sg_elem ) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); pqi_unmap_request(rcb); @@ -484,9 +492,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); if (rcb->sgt == NULL) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb); @@ -514,9 +521,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) if (error) { rcb->req_pending = false; - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ - |CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb); |