The attached patches:

1) Add reports at the various points where devices are taken
   off-line in the SCSI mid-level code.

2) Fix a problem in error handler with hard bus resets.

3) Add scsi force-device-online and force-device-offline
   commands to the /proc/scsi/scsi interface.

4) Clean up the return codes for the /proc/scsi/scsi
   interface and allow a little more variation in white
   space use.
diff -urN 0/Makefile 0-0/Makefile
--- 0/Makefile  Thu Jan  4 16:48:13 2001
+++ 0-0/Makefile        Wed Jan 10 13:23:52 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION = -0
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
diff -urN 0/drivers/scsi/online 0-0/drivers/scsi/online
--- 0/drivers/scsi/online       Wed Dec 31 19:00:00 1969
+++ 0-0/drivers/scsi/online     Wed Jan 10 13:40:53 2001
@@ -0,0 +1,491 @@
+3w-xxxx.c:     tw_dev = (TW_Device_Extension *)disk->device->host->hostdata;
+53c7,8xx.c:                            cmd->device && cmd->device->has_cmdblocks
+53c7xx.c:                              cmd->device && cmd->device->has_cmdblocks) {
+advansys.c:    ASC_STATS(dp->device->host, biosparam);
+advansys.c:    boardp = ASC_BOARDP(dp->device->host);
+advansys.c:    for (device = devicelist; device != NULL; device = device->next) {
+advansys.c:        if (device->host != shp) {
+advansys.c:        boardp->device[device->id] = device;
+advansys.c:            device->queue_depth =
+advansys.c:                boardp->dvc_var.asc_dvc_var.max_dvc_qng[device->id];
+advansys.c:            device->queue_depth =
+advansys.c:            (ulong) shp, device->id, device->queue_depth);
+aha152x.c:             if (!ptr->device->soft_reset) {
+aha152x.c:     struct Scsi_Host *shpnt = disk->device->host;
+aha152x.c:             if (!ptr->device->soft_reset) {
+aha152x.c:     if(CURRENT_SC && !CURRENT_SC->device->soft_reset)
+aha1542.c:                 !(HOSTDATA(shost)->SCint[i]->device->soft_reset)) {
+aha1542.c:                     if (SCtmp->device->soft_reset) {
+aha1542.c:                     if (SCtmp->device->soft_reset) {
+aha1542.c:     translation_algorithm = HOSTDATA(disk->device->host)->bios_translation;
+aha1740.c:    int extended = HOSTDATA(disk->device->host)->translation;
+aic7xxx.c:  tindex = device->id | (device->channel << 3);
+aic7xxx.c:  device->queue_depth = default_depth;
+aic7xxx.c:  if (device->tagged_supported)
+aic7xxx.c:             p->host_no, device->channel, device->id, device->lun);
+aic7xxx.c:        device->queue_depth = default_depth;
+aic7xxx.c:          device->queue_depth = 3;  /* Tagged queueing is disabled. */
+aic7xxx.c:          device->queue_depth = default_depth;
+aic7xxx.c:          device->queue_depth =
+aic7xxx.c:      if ((device->tagged_queue == 0) && tag_enabled)
+aic7xxx.c:                p->host_no, device->channel, device->id,
+aic7xxx.c:                device->lun, device->queue_depth);
+aic7xxx.c:        p->dev_max_queue_depth[tindex] = device->queue_depth;
+aic7xxx.c:        p->dev_temp_queue_depth[tindex] = device->queue_depth;
+aic7xxx.c:        device->tagged_queue = 1;
+aic7xxx.c:        device->current_tag = SCB_LIST_NULL;
+aic7xxx.c:  for (device = scsi_devs; device != NULL; device = device->next)
+aic7xxx.c:    if (device->host == host)
+aic7xxx.c:  if (p->dev_active_cmds[tindex] > (cmd->device->queue_depth + 1))
+aic7xxx.c:  p = (struct aic7xxx_host *) disk->device->host->hostdata;
+AM53C974.c:    cmd->device->disconnect = 0;
+AM53C974.c:                            if (!hostdata->connected->device->tagged_queue)
+AM53C974.c:            if (cmd->device->disconnect) {
+AM53C974.c:            }               /* !cmd->device->disconnect */
+AM53C974.c:            cmd->device->disconnect = 0;
+AM53C974.c:                        cmd->device->tagged_queue = 0;
+AM53C974.c:            cmd->device->disconnect = 1;
+AM53C974.c:    if (cmd->device->tagged_queue && (tag != TAG_NONE)) {
+AM53C974.c:                    if (cmd->device->current_tag == 0)
+AM53C974.c:                            cmd->device->current_tag = 1;
+AM53C974.c:                    cmd->tag = cmd->device->current_tag;
+AM53C974.c:                    cmd->device->current_tag++;
+atari_NCR5380.c:       !setup_use_tagged_queuing || !cmd->device->tagged_supported)
+atari_NCR5380.c:       !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
+atari_NCR5380.c:               if (!cmd->device->borken &&
+atari_NCR5380.c:                       cmd->device->borken = 1;
+atari_NCR5380.c:                       cmd->device->tagged_supported = 0;
+atari_NCR5380.c:                   cmd->device->disconnect = 1;
+atari_scsi.c:          if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
+BusLogic.c:    (BusLogic_HostAdapter_T *) Disk->device->host->hostdata;
+cpqfcTSinit.c://       Cmnd->device->device_blocked = TRUE; // just let it timeout
+eata.c:   if (SCpnt->device->type == TYPE_TAPE) cpp->hbaci = TRUE;
+eata.c:   if (SCpnt->device->tagged_queue) {
+eata.c:      else if (SCpnt->device->current_tag == 0)
+eata.c:      else if (SCpnt->device->current_tag == 1)
+eata.c:      cpp->mess[1] = SCpnt->device->current_tag++;
+eata.c:   if (linked_comm && SCpnt->device->queue_depth > 2
+eata.c:                                     && TLDEV(SCpnt->device->type)) {
+eata.c:   if (linked_comm && SCpnt->device->queue_depth > 2
+eata.c:                                     && TLDEV(SCpnt->device->type))
+eata.c:         if (tstatus == BUSY && SCpnt->device->type != TYPE_TAPE)
+eata.c:         else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
+eata.c:                  && SCpnt->device->type == TYPE_DISK
+eata.c:         if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
+eata.c:         if (SCpnt->device->type != TYPE_TAPE
+eata_dma.c:            if (cmd->device->type != TYPE_TAPE)
+eata_dma.c:            || cmd->scsi_done == NULL || cmd->device->id == 7) 
+eata_dma.c:                   cmd->device->channel, cmd->device->id, cmd->device->lun,
+eata_dma.c:    for(device = devicelist; device != NULL; device = device->next) {
+eata_dma.c:        if(device->host == host)
+eata_dma.c:        device->queue_depth = 2;
+eata_dma.c:    for(device = devicelist; device != NULL; device = device->next) {
+eata_dma.c:        if (device->host == host) {
+eata_dma.c:        switch(device->type) {
+eata_dma.c:    for(device = devicelist; device != NULL; device = device->next) {
+eata_dma.c:        if(device->host == host) {
+eata_dma.c:        if(SD(device->host)->bustype != IS_ISA){
+eata_dma.c:            switch(device->type) {
+eata_dma.c:                device->queue_depth = (TYPE_DISK_QUEUE * factor) / 10;
+eata_dma.c:                device->queue_depth = (TYPE_TAPE_QUEUE * factor) / 10;
+eata_dma.c:                device->queue_depth = (TYPE_ROM_QUEUE * factor) / 10;
+eata_dma.c:                device->queue_depth = (TYPE_OTHER_QUEUE * factor) / 10;
+eata_dma.c:            device->queue_depth = 2; 
+eata_dma.c:        if(device->queue_depth > UPPER_DEVICE_QUEUE_LIMIT)
+eata_dma.c:            device->queue_depth = UPPER_DEVICE_QUEUE_LIMIT;
+eata_dma.c:        if(device->queue_depth == 0) 
+eata_dma.c:            device->queue_depth = 1;
+eata_dma.c:               "set to %d\n", host->host_no, device->id, device->channel,
+eata_dma.c:               device->queue_depth);
+esp.c:         if (SCptr->device->sync_max_offset) {
+esp.c:         if (SCptr->device->sync_max_offset)
+esp.c:         SCptr->device->borken = 1;
+esp.c:         SCptr->device->sync = 0;
+esp.c: if (sp->device->type == TYPE_TAPE) {
+esp.c:             SCptr->device->sync &&
+esp.c:             SCptr->device->sync_max_offset) {
+esp.c:                         SCptr->device->sync = 0;
+esp.c:                     !(esp->current_SC->device->sync_max_offset))
+esp.c:                 SCptr->device->borken = 1; /* foo on you */
+fcal.c:        for (device = devlist; device; device = device->next) {
+fcal.c:                if (device->host != host) continue;
+fcal.c:                if (device->tagged_supported)
+fcal.c:                        device->queue_depth = /* 254 */ 8;
+fcal.c:                        device->queue_depth = 2;
+gdth.c:    hanum = NUMDATA(disk->device->host)->hanum;
+gdth.c:    t = disk->device->id;
+gdth.c:            hanum, disk->device->channel, t));
+gdth.c:    if (disk->device->channel != ha->virt_bus || ha->hdr[t].heads == 0) {
+ibmmca.c:   described in the ANSI-SCSI-standard, not occupied by other device-types. 
+*/
+ibmmca.c:   printk("IBM MCA SCSI: Determined SCSI-device-mapping:\n");
+ibmmca.c:   /* for specific device-type debugging: */
+ibmmca.c:     printk("(SCSI-device-type=0x%x) issue scsi cmd=%02x to ldn=%d\n",
+ide-scsi.c:    ide_drive_t *drive = idescsi_drives[disk->device->id];
+in2000.c:   if (cmd->device->type == 1)   /* tape drive? */
+in2000.c:               cmd->device->disconnect = 1;
+ini9100u.c:    if (SCpnt->device->tagged_supported) {  /* Tag Support                 
+ */
+ini9100u.c:    pHcb = (HCS *) disk->device->host->base;
+ini9100u.c:    pTcb = &pHcb->HCS_Tcs[disk->device->id];
+inia100.c:     if (SCpnt->device->tagged_supported) {  /* Tag Support                 
+ */
+inia100.c:     pHcb = (ORC_HCS *) disk->device->host->base;
+inia100.c:     pTcb = &pHcb->HCS_Tcs[disk->device->id];
+ips.c:   ha = (ips_ha_t *) disk->device->host->hostdata;
+ips.c:   for (device = scsi_devs; device; device = device->next) {
+ips.c:     if (device->host == host) {
+ips.c:        if ((device->channel == 0) && (device->type == 0))
+ips.c:   for (device = scsi_devs; device; device = device->next) {
+ips.c:      if (device->host == host) {
+ips.c:         if ((device->channel == 0) && (device->type == 0))
+ips.c:            device->queue_depth = ha->max_cmds / count - 1;
+ips.c:            device->queue_depth = 2;
+mac_NCR5380.c: !setup_use_tagged_queuing || !cmd->device->tagged_supported)
+mac_NCR5380.c: !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
+mac_NCR5380.c:         if (!cmd->device->borken &&
+mac_NCR5380.c:                 cmd->device->borken = 1;
+mac_NCR5380.c:                 cmd->device->tagged_supported = 0;
+mac_NCR5380.c:             cmd->device->disconnect = 1;
+megaraid.c:  megaCfg = (mega_host_config *) disk->device->host->hostdata;
+NCR5380.c:     if (cmd->device->tagged_queue && (tag != TAG_NONE)) {
+NCR5380.c:                     if (cmd->device->current_tag == 0)
+NCR5380.c:                             cmd->device->current_tag = 1;
+NCR5380.c:                     cmd->tag = cmd->device->current_tag;
+NCR5380.c:                     cmd->device->current_tag++;
+NCR5380.c:     if (!cmd->device->tagged_queue)
+NCR5380.c:                             if (!cmd->device->borken &&
+NCR5380.c:                             if (!cmd->device->borken && transfersize &&
+NCR5380.c:                                             cmd->device->borken = 1;
+NCR5380.c:                                                 cmd->device->tagged_queue 
+= 0;
+NCR5380.c:                                             cmd->device->disconnect = 1;
+NCR5380.c:                             if (!cmd->device->disconnect &&
+NCR5380.c:                     if (!cmd->device->disconnect && time_after_eq(jiffies, 
+poll_time))
+ncr53c8xx.c:   ncr_nvram *nvram = device->nvram;
+ncr53c8xx.c:           device->chip.name, unit, device->chip.revision_id,
+ncr53c8xx.c:           device->slot.bus, (device->slot.device_fn & 0xf8) >> 3,
+ncr53c8xx.c:           device->slot.device_fn & 7,
+ncr53c8xx.c:           __irq_itoa(device->slot.irq));
+ncr53c8xx.c:           device->slot.irq);
+ncr53c8xx.c:   np = __m_calloc_dma(device->pdev, sizeof(struct ncb), "NCB");
+ncr53c8xx.c:   np->pdev  = device->pdev;
+ncr53c8xx.c:   strncpy(np->chip_name, device->chip.name, sizeof(np->chip_name) - 1);
+ncr53c8xx.c:   np->device_id   = device->chip.device_id;
+ncr53c8xx.c:   np->revision_id = device->chip.revision_id;
+ncr53c8xx.c:   np->bus         = device->slot.bus;
+ncr53c8xx.c:   np->device_fn   = device->slot.device_fn;
+ncr53c8xx.c:   np->features    = device->chip.features;
+ncr53c8xx.c:   np->clock_divn  = device->chip.nr_divisor;
+ncr53c8xx.c:   np->maxoffs     = device->chip.offset_max;
+ncr53c8xx.c:   np->maxburst    = device->chip.burst_max;
+ncr53c8xx.c:   np->myaddr      = device->host_id;
+ncr53c8xx.c:   np->paddr       = device->slot.base;
+ncr53c8xx.c:   np->paddr2      = (np->features & FE_RAM)? device->slot.base_2 : 0;
+ncr53c8xx.c:   request_region(device->slot.io_port, 128, "ncr53c8xx");
+ncr53c8xx.c:   np->base_io = device->slot.io_port;
+ncr53c8xx.c:   instance->irq           = device->slot.irq;
+ncr53c8xx.c:   instance->unique_id     = device->slot.io_port;
+ncr53c8xx.c:   instance->io_port       = device->slot.io_port;
+ncr53c8xx.c:   if (request_irq(device->slot.irq, ncr53c8xx_intr,
+ncr53c8xx.c:                   ncr_name(np), __irq_itoa(device->slot.irq));
+ncr53c8xx.c:                   ncr_name(np), device->slot.irq);
+ncr53c8xx.c:   np->irq = device->slot.irq;
+ncr53c8xx.c:   if (lp && !lp->numtags && cmd->device && cmd->device->tagged_queue) {
+ncr53c8xx.c:   for (device = devlist; device; device = device->next) {
+ncr53c8xx.c:           if (device->host != host)
+ncr53c8xx.c:           tp = &np->target[device->id];
+ncr53c8xx.c:           lp = tp->lp[device->lun];
+ncr53c8xx.c:           numtags = device_queue_depth(np->unit, device->id, 
+device->lun);
+ncr53c8xx.c:           if (!device->tagged_supported)
+ncr53c8xx.c:           device->queue_depth = numtags;
+ncr53c8xx.c:           if (device->queue_depth < 2)
+ncr53c8xx.c:                   device->queue_depth = 2;
+ncr53c8xx.c:           if (device->queue_depth > MAX_TAGS)
+ncr53c8xx.c:                   device->queue_depth = MAX_TAGS;
+ncr53c8xx.c:                   lp->scdev_depth = device->queue_depth;
+ncr53c8xx.c:           ncr_setup_tags (np, device->id, device->lun);
+ncr53c8xx.c:   np->unit, device->id, device->lun, device->queue_depth);
+NCR53C9x.c:    if(SCptr->device->sync_max_offset)
+NCR53C9x.c:            SCptr->device->borken = 1;
+NCR53C9x.c:            SCptr->device->sync = 0;
+NCR53C9x.c:    if(sp->device->type == TYPE_TAPE) {
+NCR53C9x.c:               SCptr->device->sync &&
+NCR53C9x.c:               SCptr->device->sync_max_offset) {
+NCR53C9x.c:                            SCptr->device->sync = 0;
+NCR53C9x.c:                       !(esp->current_SC->device->sync_max_offset))
+NCR53C9x.c:                    SCptr->device->borken = 1; /* foo on you */
+osst.c:        cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0;
+osst.c:                       dev, STp->device->rev);
+osst.c:        if( STp->device->was_reset )
+osst.c:        if (STp->device->was_reset) {
+osst.c:        if (STp->device->host->hostt->module)
+osst.c:                 __MOD_INC_USE_COUNT(STp->device->host->hostt->module);
+osst.c:        (STp->buffer)->use_sg = STp->device->host->sg_tablesize;
+osst.c:                STp->device->was_reset = 0;
+osst.c:                                STp->device->was_reset = 0;
+osst.c:        if (STp->device->host->hostt->module)
+osst.c:            __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
+osst.c:        if (STp->device->host->hostt->module)
+osst.c:                __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
+osst.c:                        STp->device->was_reset = 0;
+pci2000.c:     padapter = HOSTDATA(disk->device->host);
+pci2000.c:     outb_p (disk->device->id, padapter->mb0);
+pci2220i.c:    if ( !(HOSTDATA(disk->device->host))->atapi )
+pci2220i.c:            pdev = 
+&(HOSTDATA(disk->device->host)->device[disk->device->id]);
+pluto.c:       for (device = devlist; device; device = device->next) {
+pluto.c:               if (device->host != host) continue;
+pluto.c:               if (device->tagged_supported)
+pluto.c:                       device->queue_depth = /* 254 */ 8;
+pluto.c:                       device->queue_depth = 2;
+pluto.c:               /* FC layer requires this, so that 
+SCpnt->device->tagged_supported is initially 0 */
+psi240i.c:     pdev = &(HOSTDATA(disk->device->host)->device[disk->device->id]);
+qla1280.c:    int bus = device->channel;
+qla1280.c:    int target = device->id;
+qla1280.c:    device->queue_depth = default_depth;
+qla1280.c:    if (device->tagged_supported &&
+qla1280.c:        device->tagged_queue = 1;
+qla1280.c:        device->current_tag = 0;
+qla1280.c:        device->queue_depth = p->bus_settings[bus].hiwat; 
+qla1280.c:        /* device->queue_depth = 20; */
+qla1280.c:                (int)p->host_no, device->channel, device->id,
+qla1280.c:                device->lun, device->queue_depth);
+qla1280.c:    qla12160_get_target_parameters(p, bus, target, device->lun);
+qla1280.c:    for (device = scsi_devs; device != NULL; device = device->next)
+qla1280.c:        if (device->host == host)
+qla1280.c:            if (cmd->device->tagged_queue )
+qla1280.c:            if (cmd->device->tagged_queue )
+qlogicfc.c:    if (Cmnd->device->tagged_supported) {
+qlogicpti.c:   if (Cmnd->device->tagged_supported) {
+scsi.c:        SRpnt->sr_host = device->host;
+scsi.c:        host = device->host;
+scsi.c:                if (!device->device_blocked) {
+scsi.c:                        if (device->single_lun) {
+scsi.c:                                        if (SDpnt->channel != device->channel
+scsi.c:                                            || SDpnt->id != device->id
+scsi.c:                        for (SCpnt = device->device_queue; SCpnt; SCpnt = 
+SCpnt->next) {
+scsi.c:                        add_wait_queue(&device->scpnt_wait, &wait);
+scsi.c:                        remove_wait_queue(&device->scpnt_wait, &wait);
+scsi.c:        atomic_inc(&SCpnt->device->device_active);
+scsi.c:        device->device_busy--;  /* Decrement device usage counter. */
+scsi.c:        device->device_blocked = FALSE;
+scsi.c:                                      SCpnt->device->id, SCpnt->result));
+scsi_error.c:  if (SCpnt->device->online == FALSE) {
+scsi_error.c:          if (SCpnt->device->expecting_cc_ua) {
+scsi_error.c:                  SCpnt->device->expecting_cc_ua = 0;
+scsi_error.c:                                                  SCloop->device->online 
+= FALSE;
+scsi_error.c:                                                  SCloop->device->online 
+= FALSE;
+scsi_error.c:                          SCloop->device->online = FALSE;
+scsi_error.c:                              SCloop->device->id, SCloop->result));
+scsi_lib.c:    q = &SCpnt->device->request_queue;
+scsi_lib.c:    q = &SRpnt->sr_device->request_queue;
+scsi_lib.c:                q = &SCpnt->device->request_queue;
+scsi_lib.c:    request_queue_t *q = &SCpnt->device->request_queue;
+scsi_lib.c:                    if (SCpnt->device->remap) {
+scsi_lib.c:                    if (SCpnt->device->removable) {
+scsi_lib.c:                            SCpnt->device->changed = 1;
+scsi_lib.c:                    if (SCpnt->device->ten) {
+scsi_lib.c:                            SCpnt->device->ten = 0;
+scsi_lib.c:                   SCpnt->device->host->host_no,
+scsi_lib.c:                   SCpnt->device->channel,
+scsi_lib.c:                   SCpnt->device->id,
+scsi_lib.c:                   SCpnt->device->lun, result);
+scsi_obsolete.c:               if (SCpnt->device->expecting_cc_ua) {
+scsi_obsolete.c:                       SCpnt->device->expecting_cc_ua = 0;
+scsi_obsolete.c:                device->device_busy--; /* Decrement device usage 
+counter. */
+scsi_obsolete.c:                       if ((SCpnt->flags & IS_RESETTING) && 
+SCpnt->device->soft_reset) {
+scsi_queue.c:          if (cmd->device->device_busy == 0) {
+scsi_queue.c:          cmd->device->device_blocked = TRUE;
+scsi_queue.c:  cmd->device->device_busy--;
+scsi_scan.c:   /* Some low level driver could use device->type (DB) */
+sd.c:        if (dp->device != NULL && dp->device->host == host
+sd.c:            && dp->device->id == tgt)
+sd.c:                  host = rscsi_disks[DEVICE_NR(dev)].device->host;
+sd.c:                  host = rscsi_disks[DEVICE_NR(dev)].device->host;
+sd.c:  return &dpnt->device->request_queue;
+sd.c:      !dpnt->device->online ||
+sd.c:  if (dpnt->device->changed) {
+sd.c:  if (dpnt->device->sector_size == 1024) {
+sd.c:  if (dpnt->device->sector_size == 2048) {
+sd.c:  if (dpnt->device->sector_size == 4096) {
+sd.c:          if (!dpnt->device->writeable) {
+sd.c:  if (((this_count > 0xff) || (block > 0x1fffff)) || SCpnt->device->ten) {
+sd.c:  SCpnt->transfersize = dpnt->device->sector_size;
+sd.c:  SCpnt->timeout_per_command = (SCpnt->device->type == TYPE_DISK ?
+sd.c:  while (rscsi_disks[target].device->busy)
+sd.c:  if (rscsi_disks[target].device->removable) {
+sd.c:                  switch (SCpnt->device->sector_size) {
+sd.c:                  if (SCpnt->device->ten == 1) {
+sd.c:                                  SCpnt->device->ten = 0;
+sd.c:  if (rscsi_disks[i].device->online == FALSE)
+sd.c:                  cmd[1] = (rscsi_disks[i].device->lun << 5) & 0xe0;
+sd.c:                  rscsi_disks[i].device->changed = 1;
+sd.c:          if (the_result && !rscsi_disks[i].device->removable &&
+sd.c:                          cmd[1] = (rscsi_disks[i].device->lun << 5) & 0xe0;
+sd.c:          cmd[1] = (rscsi_disks[i].device->lun << 5) & 0xe0;
+sd.c:          if (rscsi_disks[i].device->removable &&
+sd.c:                  rscsi_disks[i].device->changed = 1;
+sd.c:  if (rscsi_disks[i].device->removable && rscsi_disks[i].ready) {
+sd.c:          cmd[1] = (rscsi_disks[i].device->lun << 5) & 0xe0;
+sd.c:  SRpnt->sr_device->ten = 1;
+sd.c:  SRpnt->sr_device->remap = 1;
+sd.c:  SRpnt->sr_device->sector_size = sector_size;
+sd.c:               && rscsi_disks[i * 
+SCSI_DISKS_PER_MAJOR].device->host->sg_tablesize)
+sd.c:#define DEVICE_BUSY rscsi_disks[target].device->busy
+sd.c:#define USAGE rscsi_disks[target].device->access_count
+sd.c:          if (rscsi_disks[target].device->sector_size == 2048)
+seagate.c:  int borken = (int) SCint->device->borken; /* Does the current target 
+require
+sg.c:    if ((! sdp) || (! sdp->device) || (! sdp->device->host))
+sg.c:        sdp->sg_tablesize = sdp->device->host->sg_tablesize;
+sg.c:    if (sdp->device->host->hostt->module)
+sg.c:        __MOD_INC_USE_COUNT(sdp->device->host->hostt->module);
+sg.c:    if (sdp->device->host->hostt->module)
+sg.c:        __MOD_DEC_USE_COUNT(sdp->device->host->hostt->module);
+sg.c:  (! sg_allow_access(cmnd[0], sfp->parentdp->device->type))) {
+sg.c:  cmnd[1] = (cmnd[1] & 0x1f) | (sdp->device->lun << 5);
+sg.c:            sfp->low_dma = sdp->device->host->unchecked_isa_dma;
+sg.c:            __put_user((int)sdp->device->host->host_no, &sg_idp->host_no);
+sg.c:            __put_user((int)sdp->device->channel, &sg_idp->channel);
+sg.c:            __put_user((int)sdp->device->id, &sg_idp->scsi_id);
+sg.c:            __put_user((int)sdp->device->lun, &sg_idp->lun);
+sg.c:            __put_user((int)sdp->device->type, &sg_idp->scsi_type);
+sg.c:      __put_user((short)sdp->device->host->cmd_per_lun,
+sg.c:      __put_user((short)sdp->device->queue_depth,
+sg.c:        return put_user(sdp->device->host->hostt->emulated, (int *)arg);
+sg.c:      if (sdp->device->host->in_recovery)
+sg.c:      if (! sg_allow_access(opcode, sdp->device->type))
+sg.c:      && sdp->device->removable) {
+sg.c:      sdp->device->changed = 1;
+sg.c:  (! sfp->parentdp->device->host->unchecked_isa_dma)) {
+sg.c:                   sdp->device->host->unchecked_isa_dma : 1;
+sr.c:  if (scsi_CDs[MINOR(cdi->dev)].device->sector_size > 2048)
+sr.c:  scsi_CDs[MINOR(cdi->dev)].device->access_count--;
+sr.c:  if (scsi_CDs[MINOR(cdi->dev)].device->host->hostt->module)
+sr.c:          
+__MOD_DEC_USE_COUNT(scsi_CDs[MINOR(cdi->dev)].device->host->hostt->module);
+sr.c:          scsi_CDs[MINOR(cdi->dev)].device->changed = 1;
+sr.c:  retval = scsi_CDs[MINOR(cdi->dev)].device->changed;
+sr.c:  scsi_CDs[MINOR(cdi->dev)].device->changed = 0;
+sr.c:          scsi_CDs[MINOR(cdi->dev)].device->sector_size = 2048;
+sr.c:          if (scsi_CDs[device_nr].device->sector_size == 2048)
+sr.c:  return &scsi_CDs[MINOR(dev)].device->request_queue;
+sr.c:      !scsi_CDs[dev].device->online) {
+sr.c:  if (scsi_CDs[dev].device->changed) {
+sr.c:  if ((SCpnt->request.cmd == WRITE) && !scsi_CDs[dev].device->writeable)
+sr.c:  s_size = scsi_CDs[dev].device->sector_size;
+sr.c:  SCpnt->transfersize = scsi_CDs[dev].device->sector_size;
+sr.c:  scsi_CDs[MINOR(cdi->dev)].device->access_count++;
+sr.c:  if (scsi_CDs[MINOR(cdi->dev)].device->host->hostt->module)
+sr.c:          
+__MOD_INC_USE_COUNT(scsi_CDs[MINOR(cdi->dev)].device->host->hostt->module);
+sr.c:          cmd[1] = (scsi_CDs[i].device->lun << 5) & 0xe0;
+sr.c:          scsi_CDs[i].device->sector_size = sector_size;
+sr.c:  cmd[1] = (scsi_CDs[i].device->lun << 5) & 0xe0;
+sr.c:          scsi_CDs[i].device->writeable = 1;
+sr.c:  cgc->cmd[1] |= device->lun << 5;
+sr.c:          scsi_CDs[i].device->sector_size = 2048;         /* A guess, just in 
+case */
+sr.c:          scsi_CDs[i].device->changed = 1;        /* force recheck CD type */
+sr.c:          scsi_CDs[i].device->ten = 1;
+sr.c:          scsi_CDs[i].device->remap = 1;
+sr.c:                    devfs_register (scsi_CDs[i].device->de, "cd",
+sr.c:  if (scsi_CDs[0].device && scsi_CDs[0].device->host->sg_tablesize)
+sr_ioctl.c:                    scsi_CDs[target].device->changed = 1;
+sr_ioctl.c:    sr_cmd[1] = ((scsi_CDs[minor].device->lun) << 5);
+sr_ioctl.c:    sr_cmd[1] = ((scsi_CDs[MINOR(cdi->dev)].device->lun) << 5);
+sr_ioctl.c:    sr_cmd[1] = ((scsi_CDs[MINOR(cdi->dev)].device->lun) << 5);
+sr_ioctl.c:    sr_cmd[1] = (scsi_CDs[MINOR(cdi->dev)].device->lun) << 5;
+sr_ioctl.c:                    sr_cmd[1] = ((scsi_CDs[target].device->lun) << 5);
+sr_ioctl.c:                    sr_cmd[1] = ((scsi_CDs[target].device->lun) << 5) |
+sr_ioctl.c:            sr_cmd[1] = scsi_CDs[target].device->lun << 5;
+sr_ioctl.c:    cmd[1] = (scsi_CDs[minor].device->lun << 5) | ((format & 7) << 2);
+sr_ioctl.c:    if (blksize != scsi_CDs[minor].device->sector_size) {
+sr_ioctl.c:    cmd[1] = (scsi_CDs[minor].device->lun << 5);
+sr_vendor.c:   char *vendor = scsi_CDs[minor].device->vendor;
+sr_vendor.c:   char *model = scsi_CDs[minor].device->model;
+sr_vendor.c:   if (scsi_CDs[minor].device->type == TYPE_WORM) {
+sr_vendor.c:   cmd[1] = (scsi_CDs[minor].device->lun << 5) | (1 << 4);
+sr_vendor.c:           scsi_CDs[minor].device->sector_size = blocklength;
+sr_vendor.c:           cmd[1] = (scsi_CDs[minor].device->lun << 5);
+sr_vendor.c:                   cmd[1] = (scsi_CDs[minor].device->lun << 5) | 0x03;
+sr_vendor.c:                   cmd[1] = (scsi_CDs[minor].device->lun << 5) | 3;
+sr_vendor.c:           cmd[1] = (scsi_CDs[minor].device->lun << 5);
+sr_vendor.c:           cmd[1] = (scsi_CDs[minor].device->lun << 5);
+sr_vendor.c:   if (2048 != scsi_CDs[minor].device->sector_size) {
+st.c:  cmd[1] |= (SRpnt->sr_device->lun << 5) & 0xe0;
+st.c:  if (STp->device->was_reset)
+st.c:  if (STp->device->host->hostt->module)
+st.c:          __MOD_INC_USE_COUNT(STp->device->host->hostt->module);
+st.c:  (STp->buffer)->use_sg = STp->device->host->sg_tablesize;
+st.c:  if (STp->device->host->hostt->module)
+st.c:      __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
+st.c:  if (STp->device->host->hostt->module)
+st.c:          __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
+st.c:  if (STp->device->was_reset) {
+st.c:      (STp->device->scsi_level >= SCSI_2 &&
+st.c:                  STp->device->was_reset = 0;
+sun3_NCR5380.c:        !setup_use_tagged_queuing || !cmd->device->tagged_supported)
+sun3_NCR5380.c:        !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
+sun3_NCR5380.c://              if (!cmd->device->borken &&
+sun3_NCR5380.c:                        cmd->device->borken = 1;
+sun3_NCR5380.c:                        cmd->device->tagged_supported = 0;
+sun3_NCR5380.c:                    cmd->device->disconnect = 1;
+sym53c8xx.c:   ncr_nvram *nvram = device->nvram;
+sym53c8xx.c:           device->chip.name, unit, device->chip.revision_id,
+sym53c8xx.c:           device->slot.bus, (device->slot.device_fn & 0xf8) >> 3,
+sym53c8xx.c:           device->slot.device_fn & 7,
+sym53c8xx.c:           __irq_itoa(device->slot.irq));
+sym53c8xx.c:           device->slot.irq);
+sym53c8xx.c:   np = __m_calloc_dma(device->pdev, sizeof(struct ncb), "NCB");
+sym53c8xx.c:   np->pdev  = device->pdev;
+sym53c8xx.c:   strncpy(np->chip_name, device->chip.name, sizeof(np->chip_name) - 1);
+sym53c8xx.c:   np->device_id   = device->chip.device_id;
+sym53c8xx.c:   np->revision_id = device->chip.revision_id;
+sym53c8xx.c:   np->bus         = device->slot.bus;
+sym53c8xx.c:   np->device_fn   = device->slot.device_fn;
+sym53c8xx.c:   np->features    = device->chip.features;
+sym53c8xx.c:   np->clock_divn  = device->chip.nr_divisor;
+sym53c8xx.c:   np->maxoffs     = device->chip.offset_max;
+sym53c8xx.c:   np->maxburst    = device->chip.burst_max;
+sym53c8xx.c:   np->myaddr      = device->host_id;
+sym53c8xx.c:   np->base_ba     = device->slot.base;
+sym53c8xx.c:   np->base2_ba    = (np->features & FE_RAM)? device->slot.base_2 : 0;
+sym53c8xx.c:   if (device->slot.io_port) {
+sym53c8xx.c:           request_region(device->slot.io_port, np->base_ws, NAME53C8XX);
+sym53c8xx.c:           np->base_io = device->slot.io_port;
+sym53c8xx.c:   if (request_irq(device->slot.irq, sym53c8xx_intr,
+sym53c8xx.c:                   ncr_name(np), device->slot.irq);
+sym53c8xx.c:   np->irq = device->slot.irq;
+sym53c8xx.c:   if (lp && !lp->numtags && cmd->device && cmd->device->tagged_queue) {
+sym53c8xx.c:                   device->pqs_pds = 1;
+sym53c8xx.c:                   device->host_id = tmp;
+sym53c8xx.c:           chip = &device->chip;
+sym53c8xx.c:   device->pdev            = pdev;
+sym53c8xx.c:   device->slot.bus        = PciBusNumber(pdev);
+sym53c8xx.c:   device->slot.device_fn  = PciDeviceFn(pdev);
+sym53c8xx.c:   device->slot.base       = base;
+sym53c8xx.c:   device->slot.base_2     = base_2;
+sym53c8xx.c:   device->slot.io_port    = io_port;
+sym53c8xx.c:   device->slot.irq        = irq;
+sym53c8xx.c:   device->attach_done     = 0;
+sym53c8xx.c:   for (device = devlist; device; device = device->next) {
+sym53c8xx.c:           if (device->host != host)
+sym53c8xx.c:           tp = &np->target[device->id];
+sym53c8xx.c:           lp = ncr_lp(np, tp, device->lun);
+sym53c8xx.c:           numtags = device_queue_depth(np, device->id, device->lun);
+sym53c8xx.c:           if (!device->tagged_supported)
+sym53c8xx.c:           device->queue_depth = numtags;
+sym53c8xx.c:           if (device->queue_depth < 2)
+sym53c8xx.c:                   device->queue_depth = 2;
+sym53c8xx.c:           if (device->queue_depth > MAX_TAGS)
+sym53c8xx.c:                   device->queue_depth = MAX_TAGS;
+sym53c8xx.c:                   lp->scdev_depth = device->queue_depth;
+sym53c8xx.c:           ncr_setup_tags (np, device->id, device->lun);
+sym53c8xx.c:   np->unit, device->id, device->lun, device->queue_depth);
+tmscsim.c:    PACB pACB = (PACB) disk->device->host->hostdata;
+u14-34f.c:   if (linked_comm && SCpnt->device->queue_depth > 2
+u14-34f.c:                                     && TLDEV(SCpnt->device->type)) {
+u14-34f.c:   if (linked_comm && SCpnt->device->queue_depth > 2
+u14-34f.c:                                     && TLDEV(SCpnt->device->type))
+u14-34f.c:         if (tstatus == BUSY && SCpnt->device->type != TYPE_TAPE)
+u14-34f.c:         else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
+u14-34f.c:                  && SCpnt->device->type == TYPE_DISK
+u14-34f.c:         if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
+u14-34f.c:         if (SCpnt->device->type != TYPE_TAPE
+ultrastor.c:    my_mscp->ca = SCpnt->device->type != TYPE_TAPE;
+wd33c93.c: *          line on a device-by-device basis.
+wd33c93.c:   if (cmd->device->type == 1)   /* tape drive? */
+wd33c93.c:               cmd->device->disconnect = 1;
diff -urN 0/drivers/scsi/scsi.c 0-0/drivers/scsi/scsi.c
--- 0/drivers/scsi/scsi.c       Mon Oct 30 17:44:29 2000
+++ 0-0/drivers/scsi/scsi.c     Thu Jan 11 13:23:54 2001
@@ -1566,6 +1566,7 @@
        int host, channel, id, lun;
        char * buffer;
        int err;
+       int state;
 
        if (!buf || length>PAGE_SIZE)
                return -EINVAL;
@@ -1574,25 +1575,45 @@
                return -ENOMEM;
        copy_from_user(buffer, buf, length);
 
+       /* A few error checks are in order here:
+        * 1) Make sure length is not >= page size.
+        * 2) Make sure the string is terminated properly.
+        * 3) Skip any leading white space.
+         */
+
+       buffer[length] = '\0';
+
+       p = buffer;
+       while ( *p && (*p == ' ' || *p == '\t') ) ++p;
+
+       printk(KERN_INFO "/proc/scsi/scsi command: %s", p);
+
        err = -EINVAL;
-       if (length < 11 || strncmp("scsi", buffer, 4))
+       if ( length - (p - buffer) < 11 || strncmp("scsi", p, 4))
                goto out;
+       p += 4;
+       while ( *p && (*p == ' ' || *p == '\t') ) ++p;
 
        /*
         * Usage: echo "scsi dump #N" > /proc/scsi/scsi
-        * to dump status of all scsi commands.  The number is used to specify the 
level
-        * of detail in the dump.
+        * to dump status of all scsi commands.  The number is used to specify
+        * the level of detail in the dump.
         */
-       if (!strncmp("dump", buffer + 5, 4)) {
+
+       if ( !strncmp("dump", p, 4) ) {
                unsigned int level;
 
-               p = buffer + 10;
+               p += 4;
+               while ( *p && (*p == ' ' || *p == '\t') ) ++p;
 
                if (*p == '\0')
                        goto out;
 
-               level = simple_strtoul(p, NULL, 0);
+               level = simple_strtoul(p, &p, 0);
                scsi_dump_status(level);
+
+               while ( *p && (*p == ' ' || *p == '\t' || *p == '\n') ) ++p;
+               err = p - buffer;
        }
        /*
         * Usage: echo "scsi log token #N" > /proc/scsi/scsi
@@ -1601,15 +1622,14 @@
         */
 #ifdef CONFIG_SCSI_LOGGING             /* { */
 
-       if (!strncmp("log", buffer + 5, 3)) {
+       else if ( !strncmp("log", p, 3) ) {
                char *token;
                unsigned int level;
 
-               p = buffer + 9;
+               p += 3;
+               while ( *p && (*p == ' ' || *p == '\t') ) ++p;
                token = p;
-               while (*p != ' ' && *p != '\t' && *p != '\0') {
-                       p++;
-               }
+               while ( *p && !(*p == ' ' || *p == '\t') ) ++p;
 
                if (*p == '\0') {
                        if (strncmp(token, "all", 3) == 0) {
@@ -1627,8 +1647,9 @@
                        }
                } else {
                        *p++ = '\0';
+                       while ( *p && (*p == ' ' || *p == '\t') ) ++p;
 
-                       level = simple_strtoul(p, NULL, 0);
+                       level = simple_strtoul(p, &p, 0);
 
                        /*
                         * Now figure out what to do with it.
@@ -1659,6 +1680,9 @@
                }
 
                printk(KERN_INFO "scsi logging level set to 0x%8.8x\n", 
scsi_logging_level);
+
+               while ( *p && (*p == ' ' || *p == '\t' || *p == '\n') ) ++p;
+               err = p - buffer;
        }
 #endif /* CONFIG_SCSI_LOGGING */ /* } */
 
@@ -1673,48 +1697,44 @@
         * already connected device. It is perhaps not
         * guaranteed this device doesn't corrupt an ongoing data transfer.
         */
-       if (!strncmp("add-single-device", buffer + 5, 17)) {
-               p = buffer + 23;
+       else if ( !strncmp( "add-single-device", p, 17) ) {
+               p += 17;
+               while ( *p && (*p == ' ' || *p == '\t') ) ++p;
+
+               host = simple_strtoul( p, &p, 0);
+               channel = simple_strtoul( p + 1, &p, 0);
+               id = simple_strtoul( p + 1, &p, 0);
+               lun = simple_strtoul( p + 1, &p, 0);
 
-               host = simple_strtoul(p, &p, 0);
-               channel = simple_strtoul(p + 1, &p, 0);
-               id = simple_strtoul(p + 1, &p, 0);
-               lun = simple_strtoul(p + 1, &p, 0);
-
-               printk(KERN_INFO "scsi singledevice %d %d %d %d\n", host, channel,
-                      id, lun);
+               printk(KERN_INFO "scsi singledevice %d %d %d %d\n", host,
+                       channel, id, lun);
 
-               for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) {
-                       if (HBA_ptr->host_no == host) {
-                               break;
-                       }
-               }
                err = -ENXIO;
-               if (!HBA_ptr)
-                       goto out;
-
-               for (scd = HBA_ptr->host_queue; scd; scd = scd->next) {
-                       if ((scd->channel == channel
-                            && scd->id == id
-                            && scd->lun == lun)) {
+               for ( HBA_ptr = scsi_hostlist;
+                   HBA_ptr; HBA_ptr = HBA_ptr->next)
+                       if (HBA_ptr->host_no == host) 
                                break;
-                       }
-               }
+               if ( !HBA_ptr )
+                       goto out;
 
                err = -ENOSYS;
-               if (scd)
-                       goto out;       /* We do not yet support unplugging */
+               for ( scd = HBA_ptr->host_queue; scd; scd = scd->next)
+                       if ( scd->channel == channel && scd->id == id &&
+                            scd->lun == lun )
+                               break;
+               if ( scd == NULL )
+                       goto out;         /* there is no such device attached */
 
                scan_scsis(HBA_ptr, 1, channel, id, lun);
 
-               /* FIXME (DB) This assumes that the queue_depth routines can be used
-                  in this context as well, while they were all designed to be
-                  called only once after the detect routine. (DB) */
+               /* FIXME (DB) This assumes that the queue_depth routines can be
+                  used in this context as well, while they were all designed 
+                  to be called only once after the detect routine. (DB) */
                /* queue_depth routine moved to inside scan_scsis(,1,,,) so
                   it is called before build_commandblocks() */
 
-               err = length;
-               goto out;
+               while ( *p && (*p == ' ' || *p == '\t' || *p == '\n') ) ++p;
+               err = p - buffer;
        }
        /*
         * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
@@ -1727,34 +1747,29 @@
         *     hardware and thoroughly confuse the SCSI subsystem.
         *
         */
-       else if (!strncmp("remove-single-device", buffer + 5, 20)) {
-               p = buffer + 26;
-
-               host = simple_strtoul(p, &p, 0);
-               channel = simple_strtoul(p + 1, &p, 0);
-               id = simple_strtoul(p + 1, &p, 0);
-               lun = simple_strtoul(p + 1, &p, 0);
+       else if ( !strncmp("remove-single-device", p, 20) ) {
+               p += 20;
+               while ( *p && (*p == ' ' || *p == '\t') ) ++p;
+
+               host = simple_strtoul( p, &p, 0);
+               channel = simple_strtoul( p + 1, &p, 0);
+               id = simple_strtoul( p + 1, &p, 0);
+               lun = simple_strtoul( p + 1, &p, 0);
 
-
-               for (HBA_ptr = scsi_hostlist; HBA_ptr; HBA_ptr = HBA_ptr->next) {
-                       if (HBA_ptr->host_no == host) {
-                               break;
-                       }
-               }
                err = -ENODEV;
-               if (!HBA_ptr)
+               for ( HBA_ptr = scsi_hostlist;
+                   HBA_ptr; HBA_ptr = HBA_ptr->next)
+                       if ( HBA_ptr->host_no == host ) 
+                               break;
+               if ( !HBA_ptr )
                        goto out;
 
-               for (scd = HBA_ptr->host_queue; scd; scd = scd->next) {
-                       if ((scd->channel == channel
-                            && scd->id == id
-                            && scd->lun == lun)) {
+               for ( scd = HBA_ptr->host_queue; scd; scd = scd->next)
+                       if ( scd->channel == channel && scd->id == id &&
+                            scd->lun == lun )
                                break;
-                       }
-               }
-
-               if (scd == NULL)
-                       goto out;       /* there is no such device attached */
+               if ( scd == NULL )
+                       goto out;         /* there is no such device attached */
 
                err = -EBUSY;
                if (scd->access_count)
@@ -1792,9 +1807,53 @@
                } else {
                        goto out;
                }
-               err = 0;
+
+               while ( *p && (*p == ' ' || *p == '\t' || *p == '\n') ) ++p;
+               err = p - buffer;
+       }
+       /*
+        * Usage: echo "scsi force-device-online 0 1 2 3" >/proc/scsi/scsi
+        *     or echo "scsi force-device-offline 0 1 2 3" >/proc/scsi/scsi
+        * with  "0 1 2 3" replaced by your "Host Channel Id Lun".
+        */
+       else if ( (state = !strncmp( "force-device-online", p, 19)) ||
+                       !strncmp( "force-device-offline", p, 20) ) {
+               p += state ? 19 : 20;
+               while ( *p && (*p == ' ' || *p == '\t') ) ++p;
+
+               host = simple_strtoul(p, &p, 0);
+               channel = simple_strtoul(p + 1, &p, 0);
+               id = simple_strtoul(p + 1, &p, 0);
+               lun = simple_strtoul(p + 1, &p, 0);
+
+               err = -ENODEV;
+               for ( HBA_ptr = scsi_hostlist;
+                   HBA_ptr; HBA_ptr = HBA_ptr->next)
+                       if (HBA_ptr->host_no == host) 
+                               break;
+               if ( !HBA_ptr )
+                       goto out;
+
+               for ( scd = HBA_ptr->host_queue; scd; scd = scd->next)
+                       if ( scd->channel == channel && scd->id == id &&
+                            scd->lun == lun )
+                               break;
+               if ( scd == NULL )
+                       goto out;         /* there is no such device attached */
+
+               printk(KERN_INFO "SCSI device %i:%i:%i:%i was %sline going "
+                       "%sline.\n", scd->host->host_no, scd->channel, scd->id,
+                       scd->lun, scd->online ? "on" : "off",
+                        state ? "on" : "off");
+
+               scd->online = state;
+
+               while ( *p && (*p == ' ' || *p == '\t' || *p == '\n') ) ++p;
+               err = p - buffer;
        }
 out:
+       if ( err < length )
+               printk(KERN_INFO "/proc/scsi/scsi remaining: %s", p);
        
        free_page((unsigned long) buffer);
        return err;
@@ -2011,8 +2070,13 @@
        for (shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next) {
                for (SDpnt = shpnt->host_queue; SDpnt;
                     SDpnt = SDpnt->next) {
-                       if (SDpnt->host->hostt == tpnt)
+                       if (SDpnt->host->hostt == tpnt) {
                                SDpnt->online = FALSE;
+                               printk(KERN_INFO "SCSI device %i:%i:%i:%i taken"
+                                       " offline with host.\n",
+                                       SDpnt->host->host_no, SDpnt->channel,
+                                       SDpnt->id, SDpnt->lun);
+                               }
 
                }
        }
@@ -2277,6 +2341,9 @@
                                (*tpnt->detach) (SDpnt);
                        if (SDpnt->attached == 0) {
                                SDpnt->online = FALSE;
+                               printk(KERN_INFO "SCSI device %i:%i:%i:%i taken"
+                                       " offline.\n", SDpnt->host->host_no,
+                                       SDpnt->channel, SDpnt->id, SDpnt->lun);
 
                                /*
                                 * Nobody is using this device any more.  Free all of 
the
diff -urN 0/drivers/scsi/scsi_error.c 0-0/drivers/scsi/scsi_error.c
--- 0/drivers/scsi/scsi_error.c Wed Nov  8 20:09:50 2000
+++ 0-0/drivers/scsi/scsi_error.c       Wed Jan 10 15:38:38 2001
@@ -1574,7 +1574,8 @@
                         */
                        for (SDloop = host->host_queue; SDloop; SDloop = SDloop->next) 
{
                                for (SCloop = SDloop->device_queue; SCloop; SCloop = 
SCloop->next) {
-                                       if (SCloop->channel != SCpnt->channel) {
+                                       if ( SCloop == SCpnt ||
+                                            SCloop->channel != SCpnt->channel ) {
                                                continue;
                                        }
                                        if (SCloop->state != SCSI_STATE_FAILED
@@ -1635,6 +1636,18 @@
                                                 */
                                                if (rtn != SUCCESS) {
                                                        SCloop->device->online = FALSE;
+                                                       printk( "SCSI device 
+%i:%i:%i:%i not online after "
+                                                               "bus reset.\n", 
+SCloop->host->host_no,
+                                                               SCloop->channel, 
+SCloop->target, SCloop->lun);
+
+                       /*
+                        * No, this is not correct. 1) The test should be made
+                        * with INQUIRE, not TEST_UNIT_READY (see notes in
+                        * patches to scan_scsi_single by Paule G.), and 
+                        * 2) ANY response indicates the device is still
+                        * responding at some minimal level. MTEW
+                        */
+
                                                        SCloop->host->host_failed--;
                                                        
scsi_eh_finish_command(&SCdone, SCloop);
                                                }
@@ -1726,6 +1739,9 @@
                                                }
                                                if (rtn != SUCCESS) {
                                                        SCloop->device->online = FALSE;
+                                                       printk( "SCSI device 
+%i:%i:%i:%i not online after "
+                                                               "bus reset.\n", 
+SCloop->host->host_no, 
+                                                               SCloop->channel, 
+SCloop->target, SCloop->lun);
                                                        SCloop->host->host_failed--;
                                                        
scsi_eh_finish_command(&SCdone, SCloop);
                                                }
@@ -1754,6 +1770,10 @@
                for (SCloop = SDpnt->device_queue; SCloop; SCloop = SCloop->next) {
                        if (SCloop->state == SCSI_STATE_FAILED || SCloop->state == 
SCSI_STATE_TIMEOUT) {
                                SCloop->device->online = FALSE;
+                               printk( "SCSI device %i:%i:%i:%i offline "
+                                       "because of host failere.\n",
+                                       SCloop->host->host_no, SCloop->channel,
+                                       SCloop->target, SCloop->lun);
 
                                /*
                                 * This should pass the failure up to the top level 
driver, and

Reply via email to