More umass problems.

Matthew Dillon dillon at apollo.backplane.com
Thu Mar 11 13:52:40 PST 2004


:On Thu, 11 Mar 2004, Matthew Dillon wrote:
:
:>
:> :> Here's that backtrace you wanted:
:> :
:> :> http://memory.visualtech.com/dbsd-boot-log.txt
:> :
:> :Was that any help in tracking down the bug?
:> :
:> :Adam
:>
:>     Sorry, I'm now officially overloaded with work :-)
:
:No need to apologize.  We all get like that at times :-)
:
:>     Lets see... yes, that sure does.  It's a case of a timeout being
:>     installed and the device going away before the timeout occurs.
:>
:>     Could you please try the follow patch?  It fixes one bug, but the bug
:>     is not likely responsible for your panic, and it adds a debugging
:>     printf that will help me diagnose the problem if the panic still occurs.
:
:Done.  Check out the same URL again.
:
:Adam

    Try this patch.   I still haven't found a smoking gun, but I
    suspect that a temporary malloc failure could have caused the
    umass code to deregister the SCSI target twice.

						-Matt

Index: cam_extend.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/cam_extend.c,v
retrieving revision 1.3
diff -u -r1.3 cam_extend.c
--- cam_extend.c	7 Aug 2003 21:16:44 -0000	1.3
+++ cam_extend.c	11 Mar 2004 21:39:42 -0000
@@ -40,7 +40,7 @@
 static void *
 cam_extend_alloc(size_t s)
 {
-	void *p = malloc(s, M_DEVBUF, M_NOWAIT);
+	void *p = malloc(s, M_DEVBUF, M_WAITOK);
 	if (!p)
 		panic("extend_alloc: malloc failed.");
 	return p;
Index: cam_periph.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/cam_periph.c,v
retrieving revision 1.7
diff -u -r1.7 cam_periph.c
--- cam_periph.c	30 Jan 2004 05:42:09 -0000	1.7
+++ cam_periph.c	11 Mar 2004 21:39:56 -0000
@@ -105,8 +105,7 @@
 		return (CAM_REQ_INVALID);
 	}
 	
-	periph = (struct cam_periph *)malloc(sizeof(*periph), M_DEVBUF,
-					     M_NOWAIT);
+	periph = malloc(sizeof(*periph), M_DEVBUF, M_WAITOK);
 
 	if (periph == NULL)
 		return (CAM_RESRC_UNAVAIL);
Index: cam_queue.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/cam_queue.c,v
retrieving revision 1.3
diff -u -r1.3 cam_queue.c
--- cam_queue.c	7 Aug 2003 21:16:44 -0000	1.3
+++ cam_queue.c	11 Mar 2004 21:41:08 -0000
@@ -51,7 +51,7 @@
 {
 	struct camq *camq;
 
-	camq = (struct camq *)malloc(sizeof(*camq), M_DEVBUF, M_NOWAIT);
+	camq = malloc(sizeof(*camq), M_DEVBUF, M_WAITOK);
 	if (camq != NULL) {
 		if (camq_init(camq, size) != 0) {
 			free(camq, M_DEVBUF);
@@ -67,8 +67,8 @@
 	bzero(camq, sizeof(*camq));
 	camq->array_size = size;
 	if (camq->array_size != 0) {
-		camq->queue_array = (cam_pinfo**)malloc(size*sizeof(cam_pinfo*),
-							M_DEVBUF, M_NOWAIT);
+		camq->queue_array = malloc(size*sizeof(cam_pinfo*), M_DEVBUF,
+						M_WAITOK);
 		if (camq->queue_array == NULL) {
 			printf("camq_init: - cannot malloc array!\n");
 			return (1);
@@ -120,8 +120,7 @@
 		panic("camq_resize: New queue size can't accomodate "
 		      "queued entries.");
 #endif
-	new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *),
-					 M_DEVBUF, M_NOWAIT);
+	new_array = malloc(new_size * sizeof(cam_pinfo *), M_DEVBUF, M_WAITOK);
 	if (new_array == NULL) {
 		/* Couldn't satisfy request */
 		return (CAM_RESRC_UNAVAIL);
@@ -209,7 +208,7 @@
 {
 	struct cam_devq *devq;
 
-	devq = (struct cam_devq *)malloc(sizeof(*devq), M_DEVBUF, M_NOWAIT);
+	devq = malloc(sizeof(*devq), M_DEVBUF, M_WAITOK);
 	if (devq == NULL) {
 		printf("cam_devq_alloc: - cannot malloc!\n");
 		return (NULL);
@@ -266,7 +265,7 @@
 {
 	struct cam_ccbq *ccbq;
 
-	ccbq = (struct cam_ccbq *)malloc(sizeof(*ccbq), M_DEVBUF, M_NOWAIT);
+	ccbq = malloc(sizeof(*ccbq), M_DEVBUF, M_WAITOK);
 	if (ccbq == NULL) {
 		printf("cam_ccbq_alloc: - cannot malloc!\n");
 		return (NULL);
Index: cam_sim.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/cam_sim.c,v
retrieving revision 1.4
diff -u -r1.4 cam_sim.c
--- cam_sim.c	7 Aug 2003 21:16:44 -0000	1.4
+++ cam_sim.c	11 Mar 2004 21:42:25 -0000
@@ -60,7 +60,12 @@
 {
 	struct cam_sim *sim;
 
+	sim = malloc(sizeof(struct cam_sim), M_DEVBUF, M_WAITOK);
+#if 0
 	/*
+	 * XXX REMOVED, this is ridiculous, you don't make memory allocations
+	 * optional if the caller can't handle the failure gracefully.
+	 &
 	 * If this is the xpt layer creating a sim, then it's OK
 	 * to wait for an allocation.
 	 *
@@ -72,6 +77,7 @@
 	else
 		sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
 					       M_DEVBUF, M_NOWAIT);
+#endif
 
 	if (sim != NULL) {
 		sim->sim_action = sim_action;
Index: cam_xpt.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/cam_xpt.c,v
retrieving revision 1.9
diff -u -r1.9 cam_xpt.c
--- cam_xpt.c	30 Jan 2004 05:42:09 -0000	1.9
+++ cam_xpt.c	11 Mar 2004 21:51:58 -0000
@@ -1359,9 +1359,8 @@
 	/*
 	 * Register a callback for when interrupts are enabled.
 	 */
-	xpt_config_hook =
-	    (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook),
-					      M_TEMP, M_NOWAIT | M_ZERO);
+	xpt_config_hook = malloc(sizeof(struct intr_config_hook),
+				  M_TEMP, M_WAITOK | M_ZERO);
 	if (xpt_config_hook == NULL) {
 		printf("xpt_init: Cannot malloc config hook "
 		       "- failing attach\n");
@@ -3191,7 +3190,7 @@
 			}
 		} else {
 			cur_entry = malloc(sizeof(*cur_entry), M_DEVBUF,
-					   M_NOWAIT);
+					   M_WAITOK);
 			if (cur_entry == NULL) {
 				splx(s);
 				csa->ccb_h.status = CAM_RESRC_UNAVAIL;
@@ -3791,7 +3790,7 @@
 	struct	   cam_path *path;
 	cam_status status;
 
-	path = (struct cam_path *)malloc(sizeof(*path), M_DEVBUF, M_NOWAIT);
+	path = malloc(sizeof(*path), M_DEVBUF, M_WAITOK);
 
 	if (path == NULL) {
 		status = CAM_RESRC_UNAVAIL;
@@ -4070,8 +4069,7 @@
 	int s;
 
 	sim->bus_id = bus;
-	new_bus = (struct cam_eb *)malloc(sizeof(*new_bus),
-					  M_DEVBUF, M_NOWAIT);
+	new_bus = malloc(sizeof(*new_bus), M_DEVBUF, M_WAITOK);
 	if (new_bus == NULL) {
 		/* Couldn't satisfy request */
 		return (CAM_RESRC_UNAVAIL);
@@ -4593,7 +4591,7 @@
 
 	s = splsoftcam();
 	if ((new_ccb = (union ccb *)ccb_freeq.slh_first) == NULL) {
-		new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_NOWAIT);
+		new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_WAITOK);
                 if (new_ccb == NULL) {
 			splx(s);
 			return (NULL);
@@ -4615,6 +4613,8 @@
 	int s;
 
 	s = splcam();
+	printf("xpt_release_bus(%p): %d %p\n", 
+		bus, bus->refcount, TAILQ_FIRST(&bus->et_entries));
 	if ((--bus->refcount == 0)
 	 && (TAILQ_FIRST(&bus->et_entries) == NULL)) {
 		TAILQ_REMOVE(&xpt_busses, bus, links);
@@ -4630,7 +4630,7 @@
 {
 	struct cam_et *target;
 
-	target = (struct cam_et *)malloc(sizeof(*target), M_DEVBUF, M_NOWAIT);
+	target = malloc(sizeof(*target), M_DEVBUF, M_WAITOK);
 	if (target != NULL) {
 		struct cam_et *cur_target;
 
@@ -4667,6 +4667,9 @@
 	int s;
 
 	s = splcam();
+	printf("xpt_release_target(%p,%p): %d %p\n", 
+		bus, target, 
+		target->refcount, TAILQ_FIRST(&target->ed_entries));
 	if ((--target->refcount == 0)
 	 && (TAILQ_FIRST(&target->ed_entries) == NULL)) {
 		TAILQ_REMOVE(&bus->et_entries, target, links);
@@ -4692,8 +4695,7 @@
 	if (status != CAM_REQ_CMP) {
 		device = NULL;
 	} else {
-		device = (struct cam_ed *)malloc(sizeof(*device),
-						 M_DEVBUF, M_NOWAIT);
+		device = malloc(sizeof(*device), M_DEVBUF, M_WAITOK);
 	}
 
 	if (device != NULL) {
@@ -4768,6 +4770,10 @@
 	int s;
 
 	s = splcam();
+	printf("xpt_release_device(%p,%p,%p): %d %08x\n", 
+		bus, target, device,
+		device->refcount, device->flags);
+
 	if ((--device->refcount == 0)
 	 && ((device->flags & CAM_DEV_UNCONFIGURED) != 0)) {
 		struct cam_devq *devq;
@@ -4776,9 +4782,11 @@
 		 || device->send_ccb_entry.pinfo.index != CAM_UNQUEUED_INDEX)
 			panic("Removing device while still queued for ccbs");
 
-		if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0)
-				untimeout(xpt_release_devq_timeout, device,
-					  device->c_handle);
+		if ((device->flags & CAM_DEV_REL_TIMEOUT_PENDING) != 0) {
+			device->flags &= ~CAM_DEV_REL_TIMEOUT_PENDING;
+			untimeout(xpt_release_devq_timeout, device,
+				  device->c_handle);
+		}
 
 		TAILQ_REMOVE(&target->ed_entries, device,links);
 		target->generation++;
@@ -5150,14 +5158,14 @@
 	}
 
 	if (request_ccb == NULL) {
-		request_ccb = malloc(sizeof(union ccb), M_TEMP, M_NOWAIT);
+		request_ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK);
 		if (request_ccb == NULL) {
 			xpt_print_path(path);
 			printf("xpt_scan_lun: can't allocate CCB, can't "
 			       "continue\n");
 			return;
 		}
-		new_path = malloc(sizeof(*new_path), M_TEMP, M_NOWAIT);
+		new_path = malloc(sizeof(*new_path), M_TEMP, M_WAITOK);
 		if (new_path == NULL) {
 			xpt_print_path(path);
 			printf("xpt_scan_lun: can't allocate path, can't "
@@ -5235,7 +5243,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (probe_softc *)malloc(sizeof(*softc), M_TEMP, M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_TEMP, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("proberegister: Unable to probe new device. "
@@ -5389,7 +5397,7 @@
 		mode_buf_len = sizeof(struct scsi_mode_header_6)
 			     + sizeof(struct scsi_mode_blk_desc)
 			     + sizeof(struct scsi_control_page);
-		mode_buf = malloc(mode_buf_len, M_TEMP, M_NOWAIT);
+		mode_buf = malloc(mode_buf_len, M_TEMP, M_WAITOK);
 		if (mode_buf != NULL) {
 	                scsi_mode_sense(csio,
 					/*retries*/4,
@@ -5420,9 +5428,8 @@
 		device->serial_num_len = 0;
 
 		if ((device->quirk->quirks & CAM_QUIRK_NOSERIAL) == 0)
-			serial_buf = (struct scsi_vpd_unit_serial_number *)
-				malloc(sizeof(*serial_buf), M_TEMP,
-					M_NOWAIT | M_ZERO);
+			serial_buf = malloc(sizeof(*serial_buf), M_TEMP,
+					    M_WAITOK | M_ZERO);
 
 		if (serial_buf != NULL) {
 			scsi_inquiry(csio,
@@ -5637,8 +5644,8 @@
 
 			have_serialnum = 1;
 			path->device->serial_num =
-				(u_int8_t *)malloc((serial_buf->length + 1),
-						   M_DEVBUF, M_NOWAIT);
+				malloc((serial_buf->length + 1),
+				       M_DEVBUF, M_WAITOK);
 			if (path->device->serial_num != NULL) {
 				bcopy(serial_buf->serial_num,
 				      path->device->serial_num,
Index: scsi/scsi_cd.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_cd.c,v
retrieving revision 1.11
diff -u -r1.11 scsi_cd.c
--- scsi/scsi_cd.c	16 Feb 2004 19:43:28 -0000	1.11
+++ scsi/scsi_cd.c	11 Mar 2004 21:45:16 -0000
@@ -706,7 +706,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct cd_softc *)malloc(sizeof(*softc),M_DEVBUF,M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("cdregister: Unable to probe new device. "
@@ -920,7 +920,7 @@
 		 */
 		else {
 			nchanger = malloc(sizeof(struct cdchanger),
-				M_DEVBUF, M_NOWAIT);
+				M_DEVBUF, M_WAITOK);
 
 			if (nchanger == NULL) {
 				softc->flags &= ~CD_FLAG_CHANGER;
@@ -1630,9 +1630,7 @@
 	case CD_STATE_PROBE:
 	{
 
-		rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap),
-								M_TEMP,
-								M_NOWAIT);
+		rcap = malloc(sizeof(*rcap), M_TEMP, M_WAITOK);
 		if (rcap == NULL) {
 			xpt_print_path(periph->path);
 			printf("cdstart: Couldn't malloc read_capacity data\n");
Index: scsi/scsi_ch.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_ch.c,v
retrieving revision 1.6
diff -u -r1.6 scsi_ch.c
--- scsi/scsi_ch.c	7 Aug 2003 21:16:44 -0000	1.6
+++ scsi/scsi_ch.c	11 Mar 2004 21:45:32 -0000
@@ -378,7 +378,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct ch_softc *)malloc(sizeof(*softc),M_DEVBUF,M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("chregister: Unable to probe new device. "
@@ -542,7 +542,7 @@
 				  sizeof(struct scsi_mode_blk_desc) +
 				 sizeof(struct page_element_address_assignment);
 
-		mode_buffer = malloc(mode_buffer_len, M_TEMP, M_NOWAIT);
+		mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK);
 
 		if (mode_buffer == NULL) {
 			printf("chstart: couldn't malloc mode sense data\n");
@@ -1377,7 +1377,7 @@
 	 */
 	mode_buffer_len = sizeof(struct scsi_mode_sense_data);
 
-	mode_buffer = malloc(mode_buffer_len, M_TEMP, M_NOWAIT);
+	mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK);
 
 	if (mode_buffer == NULL) {
 		printf("chgetparams: couldn't malloc mode sense data\n");
Index: scsi/scsi_da.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_da.c,v
retrieving revision 1.13
diff -u -r1.13 scsi_da.c
--- scsi/scsi_da.c	16 Feb 2004 19:43:28 -0000	1.13
+++ scsi/scsi_da.c	11 Mar 2004 21:45:51 -0000
@@ -1218,7 +1218,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct da_softc *)malloc(sizeof(*softc),M_DEVBUF,M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("daregister: Unable to probe new device. "
@@ -1434,9 +1434,7 @@
 		struct ccb_scsiio *csio;
 		struct scsi_read_capacity_data *rcap;
 
-		rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap),
-								M_TEMP,
-								M_NOWAIT);
+		rcap = malloc(sizeof(*rcap), M_TEMP, M_WAITOK);
 		if (rcap == NULL) {
 			printf("dastart: Couldn't malloc read_capacity data\n");
 			/* da_free_periph??? */
Index: scsi/scsi_low.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_low.c,v
retrieving revision 1.7
diff -u -r1.7 scsi_low.c
--- scsi/scsi_low.c	11 Feb 2004 17:46:33 -0000	1.7
+++ scsi/scsi_low.c	11 Mar 2004 21:46:37 -0000
@@ -390,7 +390,7 @@
  * SCSI INTERFACE (XS)
  **************************************************************/
 #define	SCSI_LOW_MINPHYS		0x10000
-#define	SCSI_LOW_MALLOC(size)		malloc((size), M_DEVBUF, M_NOWAIT)
+#define	SCSI_LOW_MALLOC(size)		malloc((size), M_DEVBUF, M_WAITOK)
 #define	SCSI_LOW_FREE(pt)		free((pt), M_DEVBUF)
 #define	SCSI_LOW_ALLOC_CCB(flags)	scsi_low_get_ccb((flags))
 #define	SCSI_LOW_XS_POLL_HZ		1000
@@ -880,7 +880,7 @@
 /**************************************************************
  * SCSI INTERFACE (CAM)
  **************************************************************/
-#define	SCSI_LOW_MALLOC(size)		malloc((size), M_DEVBUF, M_NOWAIT)
+#define	SCSI_LOW_MALLOC(size)		malloc((size), M_DEVBUF, M_WAITOK)
 #define	SCSI_LOW_FREE(pt)		free((pt), M_DEVBUF)
 #define	SCSI_LOW_ALLOC_CCB(flags)	scsi_low_get_ccb()
 
Index: scsi/scsi_pass.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_pass.c,v
retrieving revision 1.8
diff -u -r1.8 scsi_pass.c
--- scsi/scsi_pass.c	7 Aug 2003 21:16:45 -0000	1.8
+++ scsi/scsi_pass.c	11 Mar 2004 21:46:50 -0000
@@ -304,8 +304,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct pass_softc *)malloc(sizeof(*softc),
-					    M_DEVBUF, M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("passregister: Unable to probe new device. "
Index: scsi/scsi_pt.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_pt.c,v
retrieving revision 1.7
diff -u -r1.7 scsi_pt.c
--- scsi/scsi_pt.c	7 Aug 2003 21:16:45 -0000	1.7
+++ scsi/scsi_pt.c	11 Mar 2004 21:47:12 -0000
@@ -332,7 +332,7 @@
 		return(CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct pt_softc *)malloc(sizeof(*softc),M_DEVBUF,M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 
 	if (softc == NULL) {
 		printf("daregister: Unable to probe new device. "
Index: scsi/scsi_sa.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_sa.c,v
retrieving revision 1.8
diff -u -r1.8 scsi_sa.c
--- scsi/scsi_sa.c	21 Nov 2003 22:46:13 -0000	1.8
+++ scsi/scsi_sa.c	11 Mar 2004 21:47:20 -0000
@@ -1450,7 +1450,7 @@
 		return (CAM_REQ_CMP_ERR);
 	}
 
-	softc = (struct sa_softc *)malloc(sizeof (*softc), M_DEVBUF, M_NOWAIT);
+	softc = malloc(sizeof (*softc), M_DEVBUF, M_WAITOK);
 	if (softc == NULL) {
 		printf("saregister: Unable to probe new device. "
 		       "Unable to allocate softc\n");				
Index: scsi/scsi_ses.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_ses.c,v
retrieving revision 1.7
diff -u -r1.7 scsi_ses.c
--- scsi/scsi_ses.c	9 Nov 2003 02:22:33 -0000	1.7
+++ scsi/scsi_ses.c	11 Mar 2004 21:47:30 -0000
@@ -124,7 +124,7 @@
 #define	SES_DLOG		if (0) ses_log
 #endif
 #define	SES_VLOG		if (bootverbose) ses_log
-#define	SES_MALLOC(amt)		malloc(amt, M_DEVBUF, M_NOWAIT)
+#define	SES_MALLOC(amt)		malloc(amt, M_DEVBUF, M_WAITOK)
 #define	SES_FREE(ptr, amt)	free(ptr, M_DEVBUF)
 #define	MEMZERO			bzero
 #define	MEMCPY(dest, src, amt)	bcopy(src, dest, amt)
@@ -344,7 +344,7 @@
 		return (CAM_REQ_CMP_ERR);
 	}
 
-	softc = malloc(sizeof (struct ses_softc), M_DEVBUF, M_NOWAIT);
+	softc = malloc(sizeof (struct ses_softc), M_DEVBUF, M_WAITOK);
 	if (softc == NULL) {
 		printf("sesregister: Unable to probe new device. "
 		       "Unable to allocate softc\n");				
Index: scsi/scsi_targ_bh.c
===================================================================
RCS file: /cvs/src/sys/bus/cam/scsi/scsi_targ_bh.c,v
retrieving revision 1.6
diff -u -r1.6 scsi_targ_bh.c
--- scsi/scsi_targ_bh.c	2 Mar 2004 20:55:10 -0000	1.6
+++ scsi/scsi_targ_bh.c	11 Mar 2004 21:48:07 -0000
@@ -276,8 +276,7 @@
 	for (i = 0; i < MAX_ACCEPT; i++) {
 		struct ccb_accept_tio *atio;
 
-		atio = (struct ccb_accept_tio*)malloc(sizeof(*atio), M_DEVBUF,
-						      M_NOWAIT);
+		atio = malloc(sizeof(*atio), M_DEVBUF, M_WAITOK);
 		if (atio == NULL) {
 			status = CAM_RESRC_UNAVAIL;
 			break;
@@ -321,8 +320,7 @@
 	for (i = 0; i < MAX_ACCEPT; i++) {
 		struct ccb_immed_notify *inot;
 
-		inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_DEVBUF,
-						        M_NOWAIT);
+		inot = malloc(sizeof(*inot), M_DEVBUF, M_WAITOK);
 
 		if (inot == NULL) {
 			status = CAM_RESRC_UNAVAIL;
@@ -411,8 +409,7 @@
 	cpi = (struct ccb_pathinq *)arg;
 
 	/* Allocate our per-instance private storage */
-	softc = (struct targbh_softc *)malloc(sizeof(*softc),
-					      M_DEVBUF, M_NOWAIT);
+	softc = malloc(sizeof(*softc), M_DEVBUF, M_WAITOK);
 	if (softc == NULL) {
 		printf("targctor: unable to malloc softc\n");
 		return (CAM_REQ_CMP_ERR);
@@ -724,15 +721,14 @@
 	struct targbh_cmd_desc* descr;
 
 	/* Allocate the targbh_descr structure */
-	descr = (struct targbh_cmd_desc *)malloc(sizeof(*descr),
-					       M_DEVBUF, M_NOWAIT);
+	descr = malloc(sizeof(*descr), M_DEVBUF, M_WAITOK);
 	if (descr == NULL)
 		return (NULL);
 
 	bzero(descr, sizeof(*descr));
 
 	/* Allocate buffer backing store */
-	descr->backing_store = malloc(MAX_BUF_SIZE, M_DEVBUF, M_NOWAIT);
+	descr->backing_store = malloc(MAX_BUF_SIZE, M_DEVBUF, M_WAITOK);
 	if (descr->backing_store == NULL) {
 		free(descr, M_DEVBUF);
 		return (NULL);





More information about the Bugs mailing list