Commit 309ce156 authored by Jayamohan Kallickal's avatar Jayamohan Kallickal Committed by James Bottomley

[SCSI] libiscsi: Make iscsi_eh_target_reset start with session reset

The iscsi_eh_target_reset has been modified to attempt
target reset only. If it fails, then iscsi_eh_session_reset
will be called.
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJayamohan Kallickal <jayamohank@serverengines.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent d7b4627f
...@@ -596,7 +596,7 @@ static struct scsi_host_template iscsi_iser_sht = { ...@@ -596,7 +596,7 @@ static struct scsi_host_template iscsi_iser_sht = {
.cmd_per_lun = ISER_DEF_CMD_PER_LUN, .cmd_per_lun = ISER_DEF_CMD_PER_LUN,
.eh_abort_handler = iscsi_eh_abort, .eh_abort_handler = iscsi_eh_abort,
.eh_device_reset_handler= iscsi_eh_device_reset, .eh_device_reset_handler= iscsi_eh_device_reset,
.eh_target_reset_handler= iscsi_eh_target_reset, .eh_target_reset_handler = iscsi_eh_recover_target,
.target_alloc = iscsi_target_alloc, .target_alloc = iscsi_target_alloc,
.use_clustering = DISABLE_CLUSTERING, .use_clustering = DISABLE_CLUSTERING,
.proc_name = "iscsi_iser", .proc_name = "iscsi_iser",
......
...@@ -79,7 +79,7 @@ static struct scsi_host_template beiscsi_sht = { ...@@ -79,7 +79,7 @@ static struct scsi_host_template beiscsi_sht = {
.slave_configure = beiscsi_slave_configure, .slave_configure = beiscsi_slave_configure,
.target_alloc = iscsi_target_alloc, .target_alloc = iscsi_target_alloc,
.eh_device_reset_handler = iscsi_eh_device_reset, .eh_device_reset_handler = iscsi_eh_device_reset,
.eh_target_reset_handler = iscsi_eh_target_reset, .eh_target_reset_handler = iscsi_eh_session_reset,
.sg_tablesize = BEISCSI_SGLIST_ELEMENTS, .sg_tablesize = BEISCSI_SGLIST_ELEMENTS,
.can_queue = BE2_IO_DEPTH, .can_queue = BE2_IO_DEPTH,
.this_id = -1, .this_id = -1,
......
...@@ -1989,7 +1989,7 @@ static struct scsi_host_template bnx2i_host_template = { ...@@ -1989,7 +1989,7 @@ static struct scsi_host_template bnx2i_host_template = {
.queuecommand = iscsi_queuecommand, .queuecommand = iscsi_queuecommand,
.eh_abort_handler = iscsi_eh_abort, .eh_abort_handler = iscsi_eh_abort,
.eh_device_reset_handler = iscsi_eh_device_reset, .eh_device_reset_handler = iscsi_eh_device_reset,
.eh_target_reset_handler = iscsi_eh_target_reset, .eh_target_reset_handler = iscsi_eh_recover_target,
.change_queue_depth = iscsi_change_queue_depth, .change_queue_depth = iscsi_change_queue_depth,
.can_queue = 1024, .can_queue = 1024,
.max_sectors = 127, .max_sectors = 127,
......
...@@ -915,7 +915,7 @@ static struct scsi_host_template cxgb3i_host_template = { ...@@ -915,7 +915,7 @@ static struct scsi_host_template cxgb3i_host_template = {
.cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
.eh_abort_handler = iscsi_eh_abort, .eh_abort_handler = iscsi_eh_abort,
.eh_device_reset_handler = iscsi_eh_device_reset, .eh_device_reset_handler = iscsi_eh_device_reset,
.eh_target_reset_handler = iscsi_eh_target_reset, .eh_target_reset_handler = iscsi_eh_recover_target,
.target_alloc = iscsi_target_alloc, .target_alloc = iscsi_target_alloc,
.use_clustering = DISABLE_CLUSTERING, .use_clustering = DISABLE_CLUSTERING,
.this_id = -1, .this_id = -1,
......
...@@ -874,7 +874,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { ...@@ -874,7 +874,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = {
.cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
.eh_abort_handler = iscsi_eh_abort, .eh_abort_handler = iscsi_eh_abort,
.eh_device_reset_handler= iscsi_eh_device_reset, .eh_device_reset_handler= iscsi_eh_device_reset,
.eh_target_reset_handler= iscsi_eh_target_reset, .eh_target_reset_handler = iscsi_eh_recover_target,
.use_clustering = DISABLE_CLUSTERING, .use_clustering = DISABLE_CLUSTERING,
.slave_alloc = iscsi_sw_tcp_slave_alloc, .slave_alloc = iscsi_sw_tcp_slave_alloc,
.slave_configure = iscsi_sw_tcp_slave_configure, .slave_configure = iscsi_sw_tcp_slave_configure,
......
...@@ -2338,7 +2338,7 @@ EXPORT_SYMBOL_GPL(iscsi_session_recovery_timedout); ...@@ -2338,7 +2338,7 @@ EXPORT_SYMBOL_GPL(iscsi_session_recovery_timedout);
* This function will wait for a relogin, session termination from * This function will wait for a relogin, session termination from
* userspace, or a recovery/replacement timeout. * userspace, or a recovery/replacement timeout.
*/ */
static int iscsi_eh_session_reset(struct scsi_cmnd *sc) int iscsi_eh_session_reset(struct scsi_cmnd *sc)
{ {
struct iscsi_cls_session *cls_session; struct iscsi_cls_session *cls_session;
struct iscsi_session *session; struct iscsi_session *session;
...@@ -2389,6 +2389,7 @@ static int iscsi_eh_session_reset(struct scsi_cmnd *sc) ...@@ -2389,6 +2389,7 @@ static int iscsi_eh_session_reset(struct scsi_cmnd *sc)
mutex_unlock(&session->eh_mutex); mutex_unlock(&session->eh_mutex);
return SUCCESS; return SUCCESS;
} }
EXPORT_SYMBOL_GPL(iscsi_eh_session_reset);
static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr) static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)
{ {
...@@ -2403,8 +2404,7 @@ static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr) ...@@ -2403,8 +2404,7 @@ static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)
* iscsi_eh_target_reset - reset target * iscsi_eh_target_reset - reset target
* @sc: scsi command * @sc: scsi command
* *
* This will attempt to send a warm target reset. If that fails * This will attempt to send a warm target reset.
* then we will drop the session and attempt ERL0 recovery.
*/ */
int iscsi_eh_target_reset(struct scsi_cmnd *sc) int iscsi_eh_target_reset(struct scsi_cmnd *sc)
{ {
...@@ -2476,12 +2476,27 @@ int iscsi_eh_target_reset(struct scsi_cmnd *sc) ...@@ -2476,12 +2476,27 @@ int iscsi_eh_target_reset(struct scsi_cmnd *sc)
ISCSI_DBG_EH(session, "tgt %s reset result = %s\n", session->targetname, ISCSI_DBG_EH(session, "tgt %s reset result = %s\n", session->targetname,
rc == SUCCESS ? "SUCCESS" : "FAILED"); rc == SUCCESS ? "SUCCESS" : "FAILED");
mutex_unlock(&session->eh_mutex); mutex_unlock(&session->eh_mutex);
return rc;
}
EXPORT_SYMBOL_GPL(iscsi_eh_target_reset);
/**
* iscsi_eh_recover_target - reset target and possibly the session
* @sc: scsi command
*
* This will attempt to send a warm target reset. If that fails,
* we will escalate to ERL0 session recovery.
*/
int iscsi_eh_recover_target(struct scsi_cmnd *sc)
{
int rc;
rc = iscsi_eh_target_reset(sc);
if (rc == FAILED) if (rc == FAILED)
rc = iscsi_eh_session_reset(sc); rc = iscsi_eh_session_reset(sc);
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(iscsi_eh_target_reset); EXPORT_SYMBOL_GPL(iscsi_eh_recover_target);
/* /*
* Pre-allocate a pool of @max items of @item_size. By default, the pool * Pre-allocate a pool of @max items of @item_size. By default, the pool
......
...@@ -338,7 +338,8 @@ struct iscsi_host { ...@@ -338,7 +338,8 @@ struct iscsi_host {
extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
int reason); int reason);
extern int iscsi_eh_abort(struct scsi_cmnd *sc); extern int iscsi_eh_abort(struct scsi_cmnd *sc);
extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
extern int iscsi_queuecommand(struct scsi_cmnd *sc, extern int iscsi_queuecommand(struct scsi_cmnd *sc,
void (*done)(struct scsi_cmnd *)); void (*done)(struct scsi_cmnd *));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment