hostdata->sensing = NULL;
        }
 
-       hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
-
        cmd->scsi_done(cmd);
 }
 
                                cmd->result = DID_ERROR << 16;
                                complete_cmd(instance, cmd);
                                hostdata->connected = NULL;
+                               hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
                                return;
 #endif
                        case PHASE_DATAIN:
                                                 cmd, scmd_id(cmd), cmd->device->lun);
 
                                        hostdata->connected = NULL;
+                                       hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
 
                                        cmd->result &= ~0xffff;
                                        cmd->result |= cmd->SCp.Status;
                                NCR5380_transfer_pio(instance, &phase, &len, &data);
                                if (msgout == ABORT) {
                                        hostdata->connected = NULL;
+                                       hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
                                        cmd->result = DID_ERROR << 16;
                                        complete_cmd(instance, cmd);
                                        maybe_release_dma_irq(instance);
                dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
                         "reselect: removed %p from disconnected queue\n", tmp);
        } else {
+               int target = ffs(target_mask) - 1;
+
                shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
                             target_mask, lun);
                /*
                 * Since we have an established nexus that we can't do anything
                 * with, we must abort it.
                 */
-               do_abort(instance);
+               if (do_abort(instance) == 0)
+                       hostdata->busy[target] &= ~(1 << lun);
                return;
        }
 
 out:
        if (result == FAILED)
                dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd);
-       else
+       else {
+               hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun);
                dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd);
+       }
 
        queue_work(hostdata->work_q, &hostdata->main_task);
        maybe_release_dma_irq(instance);