diff -urN linux-2.6.12-rc1.orig/drivers/scsi/megaraid/megaraid_mbox.c linux-2.6.12-rc1/drivers/scsi/megaraid/megaraid_mbox.c
--- linux-2.6.12-rc1.orig/drivers/scsi/megaraid/megaraid_mbox.c	2005-03-25 19:03:01.000000000 +0900
+++ linux-2.6.12-rc1/drivers/scsi/megaraid/megaraid_mbox.c	2005-03-26 11:50:09.201839960 +0900
@@ -113,7 +113,7 @@
 static int megaraid_queue_command(struct scsi_cmnd *,
 		void (*)(struct scsi_cmnd *));
 static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *);
-static void megaraid_mbox_runpendq(adapter_t *, scb_t *);
+static void megaraid_mbox_runpendq(adapter_t *, scb_t *, int *);
 static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *,
 		struct scsi_cmnd *);
 static void megaraid_mbox_prepare_epthru(adapter_t *, scb_t *,
@@ -1672,19 +1672,28 @@
 	 */
 	if_busy	= 0;
 	scb	= megaraid_mbox_build_cmd(adapter, scp, &if_busy);
+	if (!scb)
+		goto err_out;
 
+	megaraid_mbox_runpendq(adapter, scb, &if_busy);
+	if (if_busy)
+		goto err_out;
+
+	spin_lock(adapter->host_lock);
+
+	return if_busy;
+
+err_out:
 	if (scb) {
-		megaraid_mbox_runpendq(adapter, scb);
+		megaraid_dealloc_scb(adapter, scb);
 	}
 
 	spin_lock(adapter->host_lock);
 
-	if (!scb) {	// command already completed
-		done(scp);
-		return 0;
-	}
+	// command already completed
+	done(scp);	
 
-	return if_busy;
+	return 0;
 }
 
 
@@ -2081,7 +2090,7 @@
  * next SCB is at the head now.
  */
 static void
-megaraid_mbox_runpendq(adapter_t *adapter, scb_t *scb_q)
+megaraid_mbox_runpendq(adapter_t *adapter, scb_t *scb_q, int *busy)
 {
 	scb_t			*scb;
 	unsigned long		flags;
@@ -2096,6 +2105,13 @@
 	// if the adapter in not in quiescent mode, post the commands to FW
 	if (atomic_read(&adapter->quiescent)) {
 		spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags);
+
+		// retry scsi midlayer
+		if (scb_q)
+			scb_q->scp->result = (DID_SOFT_ERROR << 16);
+			
+		*busy = 1;
+
 		return;
 	}
 
@@ -2368,12 +2384,13 @@
 {
 	adapter_t	*adapter = devp;
 	int		handled;
+	int		if_busy = 0;	
 
 	handled = megaraid_ack_sequence(adapter);
 
 	/* Loop through any pending requests */
 	if (!atomic_read(&adapter->quiescent)) {
-		megaraid_mbox_runpendq(adapter, NULL);
+		megaraid_mbox_runpendq(adapter, NULL, &if_busy);
 	}
 
 	return IRQ_RETVAL(handled);
@@ -3762,6 +3779,7 @@
 	scb_t			*scb;
 	mbox_ccb_t		*ccb;
 	unsigned long		flags;
+	int			if_busy = 0;
 
 	// detach one scb from free pool
 	spin_lock_irqsave(USER_FREE_LIST_LOCK(adapter), flags);
@@ -3833,8 +3851,9 @@
 	}
 
 	// put the command on the pending list and execute
-	megaraid_mbox_runpendq(adapter, scb);
+	megaraid_mbox_runpendq(adapter, scb, &if_busy);
 
+	// XXX: success ?
 	return 0;
 }
 
@@ -3881,6 +3900,7 @@
 	mbox64_t		*mbox64;
 	uint8_t			*raw_mbox;
 	unsigned long		flags;
+	int			if_busy = 0;
 
 	kioc			= (uioc_t *)scb->gp;
 	kioc->status		= 0;
@@ -3905,7 +3925,7 @@
 
 		atomic_dec(&adapter->quiescent);
 
-		megaraid_mbox_runpendq(adapter, NULL);
+		megaraid_mbox_runpendq(adapter, NULL, &if_busy);
 	}
 
 	kioc->done(kioc);
