Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / drivers / scsi / aacraid / commsup.c
index 3f27419..9f9f4aa 100644 (file)
@@ -229,7 +229,8 @@ void aac_fib_init(struct fib *fibptr)
 static void fib_dealloc(struct fib * fibptr)
 {
        struct hw_fib *hw_fib = fibptr->hw_fib;
-       BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
+       if(hw_fib->header.StructType != FIB_MAGIC) 
+               BUG();
        hw_fib->header.XferState = 0;        
 }
 
@@ -471,6 +472,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
        spin_lock_irqsave(q->lock, qflags);
        if (dev->new_comm_interface) {
                unsigned long count = 10000000L; /* 50 seconds */
+               list_add_tail(&fibptr->queue, &q->pendingq);
                q->numpending++;
                spin_unlock_irqrestore(q->lock, qflags);
                while (aac_adapter_send(fibptr) != 0) {
@@ -479,6 +481,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                                        spin_unlock_irqrestore(&fibptr->event_lock, flags);
                                spin_lock_irqsave(q->lock, qflags);
                                q->numpending--;
+                               list_del(&fibptr->queue);
                                spin_unlock_irqrestore(q->lock, qflags);
                                return -ETIMEDOUT;
                        }
@@ -489,6 +492,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                unsigned long nointr = 0;
                aac_queue_get( dev, &index, AdapNormCmdQueue, hw_fib, 1, fibptr, &nointr);
 
+               list_add_tail(&fibptr->queue, &q->pendingq);
                q->numpending++;
                *(q->headers.producer) = cpu_to_le32(index + 1);
                spin_unlock_irqrestore(q->lock, qflags);
@@ -516,6 +520,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                                if (--count == 0) {
                                        spin_lock_irqsave(q->lock, qflags);
                                        q->numpending--;
+                                       list_del(&fibptr->queue);
                                        spin_unlock_irqrestore(q->lock, qflags);
                                        if (wait == -1) {
                                                printk(KERN_ERR "aacraid: aac_fib_send: first asynchronous command timed out.\n"
@@ -529,7 +534,8 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                        }
                } else
                        down(&fibptr->event_wait);
-               BUG_ON(fibptr->done == 0);
+               if(fibptr->done == 0)
+                       BUG();
                        
                if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){
                        return -ETIMEDOUT;
@@ -1208,7 +1214,7 @@ int aac_command_thread(void *data)
                                                 * since the last read off
                                                 * the queue?
                                                 */
-                                               if ((time_now - time_last) > aif_timeout) {
+                                               if ((time_now - time_last) > 120) {
                                                        entry = entry->next;
                                                        aac_close_fib_context(dev, fibctx);
                                                        continue;