aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohank@serverengines.com>2010-02-19 21:32:10 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-03-03 07:09:04 -0500
commit309ce156aa27f29338438011d292a8d6496623d3 (patch)
tree7d0554a3a6c7c15b612b8eeb00991c0e54cdaf1e
parentd7b4627f5f3390a2f350f16c047b3fc3eccce6d8 (diff)
[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: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Jayamohan Kallickal <jayamohank@serverengines.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c2
-rw-r--r--drivers/scsi/be2iscsi/be_main.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c2
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_iscsi.c2
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/libiscsi.c23
-rw-r--r--include/scsi/libiscsi.h3
7 files changed, 26 insertions, 10 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5f7a6fca0a4d..5472b7e9abdc 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -596,7 +596,7 @@ static struct scsi_host_template iscsi_iser_sht = {
596 .cmd_per_lun = ISER_DEF_CMD_PER_LUN, 596 .cmd_per_lun = ISER_DEF_CMD_PER_LUN,
597 .eh_abort_handler = iscsi_eh_abort, 597 .eh_abort_handler = iscsi_eh_abort,
598 .eh_device_reset_handler= iscsi_eh_device_reset, 598 .eh_device_reset_handler= iscsi_eh_device_reset,
599 .eh_target_reset_handler= iscsi_eh_target_reset, 599 .eh_target_reset_handler = iscsi_eh_recover_target,
600 .target_alloc = iscsi_target_alloc, 600 .target_alloc = iscsi_target_alloc,
601 .use_clustering = DISABLE_CLUSTERING, 601 .use_clustering = DISABLE_CLUSTERING,
602 .proc_name = "iscsi_iser", 602 .proc_name = "iscsi_iser",
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7c22616ab141..4d269b434a78 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -79,7 +79,7 @@ static struct scsi_host_template beiscsi_sht = {
79 .slave_configure = beiscsi_slave_configure, 79 .slave_configure = beiscsi_slave_configure,
80 .target_alloc = iscsi_target_alloc, 80 .target_alloc = iscsi_target_alloc,
81 .eh_device_reset_handler = iscsi_eh_device_reset, 81 .eh_device_reset_handler = iscsi_eh_device_reset,
82 .eh_target_reset_handler = iscsi_eh_target_reset, 82 .eh_target_reset_handler = iscsi_eh_session_reset,
83 .sg_tablesize = BEISCSI_SGLIST_ELEMENTS, 83 .sg_tablesize = BEISCSI_SGLIST_ELEMENTS,
84 .can_queue = BE2_IO_DEPTH, 84 .can_queue = BE2_IO_DEPTH,
85 .this_id = -1, 85 .this_id = -1,
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 1c4d1215769d..cb71dc984797 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1989,7 +1989,7 @@ static struct scsi_host_template bnx2i_host_template = {
1989 .queuecommand = iscsi_queuecommand, 1989 .queuecommand = iscsi_queuecommand,
1990 .eh_abort_handler = iscsi_eh_abort, 1990 .eh_abort_handler = iscsi_eh_abort,
1991 .eh_device_reset_handler = iscsi_eh_device_reset, 1991 .eh_device_reset_handler = iscsi_eh_device_reset,
1992 .eh_target_reset_handler = iscsi_eh_target_reset, 1992 .eh_target_reset_handler = iscsi_eh_recover_target,
1993 .change_queue_depth = iscsi_change_queue_depth, 1993 .change_queue_depth = iscsi_change_queue_depth,
1994 .can_queue = 1024, 1994 .can_queue = 1024,
1995 .max_sectors = 127, 1995 .max_sectors = 127,
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 412853c65372..b7c30585dadd 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -915,7 +915,7 @@ static struct scsi_host_template cxgb3i_host_template = {
915 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 915 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
916 .eh_abort_handler = iscsi_eh_abort, 916 .eh_abort_handler = iscsi_eh_abort,
917 .eh_device_reset_handler = iscsi_eh_device_reset, 917 .eh_device_reset_handler = iscsi_eh_device_reset,
918 .eh_target_reset_handler = iscsi_eh_target_reset, 918 .eh_target_reset_handler = iscsi_eh_recover_target,
919 .target_alloc = iscsi_target_alloc, 919 .target_alloc = iscsi_target_alloc,
920 .use_clustering = DISABLE_CLUSTERING, 920 .use_clustering = DISABLE_CLUSTERING,
921 .this_id = -1, 921 .this_id = -1,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 8a89ba900588..249053a9d4fa 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -874,7 +874,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = {
874 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 874 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
875 .eh_abort_handler = iscsi_eh_abort, 875 .eh_abort_handler = iscsi_eh_abort,
876 .eh_device_reset_handler= iscsi_eh_device_reset, 876 .eh_device_reset_handler= iscsi_eh_device_reset,
877 .eh_target_reset_handler= iscsi_eh_target_reset, 877 .eh_target_reset_handler = iscsi_eh_recover_target,
878 .use_clustering = DISABLE_CLUSTERING, 878 .use_clustering = DISABLE_CLUSTERING,
879 .slave_alloc = iscsi_sw_tcp_slave_alloc, 879 .slave_alloc = iscsi_sw_tcp_slave_alloc,
880 .slave_configure = iscsi_sw_tcp_slave_configure, 880 .slave_configure = iscsi_sw_tcp_slave_configure,
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 703eb6a88790..685eaec53218 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2338,7 +2338,7 @@ EXPORT_SYMBOL_GPL(iscsi_session_recovery_timedout);
2338 * This function will wait for a relogin, session termination from 2338 * This function will wait for a relogin, session termination from
2339 * userspace, or a recovery/replacement timeout. 2339 * userspace, or a recovery/replacement timeout.
2340 */ 2340 */
2341static int iscsi_eh_session_reset(struct scsi_cmnd *sc) 2341int iscsi_eh_session_reset(struct scsi_cmnd *sc)
2342{ 2342{
2343 struct iscsi_cls_session *cls_session; 2343 struct iscsi_cls_session *cls_session;
2344 struct iscsi_session *session; 2344 struct iscsi_session *session;
@@ -2389,6 +2389,7 @@ failed:
2389 mutex_unlock(&session->eh_mutex); 2389 mutex_unlock(&session->eh_mutex);
2390 return SUCCESS; 2390 return SUCCESS;
2391} 2391}
2392EXPORT_SYMBOL_GPL(iscsi_eh_session_reset);
2392 2393
2393static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr) 2394static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)
2394{ 2395{
@@ -2403,8 +2404,7 @@ static void iscsi_prep_tgt_reset_pdu(struct scsi_cmnd *sc, struct iscsi_tm *hdr)
2403 * iscsi_eh_target_reset - reset target 2404 * iscsi_eh_target_reset - reset target
2404 * @sc: scsi command 2405 * @sc: scsi command
2405 * 2406 *
2406 * This will attempt to send a warm target reset. If that fails 2407 * This will attempt to send a warm target reset.
2407 * then we will drop the session and attempt ERL0 recovery.
2408 */ 2408 */
2409int iscsi_eh_target_reset(struct scsi_cmnd *sc) 2409int iscsi_eh_target_reset(struct scsi_cmnd *sc)
2410{ 2410{
@@ -2476,12 +2476,27 @@ done:
2476 ISCSI_DBG_EH(session, "tgt %s reset result = %s\n", session->targetname, 2476 ISCSI_DBG_EH(session, "tgt %s reset result = %s\n", session->targetname,
2477 rc == SUCCESS ? "SUCCESS" : "FAILED"); 2477 rc == SUCCESS ? "SUCCESS" : "FAILED");
2478 mutex_unlock(&session->eh_mutex); 2478 mutex_unlock(&session->eh_mutex);
2479 return rc;
2480}
2481EXPORT_SYMBOL_GPL(iscsi_eh_target_reset);
2479 2482
2483/**
2484 * iscsi_eh_recover_target - reset target and possibly the session
2485 * @sc: scsi command
2486 *
2487 * This will attempt to send a warm target reset. If that fails,
2488 * we will escalate to ERL0 session recovery.
2489 */
2490int iscsi_eh_recover_target(struct scsi_cmnd *sc)
2491{
2492 int rc;
2493
2494 rc = iscsi_eh_target_reset(sc);
2480 if (rc == FAILED) 2495 if (rc == FAILED)
2481 rc = iscsi_eh_session_reset(sc); 2496 rc = iscsi_eh_session_reset(sc);
2482 return rc; 2497 return rc;
2483} 2498}
2484EXPORT_SYMBOL_GPL(iscsi_eh_target_reset); 2499EXPORT_SYMBOL_GPL(iscsi_eh_recover_target);
2485 2500
2486/* 2501/*
2487 * Pre-allocate a pool of @max items of @item_size. By default, the pool 2502 * Pre-allocate a pool of @max items of @item_size. By default, the pool
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index ff92b46f5153..ae5196aae1a5 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -338,7 +338,8 @@ struct iscsi_host {
338extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, 338extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
339 int reason); 339 int reason);
340extern int iscsi_eh_abort(struct scsi_cmnd *sc); 340extern int iscsi_eh_abort(struct scsi_cmnd *sc);
341extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); 341extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
342extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
342extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 343extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
343extern int iscsi_queuecommand(struct scsi_cmnd *sc, 344extern int iscsi_queuecommand(struct scsi_cmnd *sc,
344 void (*done)(struct scsi_cmnd *)); 345 void (*done)(struct scsi_cmnd *));