Commit 3e97c7e6 authored by zhenyu.z.wang@intel.com's avatar zhenyu.z.wang@intel.com Committed by James Bottomley

[SCSI] iscsi: host locking fix

We should be taking the host_lock instead of the conn lock when
checking host_busy.
Signed-off-by: default avatarAlex Aizman <itn780@yahoo.com>
Signed-off-by: default avatarDmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent bf310b8f
...@@ -2559,6 +2559,7 @@ iscsi_conn_destroy(iscsi_connh_t connh) ...@@ -2559,6 +2559,7 @@ iscsi_conn_destroy(iscsi_connh_t connh)
{ {
struct iscsi_conn *conn = iscsi_ptr(connh); struct iscsi_conn *conn = iscsi_ptr(connh);
struct iscsi_session *session = conn->session; struct iscsi_session *session = conn->session;
unsigned long flags;
mutex_lock(&conn->xmitmutex); mutex_lock(&conn->xmitmutex);
set_bit(SUSPEND_BIT, &conn->suspend_tx); set_bit(SUSPEND_BIT, &conn->suspend_tx);
...@@ -2598,12 +2599,12 @@ iscsi_conn_destroy(iscsi_connh_t connh) ...@@ -2598,12 +2599,12 @@ iscsi_conn_destroy(iscsi_connh_t connh)
* time out or fail. * time out or fail.
*/ */
for (;;) { for (;;) {
spin_lock_bh(&conn->lock); spin_lock_irqsave(session->host->host_lock, flags);
if (!session->host->host_busy) { /* OK for ERL == 0 */ if (!session->host->host_busy) { /* OK for ERL == 0 */
spin_unlock_bh(&conn->lock); spin_unlock_irqrestore(session->host->host_lock, flags);
break; break;
} }
spin_unlock_bh(&conn->lock); spin_unlock_irqrestore(session->host->host_lock, flags);
msleep_interruptible(500); msleep_interruptible(500);
printk("conn_destroy(): host_busy %d host_failed %d\n", printk("conn_destroy(): host_busy %d host_failed %d\n",
session->host->host_busy, session->host->host_failed); session->host->host_busy, session->host->host_failed);
......
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