diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-11-12 20:54:56 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-11-12 20:54:56 -0500 |
commit | 5e8e6b4b3adebf01a9d97056cbbfd8c44330df99 (patch) | |
tree | 26d9d918a3000c6a0f60a72ee0706004969429ad /drivers/target/iscsi/iscsi_target_device.c | |
parent | 0f59cc3fc1c04413eb1368b57f5e806ebd731ef8 (diff) |
iscsi-target: Fix mutex_trylock usage in iscsit_increment_maxcmdsn
This patch fixes a >= v3.10 regression bug with mutex_trylock() usage
within iscsit_increment_maxcmdsn(), that was originally added to allow
for a special case where ->cmdsn_mutex was already held from the
iscsit_execute_cmd() exception path for ib_isert.
When !mutex_trylock() was occuring under contention during normal RX/TX
process context codepaths, the bug was manifesting itself as the following
protocol error:
Received CmdSN: 0x000fcbb7 is greater than MaxCmdSN: 0x000fcbb6, protocol error.
Received CmdSN: 0x000fcbb8 is greater than MaxCmdSN: 0x000fcbb6, protocol error.
This patch simply avoids the direct ib_isert callback in lio_queue_status()
for the special iscsi_execute_cmd() exception cases, that allows the problematic
mutex_trylock() usage in iscsit_increment_maxcmdsn() to go away.
Reported-by: Moussa Ba <moussaba@micron.com>
Tested-by: Moussa Ba <moussaba@micron.com>
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_device.c')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_device.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/target/iscsi/iscsi_target_device.c b/drivers/target/iscsi/iscsi_target_device.c index 6c7a5104a4cd..7087c736daa5 100644 --- a/drivers/target/iscsi/iscsi_target_device.c +++ b/drivers/target/iscsi/iscsi_target_device.c | |||
@@ -58,11 +58,7 @@ void iscsit_increment_maxcmdsn(struct iscsi_cmd *cmd, struct iscsi_session *sess | |||
58 | 58 | ||
59 | cmd->maxcmdsn_inc = 1; | 59 | cmd->maxcmdsn_inc = 1; |
60 | 60 | ||
61 | if (!mutex_trylock(&sess->cmdsn_mutex)) { | 61 | mutex_lock(&sess->cmdsn_mutex); |
62 | sess->max_cmd_sn += 1; | ||
63 | pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); | ||
64 | return; | ||
65 | } | ||
66 | sess->max_cmd_sn += 1; | 62 | sess->max_cmd_sn += 1; |
67 | pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); | 63 | pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); |
68 | mutex_unlock(&sess->cmdsn_mutex); | 64 | mutex_unlock(&sess->cmdsn_mutex); |