All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Pat LaVarre <p.lavarre@ieee.org>
Cc: linux-scsi@vger.kernel.org
Subject: SG_IO ioctl (was: mode sense blacklist how)
Date: Fri, 21 Nov 2003 11:17:16 +1000	[thread overview]
Message-ID: <3FBD679C.5010405@torque.net> (raw)
In-Reply-To: <1069345927.6663.27.camel@patrh9>

Pat LaVarre wrote:
>>>>The only really important question IMHO is
>>>>how come SG_IO is not interruptible.
>>>
>>>Yes, now being pursued by Doug G in this thread.
>>
>>block/scsi_ioctl.c...
>>I suspect ... cannot interrupt the sg_io... blk_do_rq...
>>Perhaps someone could enlighten me (and I could document it).
>>
>>Further it looks like the SCSI_IOCTL_SEND_COMMAND is not
>>interruptible either. See scsi_wait_req() in scsi_lib.c .
> 
> 
> Open question I see.
> 
> 
>>Apologies in advance for each reboot these experiments force on you.
>>...
>>sg.c .... coping with orphaned SCSI responses from user killed
>>processes requires a lot of logic ...
> 
> 
> Ouch.
> 
> Designing an lk 2.6 user app to recommend more prominent devie names
> like /dev/hdd and /dev/scd0 in place of less prominent /dev/sg$n names
> thereby steers people into using the less robust pass thru of SG_IO via
> block/scsi_ioctl.c.

Pat,
Well it's a trade-off. If you use the SG_IO in
the block layer then:

Pros:
   - convenience (for block devices)
   - no device mapping problems (sd <-> sg) **

Cons:
   - no help for "non-block" devices: tapes, enclosures,
     OSD, etc
   - inherit block layer policy (e.g. 128 KB xfer limit,
     direct IO alignment)
   - unable to interrupt a SCSI command in progress with
     a signal
   - associated ioctls are dummies or not there, hence unable
     to reset device/bus/host (for example)
   - no driver or host error reporting (only SCSI status)

I'm sure more "cons" will come to light and some will be
addressed. There is probably enough there already to give
the cdrecord author pause for thought.

>>I suspect ... cannot interrupt ...
> 
> 
> Sorry I'm too much of a kernelnewbie to guess confidently the full
> implications of "not interruptible".  Does "not interruptible" mean
> timeouts don't work, or does "not interruptible" mean that only timeouts
> work, or does "not interruptible" mean that only timeouts and resets but
> not SIGINT of the calling process works ...

"Linux Kernel Development" Robert Love ISBN 0-672-32512-8 covers
lk 2.6 pretty well including these issues. [Note in passing: the
book makes no mention of the SCSI or ATA subsystems or aio:-(]

"not interruptible" in this context means that signals (e.g.
control-C from the keyboard or kill-9) have no effect while
waiting for the SCSI response. The SCSI command timeout should
bring things back but often at the expense of a bus reset (on
SPI) which can have some nasty side effects (e.g. if your root
file system is on a disk on the same SPI bus).


** The sd/sr/st <-> sg mapping problem would be much simpler
in lk 2.6 if sg (plus st + osst) had sysfs visibility. Perhaps
udev could work out this mapping but this would still rely
on polling through sg, st and osst file descriptors with the
attendant problems that brings (e.g. blocking, O_EXCL, O(n)).

Doug Gilbert





  reply	other threads:[~2003-11-21  1:30 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12 23:50 [PATCH] fix Sony USB mass storage - pass larger receive buffer Patrick Mansfield
2003-11-13  0:09 ` Matthew Dharm
2003-11-13  0:13   ` Patrick Mansfield
2003-11-13  0:44     ` Patrick Mansfield
2003-11-13  1:56       ` Matthew Dharm
2003-11-13 14:54         ` [usb-storage] " Alan Stern
2003-11-13 16:21           ` Pat LaVarre
2003-11-13 17:09             ` Alan Stern
2003-11-13 17:24               ` Pat LaVarre
2003-11-13 18:04                 ` Patrick Mansfield
2003-11-13 18:15                   ` Pat LaVarre
2003-11-13 18:22                     ` Pat LaVarre
2003-11-13 18:26                       ` Pat LaVarre
2003-11-13 18:37                         ` Pat LaVarre
2003-11-13 19:13                           ` Matthew Dharm
2003-11-13 19:30                             ` Pat LaVarre
2003-11-13 22:03                               ` Alan Stern
2003-11-13 23:40                                 ` Pat LaVarre
2003-11-13 23:51                                   ` Dmitri Katchalov
2003-11-14  0:16                                     ` Pat LaVarre
2003-11-14  1:04                                   ` Matthew Dharm
2003-11-14  1:10                                     ` Pat LaVarre
2003-11-14  1:13                                       ` Matthew Dharm
2003-11-13 22:01                 ` Alan Stern
2003-11-13 23:37                   ` Pat LaVarre
2003-11-14  0:24                     ` Patrick Mansfield
2003-11-14  1:54                       ` Pat LaVarre
2003-11-14  2:08                         ` Matthew Dharm
2003-11-14  2:24                           ` Pat LaVarre
2003-11-17 21:38                       ` Pat LaVarre
2003-11-17 22:00                         ` Patrick Mansfield
2003-11-17 23:36                           ` Pat LaVarre
2003-11-14  1:03                     ` Matthew Dharm
2003-11-13 23:44                   ` Pat LaVarre
2003-11-14  0:13                     ` Dmitri Katchalov
2003-11-14  0:55                       ` Pat LaVarre
2003-11-14  1:13                       ` Matthew Dharm
2003-11-14  2:02                         ` Pat LaVarre
2003-11-14  2:10                       ` Pat LaVarre
2003-11-14  2:19                         ` Matthew Dharm
2003-11-14  2:38                           ` [usb-storage] mode sense blacklist how Pat LaVarre
2003-11-14  2:44                             ` Matthew Dharm
2003-11-14 17:27                               ` Pat LaVarre
2003-11-14 17:57                                 ` Pat LaVarre
2003-11-14  3:11                             ` Dmitri Katchalov
2003-11-14 19:41                               ` Pat LaVarre
     [not found]                                 ` <20031114153607.A7207@beaverton.ibm.com>
     [not found]                                   ` <20031116121039.A13224@beaverton.ibm.com>
2003-11-17 20:14                                     ` Pat LaVarre
2003-11-19 12:55                                 ` Dmitri Katchalov
2003-11-19 16:34                                   ` Pat LaVarre
2003-11-19 17:02                                   ` Pat LaVarre
2003-11-19 23:34                                     ` Douglas Gilbert
2003-11-20 16:32                                       ` Pat LaVarre
2003-11-21  1:17                                         ` Douglas Gilbert [this message]
2003-11-21  3:18                                           ` SG_IO ioctl (was: mode sense blacklist how) Willem Riede
2003-11-21 20:51                                           ` Pat LaVarre
2003-11-28 17:07                                             ` Pat LaVarre
2003-11-28 17:14                                               ` Pat LaVarre
2003-11-28 17:31                                               ` Pat LaVarre
2003-11-28 17:09                                             ` Pat LaVarre
2003-11-21 21:29                                           ` Pat LaVarre
2003-11-20 14:06                                     ` [usb-storage] mode sense blacklist how Dmitri Katchalov
2003-11-20 15:57                                       ` Pat LaVarre
2003-11-14  1:06                     ` [usb-storage] Re: [PATCH] fix Sony USB mass storage - pass larger receive buffer Matthew Dharm
2003-11-14 16:14                     ` Alan Stern
2003-11-14 17:29                       ` Matthew Dharm
2003-11-14 17:50                       ` Pat LaVarre
2003-11-14  2:02 ` Douglas Gilbert
2003-11-14 21:45   ` [usb-storage] " Pat LaVarre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FBD679C.5010405@torque.net \
    --to=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=p.lavarre@ieee.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.