[stgt] [PATCH] Add NOP-OUT probe support.

Ronnie Sahlberg ronniesahlberg at gmail.com
Tue Jun 18 05:47:13 CEST 2013


Add support for setting NOP-OUT probes to detect dead initiators.
We can set the interval(how frequently to send the probes)
and the count(after how many failures will we tear down the connection)
globally from the tgtd command line.

Optionally, using tgtadm, it is possible to configure the interval/count
for individual targets.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
---
 usr/iscsi/iscsi_tcp.c |    4 ++--
 usr/iscsi/target.c    |    4 ++--
 usr/tgtadm.c          |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index 760dd0b..b80e108 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -476,9 +476,9 @@ static int iscsi_tcp_conn_login_complete(struct iscsi_connection *conn)
 	struct iscsi_target *target;
 
 	list_for_each_entry(target, &iscsi_targets_list, tlist) {
-		if (target->tid != conn->tid) {
+		if (target->tid != conn->tid)
 			continue;
-		}
+
 		tcp_conn->nop_count = target->nop_count;
 		tcp_conn->nop_interval = target->nop_interval;
 		tcp_conn->nop_tick = target->nop_interval;
diff --git a/usr/iscsi/target.c b/usr/iscsi/target.c
index b9fe8f1..20fb1da 100644
--- a/usr/iscsi/target.c
+++ b/usr/iscsi/target.c
@@ -548,13 +548,13 @@ tgtadm_err iscsi_target_update(int mode, int op, int tid, uint64_t sid, uint64_t
 			}
 			adm_err = TGTADM_SUCCESS;
 		} else if (!strncmp(name, "nop_count", 9)) {
-			err =iscsi_update_target_nop_count(tid,
+			err = iscsi_update_target_nop_count(tid,
 				atoi(&name[10]));
 			adm_err = !err ? TGTADM_SUCCESS :
 				TGTADM_INVALID_REQUEST;
 			break;
 		} else if (!strncmp(name, "nop_interval", 12)) {
-			err =iscsi_update_target_nop_interval(tid,
+			err = iscsi_update_target_nop_interval(tid,
 				atoi(&name[13]));
 			adm_err = !err ? TGTADM_SUCCESS :
 				TGTADM_INVALID_REQUEST;
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 945c251..38ce048 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -707,7 +707,7 @@ int main(int argc, char **argv)
 		case OP_UPDATE:
 			rc = verify_mode_params(argc, argv, "LmotnvC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("target mode: option '-%c' is not " \
 					  "allowed/supported\n", rc);
 				exit(EINVAL);
 			}
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list