Date: Sun, 10 Mar 2019 23:05:38 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344987 - head/sys/dev/smartpqi Message-ID: <201903102305.x2AN5c4s017775@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sun Mar 10 23:05:38 2019 New Revision: 344987 URL: https://svnweb.freebsd.org/changeset/base/344987 Log: Fix crash in low memory conditions. Usual backtrace looked like this: pqisrc_build_sgl() at pqisrc_build_sgl+0x8d/frame 0xfffffe009e8b7a00 pqisrc_build_raid_io() at pqisrc_build_raid_io+0x231/frame 0xfffffe009e8b7a40 pqisrc_build_send_io() at pqisrc_build_send_io+0x375/frame 0xfffffe009e8b7b00 pqi_request_map_helper() at pqi_request_map_helper+0x282/frame 0xfffffe009e8b7ba0 bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0xd7/frame 0xfffffe009e8b7c00 pqi_map_request() at pqi_map_request+0x9b/frame 0xfffffe009e8b7c70 pqisrc_io_start() at pqisrc_io_start+0x55c/frame 0xfffffe009e8b7d50 smartpqi_cam_action() at smartpqi_cam_action+0xb8/frame 0xfffffe009e8b7de0 xpt_run_devq() at xpt_run_devq+0x30a/frame 0xfffffe009e8b7e40 xpt_action_default() at xpt_action_default+0x94b/frame 0xfffffe009e8b7e90 dastart() at dastart+0x33b/frame 0xfffffe009e8b7ee0 xpt_run_allocq() at xpt_run_allocq+0x1a2/frame 0xfffffe009e8b7f30 dastrategy() at dastrategy+0x71/frame 0xfffffe009e8b7f60 g_disk_start() at g_disk_start+0x351/frame 0xfffffe009e8b7fc0 g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b8010 g_part_start() at g_part_start+0x120/frame 0xfffffe009e8b8090 g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b80e0 zio_vdev_io_start() at zio_vdev_io_start+0x4b2/frame 0xfffffe009e8b8140 zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8180 zio_nowait() at zio_nowait+0xc4/frame 0xfffffe009e8b81b0 vdev_queue_io_done() at vdev_queue_io_done+0x138/frame 0xfffffe009e8b81f0 zio_vdev_io_done() at zio_vdev_io_done+0x151/frame 0xfffffe009e8b8220 zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8260 taskqueue_run_locked() at taskqueue_run_locked+0x10c/frame 0xfffffe009e8b82c0 taskqueue_thread_loop() at taskqueue_thread_loop+0x88/frame 0xfffffe009e8b82f0 fork_exit() at fork_exit+0x84/frame 0xfffffe009e8b8330 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe009e8b8330 Reviewed by: deepak.ukey_microsemi.com, sbruno MFC after: 2 weeks Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D19470 Modified: head/sys/dev/smartpqi/smartpqi_cam.c Modified: head/sys/dev/smartpqi/smartpqi_cam.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_cam.c Sun Mar 10 21:43:13 2019 (r344986) +++ head/sys/dev/smartpqi/smartpqi_cam.c Sun Mar 10 23:05:38 2019 (r344987) @@ -483,13 +483,21 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s } 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); + DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); + pqi_unmap_request(rcb); + xpt_done((union ccb *)rcb->cm_ccb); + return; + } + rcb->nseg = nseg; - if (rcb->sgt != NULL) { - for (int i = 0; i < nseg; i++) { - rcb->sgt[i].addr = segs[i].ds_addr; - rcb->sgt[i].len = segs[i].ds_len; - rcb->sgt[i].flags = 0; - } + for (int i = 0; i < nseg; i++) { + rcb->sgt[i].addr = segs[i].ds_addr; + rcb->sgt[i].len = segs[i].ds_len; + rcb->sgt[i].flags = 0; } if (rcb->data_dir == SOP_DATA_DIR_FROM_DEVICE)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903102305.x2AN5c4s017775>