[SCSI] qla4xxx: add timeout handler

Recently dm-multipath began calling blk_abort_queue. This causes all the
commands/request running on the path to have the timeout function called.
If a path does go down, and the LLD returns DID_*, dm-multpiath will eventually
get this error and begin to call the cmd timeout handler. qla4xxx currently
does not set a timed out handler and so the default one could return
BLK_EH_NOT_HANDLED and end up firing the scsi eh and stopping IO to all
paths on the host when only one path is affected.

For software and offload iscsi we have a timed out handler already.
This patch adds a driver specific one to qla4xxx because there
are some ddb->state and session->state and command completion races
that are better handled in the LLD.

This also handles the problem where if the session is down,
we do not need the scsi eh to run until the transport code
has tried to reconnect us.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
Mike Christie 2009-07-15 15:02:59 -05:00 коммит произвёл James Bottomley
Родитель 94bced3c1b
Коммит 5c656af7e4
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -66,6 +66,7 @@ static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
static int qla4xxx_host_get_param(struct Scsi_Host *shost,
enum iscsi_host_param param, char *buf);
static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session);
static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(struct scsi_cmnd *sc);
/*
* SCSI host template entry points
@ -89,6 +90,7 @@ static struct scsi_host_template qla4xxx_driver_template = {
.eh_device_reset_handler = qla4xxx_eh_device_reset,
.eh_target_reset_handler = qla4xxx_eh_target_reset,
.eh_host_reset_handler = qla4xxx_eh_host_reset,
.eh_timed_out = qla4xxx_eh_cmd_timed_out,
.slave_configure = qla4xxx_slave_configure,
.slave_alloc = qla4xxx_slave_alloc,
@ -124,6 +126,21 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
static struct scsi_transport_template *qla4xxx_scsi_transport;
static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(struct scsi_cmnd *sc)
{
struct iscsi_cls_session *session;
struct ddb_entry *ddb_entry;
session = starget_to_session(scsi_target(sc->device));
ddb_entry = session->dd_data;
/* if we are not logged in then the LLD is going to clean up the cmd */
if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE)
return BLK_EH_RESET_TIMER;
else
return BLK_EH_NOT_HANDLED;
}
static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session)
{
struct ddb_entry *ddb_entry = session->dd_data;