Re: Funny SCSI thing with 2.2.1

Doug Ledford (dledford@redhat.com)
Sun, 14 Feb 1999 00:50:34 -0500


Raimi wrote:
>
> Hello!
>
> I just installed the 2.2.1 Kernel. I love the framebuffers so I won't
> downgrade. But:
>
> I wanted to write a CD as I did with 2.0.36 some weeks ago. The program I
> used was "cdwrite" which uses the generic scsi devices to write.
>
> I made cdwrite use /dev/sg3 being my cdwriter but when it started it used
> not the cdwriter but the harddisk containing my linux root filesystem !!!!
>
> The action luckily failed without error (besides a strange syslog message
> I don't have here). The filesystem was not harmed but my partition table
> was destroyed, I had to recover it with some DOS program...
>
> Anyway, I use an Adaptect 2940UW (AIC7880). Is it possible that the
> driver accessed the wrong drive ?

Nope, by the time the commands make it to the low level driver, the
device target/lun entries have already been filled out by the upper
level SCSI code.

> Can someone check this? Let me (by email) know how I can help to identify
> the guilty code...

The allocation of sg devices on your system has changed for whatever
reason. You just need to find the right sg device for your CD-R to make
things work. The general rule is, if the sg driver doesn't openly claim
any devices, then walk the device list in /proc/scsi/scsi and assign
each device and entry in the form of sga to sg? in the order they are
listed in that file. When you hit your CD-R, you will have your
device. However, if the SG driver *does* claim some of the devices at
startup (aka, is says /dev/sga on scsi host x... during the startup
messages), then you have to start your counting with the first sg?
device after the last sg device name that was printed out. IOW, if the
SCSI code claimed you had two sd devices, one st device, and one sg
device, then /dev/sga would belong to the device that was claimed as sga
at bootup, sgb would belong to the first device listed in
/proc/scsi/scsi that isn't already claimed by the sg driver, sgc would
be the second device, etc, you get the point. Track down that device
name change and it will be settled.

-- 
  Doug Ledford   <dledford@redhat.com>
   Opinions expressed are my own, but
      they should be everybody's.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/