Ken Bass wrote:
> 
> I just did a test. If I use the SCSI_IOCTL_SEND_COMMAND instead of /dev/sg,
> everything is okay.

Strange, both techniques call scsi_allocate_device() with
the same arguments.

Ah, looking at lk 2.2.18 I can see that if scsi_allocate_device()
sleeps it is waiting on 'device_wait' which needs to be
manually "kicked" by other command sources. There is such a
"kick" coming from:
  sd
  sr
  sg
  scsi_ioctl
but not st. This error prone mechanism has been fixed
in lk 2.4 .
 
> On Sat, 27 Jan 2001 17:42:28 -0500, Ken Bass <[EMAIL PROTECTED]> wrote:
> 
> >I am really stuck. I'm using the /dev/sg driver in cooperation with the
> >/dev/st driver.
> >I am using fwrite to the /dev/st device to write data to a tape. Every 10
> >seconds, the same task, uses /dev/sg to request a LOG SENSE. I'm trying to
> >monitor the data compression statistics, as well as the tape capacity pages.
> >(Pages 0x39 and 0x31 and 0x07).
> >
> >When I fwrite to the /dev/sg. The task hangs and the SCSI bus is screwed up.
> >I cannot kill -9 the task. Looking at ps, it appears WCHAN is stuck in
> >scsi_allocate_device(). (It says scsi_a, I'm assuming its allocate_device
> >from looking at the sg code).

An improvement in lk 2.4 is that the wait in scsi_allocate_device()
is interruptible.

> >I have to reboot my system and suffer a long and excruciating fsck each
> >time.
> >
> >Here is the odd thing. When I am using /dev/st RD_ONLY, I dont have this
> >problem. I use the same routines to read the log pages and they work fine.
> >It appears this is only happening with I'm using /dev/st WR_ONLY.
>
> >Any ideas? Suggestions? How would I even debug something like this?
> >I might try seeing if I can not use /dev/sg and issue the same command vi
> >/dev/st deprecated ioctl. But my task will have to be root for that. I am
> >trying to use /dev/sg.

The sd, sr and st drivers assume they have exclusive
control over a device that they have an open file
descriptor on. So opening a "back door" with sg may 
cause problems (but probably not at the level Ken has
reported).

Doug Gilbert

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to