public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Douglas Gilbert <dougg@torque.net>
Cc: Pat LaVarre <p.lavarre@ieee.org>, linux-scsi@vger.kernel.org
Subject: Re: sg MiB writes scheduling while atomic
Date: Tue, 16 Sep 2003 12:42:38 +0100	[thread overview]
Message-ID: <20030916114238.GA21596@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <3F66AF1B.5010402@torque.net>

On Tue, Sep 16, 2003 at 04:35:07PM +1000, Douglas Gilbert wrote:
> A user process is doing IO and the user decides to kill the
> process while a command is "in flight". After the user hits
> Ctrl+C, sg_close() is called and the sg driver lets it go
> through (i.e. doesn't hold the user process in an unkillable
> wait). Since the sg driver knows a command done notification
> is coming (callback to sg_cmd_done()) then it keeps all its
> related instances alive (including the scsi_device instance)
> and notes this situation by setting its sfp->close flag.
> 
> When the callback arrives, the respone is discarded and if
> this is the last outstanding command on this device then
> scsi_device_put(sdp->device) is called. scsi_device_put()
> isn't designed to be called from such a context. However sg
> (and all other upper level drivers I suspect) have no suitable
> context to call scsi_device_put() from in this situation.
> 
> Holding the sg_close() until the response arrives is an ugly
> solution. Any better suggestions?

scsi_device_put() calls down_write() so it needs to be called in process
context.  Probably the best way to do this is by calling schedule_work().
An ickier solution would be to hijack an error handling thread ;-)

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

  reply	other threads:[~2003-09-16 11:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3F5E434D.6080801@unixsol.org>
2003-09-10 16:23 ` [linux-usb-devel] [2.6-test] Bug in usb-storage or scsi? Alan Stern
2003-09-10 18:16   ` [usb-storage] " Pat LaVarre
2003-09-10 18:49     ` sg MiB writes scheduling while atomic Pat LaVarre
2003-09-10 19:30       ` Pat LaVarre
2003-09-16  6:35         ` Douglas Gilbert
2003-09-16 11:42           ` Matthew Wilcox [this message]
2003-09-16 12:58             ` Christoph Hellwig
2003-10-14 23:36             ` Pat LaVarre
2003-09-10 20:08       ` [PATCH] mount -w of dvd+rw etc. in vanilla 2.6 Pat LaVarre
2003-09-10 22:49         ` Patrick Mansfield
2003-09-22 14:52       ` max GiB written per boot Pat LaVarre
2003-09-10 20:51     ` unsolicited sense in 2.6.0-test5 usb-storage.ko Pat LaVarre
2003-09-10 21:03       ` [usb-storage] " Alan Stern
2003-09-10 21:24         ` Pat LaVarre
2003-09-10 21:52           ` Matthew Dharm
2003-09-10 22:08             ` Pat LaVarre
2003-09-12  0:21               ` Pat LaVarre
2003-09-12  0:29                 ` Pat LaVarre
2003-09-16 11:28             ` Douglas Gilbert
2003-09-11  0:02   ` [linux-usb-devel] [2.6-test] Bug in usb-storage or scsi? Patrick Mansfield
2003-09-11 20:04     ` [usb-storage] " Pat LaVarre
2003-09-11 20:05     ` Alan Stern
2003-09-11 20:19       ` James Bottomley
2003-09-12 21:17         ` Alan Stern
2003-09-11 20:42       ` Pat LaVarre
2003-09-12 19:59         ` Alan Stern
2003-09-12 19:18       ` Pat LaVarre
2003-09-12 18:43     ` Pat LaVarre
2003-09-12 20:56       ` Patrick Mansfield
2003-09-12 21:53         ` 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=20030916114238.GA21596@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox