aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2007-04-02[SCSI]: Fix scsi_send_eh_cmnd scatterlist handlingDavid S. Miller1-1/+1
This fixes a regression caused by commit: 2dc611de5a3fd955cd0298c50691d4c05046db97 The sense buffer code in scsi_send_eh_cmnd was changed to use alloc_page() and a scatter list, but the sense data copy was not updated to match so what we actually get in the sense buffer is total grabage starting with the kernel address of the struct page we got. Basically the stack frame of scsi_send_eh_cmd() is what ends up in the sense buffer. Depending upon how pointers look on a given platform, you can end up getting sr_ioctl.c errors when you mount a cdrom. If the CDROM gives a check condition for GPCMD_GET_CONFIGURATION issued by drivers/cdrom/cdrom.c:cdrom_mmc_profile(), sr_ioctl will spit out this error message in sr_do_ioctl() with the way pointers are on sparc64: default: printk(KERN_ERR "%s: CDROM (ioctl) error, command: ", cd->cdi.name); __scsi_print_command(cgc->cmd); scsi_print_sense_hdr("sr", &sshdr); err = -EIO; This is the error Tom Callaway reported in: http://marc.info/?l=linux-sparc&m=117407453208101&w=2 Anyways, fix this by using page_address(sgl.page) which is OK because we know this is low-mem due to GFP_ATOMIC. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Christoph Hellwig <hch@lst.de>
2007-02-03[SCSI] scsi_error: Fix lost EH commandsBrian King1-116/+123
If an EH command times out today, the LLDD's abort handler will be called to abort the command. It is assumed that this completes successfully, which can result in the command getting completed later resulting in an oops. Improve the current implementation by escalating all the way to host reset if necessary in order to clean up the EH command. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-01-31[SCSI] Fix sense key MEDIUM ERROR processing and retryLuben Tuikov1-0/+5
1) If the device reports an uncorrectable MEDIUM ERROR, such as SK MEDIUM ERROR, ASC UNRECOVERED READ ERR, AMNF DATA FIELD or RECORD NOT FOUND, then: In scsi_check_sense() return SUCCESS so as to not retry -- the error is uncorrectable -- this speeds up total processing time. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Extracted the MEDIUM ERROR piece and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-01-27[SCSI] scsi_error.c: Export some scsi_eh_* functionsDarrick J. Wong1-5/+7
Export a couple of functions from scsi_error that are needed to handle failed SCSI commands from the SAS EH. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> make exports GPL and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-11-15[SCSI] use one-element sg list in scsi_send_eh_cmndChristoph Hellwig1-9/+24
scsi_send_eh_cmnd is the last user of non-sg commands currently. This patch switches it to a one-element SG list. Also updates the kerneldoc comment for scsi_send_eh_cmnd to reflect reality while we're at it. Test on my mptsas card, but this should get testing with as many drivers as possible. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-10-10[PATCH] gfp annotations: scsi_errorAl Viro1-1/+1
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-13[PATCH] SCSI: lockdep annotation in scsi_send_eh_cmndStefan Richter1-1/+1
Fixup for lockdep enabled kernels: Annotate an on-stack completion. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: James Bottomley <James.Bottomley@steeleye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-26[SCSI] fix scsi_send_eh_cmnd regressionMike Christie1-9/+9
The callers of scsi_send_eh_cmnd are setting the cmnd buffer, and then scsi_send_eh_cmnd is copying that updated buffer to the old_cmnd variable. Then after the command runs, we end up copying that old_cmnd var which has the new cmnd to the scsi command buffer. When this command gets recent, all types of fun things happen like getting TUR or START_STOP commands with data and scatterlists. This patch made against scsi-rc-fixes, has the callers of scsi_send_eh_cmnd pass in the command so scsi_send_eh_cmnd can do the right thing. This should go into 2.6.18 since this fixes a regression added when we removed some of the scsi_cmnd fields and replaced them with local variables. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-07-09[SCSI] hide EH backup data outside the scsi_cmndChristoph Hellwig1-121/+89
Currently struct scsi_cmnd has various fields that are used to backup original data after the corresponding fields have been overridden for EH commands. This means drivers can easily get at it and misuse it. Due to the old_ naming this doesn't happen for most of them, but two that have different names have been used wrong a lot (see previous patch). Another downside is that they unessecarily bloat the scsi_cmnd size. This patch moves them onstack in scsi_send_eh_cmnd to fix those two issues aswell as allowing future EH fixes like moving the EH command submissions to use SG lists like everything else. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-27[SCSI] Block I/O while SG reset operation in progress - the midlayer patchJames Smart1-0/+22
The scsi midlayer portion of the patch Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-22Merge branch 'master' into upstreamJeff Garzik1-14/+1
Conflicts: drivers/scsi/libata-core.c drivers/scsi/libata-scsi.c include/linux/pci_ids.h
2006-06-10[SCSI] remove RQ_SCSI_* flagsChristoph Hellwig1-3/+0
The RQ_SCSI_* flags are a vestiage of a long past history. The EH code still sets them but we never make use of that information. The other users is pluto.c which never had a chance to work but needs to be kept compiling to keep Davem happy, so copy over the definition there. We could probably get rid of RQ_ACTIVE/RQ_INACTIVE aswell with some work, there's only two more or less bogus looking uses in ubd and scsi. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-10[SCSI] remove scsi_request infrastructureChristoph Hellwig1-11/+1
With Achim patch the last user (gdth) is switched away from scsi_request so we an kill it now. Also disables some code in i2o_scsi that was broken since the sg driver stopped using scsi_requests. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-05-20[PATCH] SCSI: make scsi_implement_eh() generic API for SCSI transportsTejun Heo1-1/+22
libata implemented a feature to schedule EH without an associated EH by manipulating shost->host_eh_scheduled in ata_scsi_schedule_eh() directly. Move this function to scsi_error.c and rename it to scsi_schedule_eh(). It is now an exported API for SCSI transports and exported via new header file drivers/scsi/scsi_transport_api.h This patch also de-export scsi_eh_wakeup() which was exported specifically for ata_scsi_schedule_eh(). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-05-15[PATCH] SCSI: implement shost->host_eh_scheduledTejun Heo1-1/+2
libata needs to invoke EH without scmd. This patch adds shost->host_eh_scheduled to implement such behavior. Currently the only user of this feature is libata and no general interface is defined. This patch simply adds handling for host_eh_scheduled where needed and exports scsi_eh_wakeup() to modules. The rest is upto libata. This is the result of the following discussion. http://thread.gmane.org/gmane.linux.scsi/23853/focus=9760 In short, SCSI host is not supposed to know about exceptions unrelated to specific device or command. Such exceptions should be handled by transport layer proper. However, the distinction is not essential to ATA and libata is planning to depart from SCSI, so, for the time being, libata will be using SCSI EH to handle such exceptions. Signed-off-by: Tejun Heo <htejun@gmail.com>
2006-04-10[PATCH] move ->eh_strategy_handler to the transport classChristoph Hellwig1-2/+2
Overriding the whole EH code is a per-transport, not per-host thing. Move ->eh_strategy_handler to the transport class, same as ->eh_timed_out. Downside is that scsi_host_alloc can't check for the total lack of EH anymore, but the transition period from old EH where we needed it is long gone already. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-03-21Merge ../linux-2.6James Bottomley1-3/+4
2006-03-14Merge ../linux-2.6James Bottomley1-2/+2
2006-03-13[SCSI] FC transport : Avoid device offline cases by stalling aborts until device unblockedJames Smart1-6/+3
This moves the eh_timed_out functionality from the scsi_host_template to the transport_template. Given that this is now a transport function, the EH_RESET_TIMER case no longer caps the timer reschedulings. The transport guarantees that this is not an infinite condition. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-03-01Merge branch 'master'Jeff Garzik1-2/+2
2006-02-27[SCSI] scsi: scsi command retries off by one fixBrian King1-2/+2
Fix up an off by one error in calculating retries for scsi commands. This bug was discovered when an SG_IO request was sent to scsi core with retries = 0, causing the overall timeout check to go off in scsi_softirq_done. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-02Merge branch 'master'Jeff Garzik1-1/+1
2006-01-26[PATCH] SCSI: export scsi_eh_finish_cmd() and scsi_eh_flush_done_q()Tejun Heo1-3/+4
Export two SCSI EH command handling functions. To be used by libata EH. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2006-01-26[SCSI] Prevent scsi_execute_async from guessing cdb lengthbrking@us.ibm.com1-1/+1
When the scsi_execute_async interface was added it ended up reducing the flexibility of userspace to send arbitrary scsi commands through sg using SG_IO. The SG_IO interface allows userspace to specify the CDB length. This is now ignored in scsi_execute_async and it is guessed using the COMMAND_SIZE macro, which is not always correct, particularly for vendor specific commands. This patch adds a cmd_len parameter to the scsi_execute_async interface to allow the caller to specify the length of the CDB. Signed-off-by: Brian King <brking@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15Merge by hand (conflicts in scsi_lib.c)James Bottomley1-1/+6
This merge is pretty extensive. The conflict is over the new req->retries parameter, so I had to change the prototype to scsi_setup_blk_pc_cmnd() and the usage in sd, sr and st. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-14[SCSI] Convert SCSI mid-layer to scsi_execute_asyncMike Christie1-38/+9
Add scsi helpers to create really-large-requests and convert scsi-ml to scsi_execute_async(). Per Jens's previous comments, I placed this function in scsi_lib.c. I made it follow all the queue's limits - I think I did at least :), so I removed the warning on the function header. I think the scsi_execute_* functions should eventually take a request_queue and be placed some place where the dm-multipath hw_handler can use them if that failover code is going to stay in the kernel. That conversion patch will be sent in another mail though. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-08[SCSI] fix OOPS due to clearing eh_action prior to aborting eh commandMichael Reed1-1/+6
The eh_action semaphore in scsi_eh_send_command is cleared after a command timeout. The command is subsequently aborted and the abort will try to call scsi_done() on it. Unfortunately, the scsi_eh_done() routine unconditinally completes the semaphore (which is now null). Fix this race by makiong the scsi_eh_done() routine check that the semaphore is non null before completing it (mirroring the ordinary command done/timeout logic). Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-06[SCSI] use a completion in scsi_send_eh_cmndChristoph Hellwig1-78/+29
scsi_send_eh_cmnd currently uses a semaphore and an overload of eh_timer to either get a completion for a command for a timeout. Switch to using a completion and wait_for_completion_timeout to simply the code and not having to deal with the races ourselves. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-06[SCSI] remove Scsi_Host.eh_activeChristoph Hellwig1-4/+0
now that the abuse in qla2xxx is gone this field can be remove. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-06[SCSI] tidy up scsi_error_handlerChristoph Hellwig1-29/+17
adjust comments, remove a useless cast and remove a write-only variable. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] use scmd_id(), scmd_channel() throughout codeJeff Garzik1-7/+9
Wrap a highly common idiom. Makes the code easier to read, helps pave the way for sdev->{id,channel} removal, and adds a token that can easily by grepped-for in the future. There are a couple sdev_id() and scmd_printk() updates thrown in as well. Rejections fixed up and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] use {sdev,scmd,starget,shost}_printk in generic codeJeff Garzik1-4/+3
rejections fixed and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] move the mid-layer printk's over to shost/starget/sdev_printkJames Bottomley1-16/+9
This should eliminate (at least in the mid layer) to make numeric assumptions about any of the enumeration variables. As a side effect, it will also make all the messages consistent and line us up nicely for the error logging strategy (if it ever shows itself again). Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-19[PATCH] scsi_error thread exits in TASK_INTERRUPTIBLE state.Steven Rostedt1-0/+2
Found in the -rt patch set. The scsi_error thread likely will be in the TASK_INTERRUPTIBLE state upon exit. This patch fixes this bug. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-19[SCSI] Fix thread termination for the SCSI error handleJames Bottomley1-32/+23
From: Alan Stern <stern@rowland.harvard.edu> This patch (as561) fixes the error handler's thread-exit code. The kthread_stop call won't wake the thread from a down_interruptible, so the patch gets rid of the semaphore and simply does set_current_state(TASK_INTERRUPTIBLE); Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Modified to simplify the termination loop and correct the sleep condition. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-19[SCSI] fix oops on usb storage device disconnectJames Bottomley1-7/+16
We fix the oops by enforcing the host state model. There have also been two extra states added: SHOST_CANCEL_RECOVERY and SHOST_DEL_RECOVERY so we can take the model through host removal while the recovery thread is active. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06Merge by hand (conflicts in sd.c)James Bottomley1-30/+5
2005-09-06[SCSI] unexport scsi_add_timer/scsi_delete_timerChristoph Hellwig1-2/+0
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06[SCSI] switch EH thread startup to the kthread APIChristoph Hellwig1-27/+2
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06[SCSI] return success after retries in scsi_eh_turAlan Stern1-1/+3
The problem lies in the way the error handler uses TEST UNIT READY to tell whether error recovery has succeeded. The scsi_eh_tur function gives up after one round of retrying; after that it decides that more error recovery is needed. However TUR is liable to report sense data indicating a retry is needed when in fact error recovery has succeeded. A typical example might be SK=2, ASC=4, ASCQ=1 (Logical unit in process of becoming ready). The mere fact that we were able to get a sensible reply to the TUR should indicate that the device is working well enough to stop error recovery. I ran across a case back in January where this happened. A CD-ROM drive timed out the INQUIRY command, and a device reset fixed the blockage. But then the drive kept responding with 2/4/1 -- because it was spinning up I suppose -- until the error handler gave up and placed it offline. If the initial INQUIRY had received the 2/4/1 instead, everything would have worked okay. It doesn't seem reasonable for things to fail just because the error handler had started running. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28[SCSI] convert SPI transport class to scsi_executeJames Bottomley1-1/+5
This one's slightly more difficult. The transport class uses REQ_FAILFAST, so another interface (scsi_execute) had to be invented to take the extra flag. Also, the sense functions are shifted around to allow spi_execute to place data directly into a struct scsi_sense_hdr. With this change, there's probably a lot of unnecessary sense buffer allocation going on which we can fix later. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-07-30[SCSI] host state model update: replace old host bitmap stateMike Anderson1-3/+4
Migrate the current SCSI host state model to a model like SCSI device is using. Signed-off-by: Mike Anderson <andmike@us.ibm.com> Rejections fixed up and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-26[SCSI] use list_for_each_entry_safe in scsi_error.cChristoph Hellwig1-38/+19
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-26[SCSI] remove scsi_eh_eflags_ macrosChristoph Hellwig1-11/+10
Just opencoded access to eh_eflags, it's much more readable anyway. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-26[SCSI] remove scsi_cmnd->stateChristoph Hellwig1-7/+0
We never look at it except for the old megaraid driver that abuses it for sending internal commands. That usage can be fixed easily because those internal commands are single-threaded by a mutex and we can easily use a completion there. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-26[SCSI] remove scsi_cmnd->ownerChristoph Hellwig1-17/+1
never checked anywhere Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-26[SCSI] remove scsi_cmnd->abort_reasonChristoph Hellwig1-1/+0
Never used for anything but printing it out in debug routines. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17[SCSI] allow sleeping in ->eh_host_reset_handler()Jeff Garzik1-2/+0
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17[SCSI] allow sleeping in ->eh_bus_reset_handler()Jeff Garzik1-2/+0
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17[SCSI] allow sleeping in ->eh_device_reset_handler()Jeff Garzik1-5/+2
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>