From: Tejun Heo <htejun@gmail.com>
To: James.Bottomley@steeleye.com, axboe@suse.de,
Christoph Hellwig <hch@infradead.org>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH scsi-misc-2.6 00/04] scsi: scsi_request_fn() reimplementation
Date: Tue, 12 Apr 2005 19:32:48 +0900 (KST) [thread overview]
Message-ID: <20050412103128.69172FEB@htj.dyndns.org> (raw)
Hello, guys.
This patchset reimplements scsi_request_fn(). All prep's are moved
into prep_fn and all state checking/issueing are moved into
scsi_reqfn. prep_fn() only terminates/defers unpreparable requests
and all requests are terminated through scsi midlayer.
[ Start of patch descriptions ]
01_scsi_reqfn_consolidate_error_handling.patch
: consolidate error handling out of scsi_init_io() into scsi_prep_fn()
This patch fixes a queue stall bug which occurred when sgtable
allocation failed and device_busy == 0. When scsi_init_io()
returns BLKPREP_DEFER or BLKPREP_KILL, it's supposed to free
resources itself. This patch consolidates defer and kill
handling into scsi_prep_fn().
Note that this patch doesn't consolidate state defer/kill
handlings in scsi_prep_fn(). They were omitted as all state
checks will be moved into scsi_reques_fn() by the following
reqfn_reimpl patch.
ret value checking was changed to switch() as in James's
patch. Also, kill: comment is copied from James's patch.
02_scsi_reqfn_move_preps_to_prep_fn.patch
: move request preps in other places into prep_fn()
Move request preparations scattered in scsi_request_fn() and
scsi_dispatch_cmd() into scsi_prep_fn()
* CDB_SIZE check in scsi_dispatch_cmd()
* SCSI-2 LUN preparation in scsi_dispatch_cmd()
No invalid request reaches scsi_request_fn() anymore.
Note that scsi_init_cmd_errh() is still left in
scsi_request_fn(). As all requeued requests need its sense
buffer and result value cleared, we can't move this to
prep_fn() yet. This is moved into prep_fn in the following
requeue path consoildation patchset.
03_scsi_reqfn_reimplementation.patch
: reimplement scsi_request_fn()
This patch rewrites scsi_request_fn(). scsi_dispatch_cmd() is
merged into scsi_request_fn(). Goals are
* Remove unnecessary operations (host_lock unlocking/locking,
recursing into scsi_run_queue(), ...)
* Consolidate defer/kill paths.
* Be concise.
The following bugs are fixed.
* All killed requests now get fully prep'ed and pass through
__scsi_done(). This is the only kill path.
- scsi_cmnd leak in offline-kill path removed
- unfinished request bug in
scsi_dispatch_cmd():SDEV_DEL-kill path removed.
- commands are never terminated directly from blk
layer unless they are invalid, so no need to supply
req->end_io callback for special requests.
* Timer is added while holding host_lock, after all conditions
are checked and serial number is assigned. This guarantees
that until host_lock is released, the scsi_cmnd pointed to
by cmd isn't released. That didn't hold in the original
code and, theoretically, the original code could access
already released cmd.
* For the same reason, if shost->hostt->queuecommand() fails,
we try to delete the timer before releasing host_lock.
Other changes/notes
* host_lock is acquired and released only once.
enter (qlocked) -> enter loop -> dev-prep -> switch to hlock -\
^---- switch to qlock <- issue <- host-prep <-/
* unnecessary if () on get_device() removed.
* loop on elv_next_request() instead of blk_queue_plugged().
We now explicitly break out of loop when we plug and check if
the queue has been plugged underneath us at the end of loop.
* All device/host state checks are done in this function and
done only once while holding qlock/host_lock respectively.
* Requests which get deferred during dev-prep are never
removed from request queue, so deferring is achieved by
simply breaking out of the loop and returning.
* Failure of blk_queue_start_tag() on tagged queue is a BUG
now. This condition should have been catched by
scsi_dev_queue_ready().
* req->special == NULL test removed. This just can't happen,
and even if it ever happens, scsi_request_fn() will
deterministically oops.
* Requests which gets deferred during host-prep are requeued
using blk_requeue_request(). This is the only requeue path.
Note that scsi_kill_requests() still terminates requests using
blk layer. The path is circular-ref workaround and soon to be
replaced, so ignore it for now.
04_scsi_reqfn_remove_wait_req_end_io.patch
: remove unnecessary scsi_wait_req_end_io()
As all requests are now terminated via scsi midlayer, we don't
need to set end_io for special reqs, remove it.
Note that scsi_kill_requests() still terminates requests using
blk layer. The path is circular-ref workaround and soon to be
replaced, so ignore it for now.
[ End of patch descriptions ]
Thanks a lot.
next reply other threads:[~2005-04-12 18:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-12 10:32 Tejun Heo [this message]
2005-04-12 10:32 ` [PATCH scsi-misc-2.6 01/04] scsi: consolidate error handling out of scsi_init_io() into scsi_prep_fn() Tejun Heo
2005-04-12 10:32 ` [PATCH scsi-misc-2.6 02/04] scsi: move request preps in other places into prep_fn() Tejun Heo
2005-04-12 10:33 ` [PATCH scsi-misc-2.6 03/04] scsi: reimplement scsi_request_fn() Tejun Heo
2005-04-12 10:37 ` Tejun Heo
2005-04-12 10:33 ` [PATCH scsi-misc-2.6 04/04] scsi: remove unnecessary scsi_wait_req_end_io() Tejun Heo
2005-04-12 11:01 ` [PATCH scsi-misc-2.6 00/04] scsi: scsi_request_fn() reimplementation Tejun Heo
2005-05-14 13:57 Tejun Heo
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=20050412103128.69172FEB@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=James.Bottomley@steeleye.com \
--cc=axboe@suse.de \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.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
all inboxes | Powered by JetHome®