Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/gfp.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/freezer.h>
#include <linux/kthread.h>
#include <linux/interrupt.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include "scsi_priv.h"
#include "scsi_logging.h"
#include "scsi_transport_api.h"
#include <trace/events/scsi.h>
Go to the source code of this file.
Macros | |
#define | SENSE_TIMEOUT (10*HZ) |
#define | BUS_RESET_SETTLE_TIME (10) |
#define | HOST_RESET_SETTLE_TIME (10) |
#define BUS_RESET_SETTLE_TIME (10) |
Definition at line 53 of file scsi_error.c.
#define HOST_RESET_SETTLE_TIME (10) |
Definition at line 54 of file scsi_error.c.
#define SENSE_TIMEOUT (10*HZ) |
Definition at line 47 of file scsi_error.c.
EXPORT_SYMBOL | ( | scsi_block_when_processing_errors | ) |
EXPORT_SYMBOL | ( | scsi_eh_prep_cmnd | ) |
EXPORT_SYMBOL | ( | scsi_eh_restore_cmnd | ) |
EXPORT_SYMBOL | ( | scsi_eh_finish_cmd | ) |
EXPORT_SYMBOL | ( | scsi_eh_flush_done_q | ) |
EXPORT_SYMBOL | ( | scsi_report_bus_reset | ) |
EXPORT_SYMBOL | ( | scsi_report_device_reset | ) |
EXPORT_SYMBOL | ( | scsi_reset_provider | ) |
EXPORT_SYMBOL | ( | scsi_normalize_sense | ) |
EXPORT_SYMBOL | ( | scsi_command_normalize_sense | ) |
EXPORT_SYMBOL | ( | scsi_sense_desc_find | ) |
EXPORT_SYMBOL | ( | scsi_get_sense_info_fld | ) |
EXPORT_SYMBOL | ( | scsi_build_sense_buffer | ) |
EXPORT_SYMBOL_GPL | ( | scsi_schedule_eh | ) |
EXPORT_SYMBOL_GPL | ( | scsi_eh_get_sense | ) |
EXPORT_SYMBOL_GPL | ( | scsi_eh_ready_devs | ) |
int scsi_block_when_processing_errors | ( | struct scsi_device * | sdev | ) |
scsi_block_when_processing_errors - Prevent cmds from being queued. : Device on which we are performing recovery.
Description: We block until the host is out of error recovery, and then check to see whether the host or the device is offline.
Return value: 0 when dev was taken offline by error recovery. 1 OK to proceed.
Definition at line 167 of file scsi_error.c.
scsi_build_sense_buffer - build sense data in a buffer : Sense format (non zero == descriptor format, 0 == fixed format) : Where to build sense data : Sense key : Additional sense code : Additional sense code qualifier
Definition at line 2215 of file scsi_error.c.
int scsi_command_normalize_sense | ( | struct scsi_cmnd * | cmd, |
struct scsi_sense_hdr * | sshdr | ||
) |
Definition at line 2108 of file scsi_error.c.
scsi_decide_disposition - Disposition a cmd on return from LLD. : SCSI cmd to examine.
Notes: This is only called when we are examining the status after sending out the actual data command. any commands that are queued for error recovery (e.g. test_unit_ready) do not come through here.
When this routine returns failed, it means the error handler thread is woken. In cases where the error code indicates an error that doesn't require the error handler read (i.e. we don't need to abort/reset), this function should return SUCCESS.
Definition at line 1427 of file scsi_error.c.
scsi_eh_finish_cmd - Handle a cmd that eh is finished with. : Original SCSI cmd that eh has finished. : Queue for processed commands.
Notes: We don't want to use the normal command completion while we are are still handling errors - it may cause other commands to be queued, and that would disturb what we are doing. Thus we really want to keep a list of pending commands for final completion, and once we are ready to leave error handling we handle completion for real.
Definition at line 882 of file scsi_error.c.
scsi_eh_flush_done_q - finish processed commands or retry them. : list_head of processed commands.
Definition at line 1742 of file scsi_error.c.
scsi_eh_get_sense - Get device sense data. : Queue of commands to process. : Queue of processed commands.
Description: See if we need to request sense information. if so, then get it now, so we have a better idea of what to do.
Notes: This has the unfortunate side effect that if a shost adapter does not automatically request sense information, we end up shutting it down before we request it.
All drivers should request sense information internally these days, so for now all I have to say is tough noogies if you end up in here.
XXX: Long term this code should go away, but that needs an audit of all LLDDs first.
Definition at line 910 of file scsi_error.c.
void scsi_eh_prep_cmnd | ( | struct scsi_cmnd * | scmd, |
struct scsi_eh_save * | ses, | ||
unsigned char * | cmnd, | ||
int | cmnd_size, | ||
unsigned | sense_bytes | ||
) |
scsi_eh_prep_cmnd - Save a scsi command info as part of error recovery : SCSI command structure to hijack : structure to save restore information : CDB to send. Can be NULL if no new cmnd is needed : size in bytes of (must be <= BLK_MAX_CDB) : size of sense data to copy. or 0 (if != 0 is ignored)
This function is used to save a scsi command information before re-execution as part of the error recovery process. If is 0 the command sent must be one that does not transfer any data. If != 0 is ignored and this functions sets up a REQUEST_SENSE command and cmnd buffers to read into ->sense_buffer.
Definition at line 690 of file scsi_error.c.
void scsi_eh_ready_devs | ( | struct Scsi_Host * | shost, |
struct list_head * | work_q, | ||
struct list_head * | done_q | ||
) |
scsi_eh_ready_devs - check device ready state and recover if not. : host to be recovered. : &list_head for pending commands. : &list_head for processed commands.
Definition at line 1724 of file scsi_error.c.
void scsi_eh_restore_cmnd | ( | struct scsi_cmnd * | scmd, |
struct scsi_eh_save * | ses | ||
) |
scsi_eh_restore_cmnd - Restore a scsi command info as part of error recovery : SCSI command structure to restore : saved information from a coresponding call to scsi_eh_prep_cmnd
Undo any damage done by above scsi_eh_prep_cmnd().
Definition at line 758 of file scsi_error.c.
scsi_eh_scmd_add - add scsi cmd to error handling. : scmd to run eh on. : optional SCSI_EH flag.
Return value: 0 on failure.
Definition at line 99 of file scsi_error.c.
Definition at line 59 of file scsi_error.c.
scsi_error_handler - SCSI error handler thread : Host for which we are running.
Notes: This is the main error handling loop. This is run as a kernel thread for every SCSI host and handles all error handling activity.
Definition at line 1823 of file scsi_error.c.
scsi_get_sense_info_fld - get information field from sense data (either fixed or descriptor format) : byte array of sense data : number of valid bytes in sense_buffer : pointer to 64 integer where 8 or 4 byte information field will be placed if found.
Return value: 1 if information field found, 0 if not found.
Definition at line 2165 of file scsi_error.c.
scsi_noretry_cmd - determinte if command should be failed fast : SCSI cmd to examine.
Definition at line 1381 of file scsi_error.c.
scsi_normalize_sense - normalize main elements from either fixed or descriptor sense data format into a common format.
: byte array containing sense data returned by device : number of valid bytes in sense_buffer : pointer to instance of structure that common elements are written to.
Notes: The "main elements" from sense data are: response_code, sense_key, asc, ascq and additional_length (only for descriptor format).
Typically this function can be called after a device has responded to a SCSI command with the CHECK_CONDITION status.
Return value: 1 if valid sense data information found, else 0;
Definition at line 2063 of file scsi_error.c.
Definition at line 1907 of file scsi_error.c.
Definition at line 1940 of file scsi_error.c.
int scsi_reset_provider | ( | struct scsi_device * | dev, |
int | flag | ||
) |
Definition at line 1971 of file scsi_error.c.
scsi_schedule_eh - schedule EH for SCSI host : SCSI host to invoke error handling on.
Schedule SCSI EH without scmd.
Definition at line 75 of file scsi_error.c.
scsi_sense_desc_find - search for a given descriptor type in descriptor sense data format. : byte array of descriptor format sense data : number of valid bytes in sense_buffer : value of descriptor type to find (e.g. 0 -> information)
Notes: only valid when sense data is in descriptor format
Return value: pointer to start of (first) descriptor if found else NULL
Definition at line 2129 of file scsi_error.c.
scsi_times_out - Timeout function for normal scsi commands. : request that is timing out.
Notes: We do not need to lock this. There is the potential for a race only in that the normal completion handling might run, but if the normal completion function determines that the timer has already fired, then it mustn't do anything.
Definition at line 133 of file scsi_error.c.