From 109e2381749c1cfd94a0d22b2b54142539024973 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Thu, 23 Jul 2015 14:53:32 -0700 Subject: target: Drop iSCSI use of mutex around max_cmd_sn increment In a performance profile, taking a mutex in iscsit_increment_maxcmdsn() shows up very high. However taking a mutex around "sess->max_cmd_sn += 1" seems pretty silly: we're not serializing against other contexts in any useful way. I did a quick audit and there don't appear to be any other places that use max_cmd_sn within the mutex more than once, so this lock can't be providing any useful serialization. (Get correct values for logging - fix whitespace damage) Signed-off-by: Roland Dreier Signed-off-by: Spencer Baugh Signed-off-by: Nicholas Bellinger --- drivers/target/iscsi/iscsi_target_nego.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/target/iscsi/iscsi_target_nego.c') diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 8c02fa34716f..74d041e815f4 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c @@ -340,7 +340,6 @@ static int iscsi_target_check_first_request( static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_login *login) { u32 padding = 0; - struct iscsi_session *sess = conn->sess; struct iscsi_login_rsp *login_rsp; login_rsp = (struct iscsi_login_rsp *) login->rsp; @@ -352,7 +351,7 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log login_rsp->itt = login->init_task_tag; login_rsp->statsn = cpu_to_be32(conn->stat_sn++); login_rsp->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); - login_rsp->max_cmdsn = cpu_to_be32(conn->sess->max_cmd_sn); + login_rsp->max_cmdsn = cpu_to_be32((u32) atomic_read(&conn->sess->max_cmd_sn)); pr_debug("Sending Login Response, Flags: 0x%02x, ITT: 0x%08x," " ExpCmdSN; 0x%08x, MaxCmdSN: 0x%08x, StatSN: 0x%08x, Length:" @@ -367,10 +366,8 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log return -1; login->rsp_length = 0; - mutex_lock(&sess->cmdsn_mutex); - login_rsp->exp_cmdsn = cpu_to_be32(sess->exp_cmd_sn); - login_rsp->max_cmdsn = cpu_to_be32(sess->max_cmd_sn); - mutex_unlock(&sess->cmdsn_mutex); + login_rsp->exp_cmdsn = cpu_to_be32(login_rsp->exp_cmdsn); + login_rsp->max_cmdsn = cpu_to_be32(login_rsp->max_cmdsn); return 0; } -- cgit v1.2.1 From 7dd03aca9d61a9b64cd2a8cf6f5ea6f1f5391e8d Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Tue, 8 Sep 2015 06:14:18 -0700 Subject: target: Fix max_cmd_sn increment w/o cmdsn mutex regressions Current for-next iscsi target is broken: commit 109e2381749c1cfd94a0d22b2b54142539024973 Author: Roland Dreier Date: Thu Jul 23 14:53:32 2015 -0700 target: Drop iSCSI use of mutex around max_cmd_sn increment This patch fixes incorrect pr_debug() + atomic_inc_return() usage within iscsit_increment_maxcmdsn() code. Also fix funny iscsit_determine_maxcmdsn() usage and update iscsi_target_do_tx_login_io() code. Reported-by: Sagi Grimberg Cc: Sagi Grimberg Signed-off-by: Roland Dreier Cc: Roland Dreier Signed-off-by: Nicholas Bellinger --- drivers/target/iscsi/iscsi_target_nego.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/target/iscsi/iscsi_target_nego.c') diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 74d041e815f4..4d08afe71e67 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c @@ -366,8 +366,6 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log return -1; login->rsp_length = 0; - login_rsp->exp_cmdsn = cpu_to_be32(login_rsp->exp_cmdsn); - login_rsp->max_cmdsn = cpu_to_be32(login_rsp->max_cmdsn); return 0; } -- cgit v1.2.1