Skip to content

Commit

Permalink
[SCSI] iscsi: host locking fix
Browse files Browse the repository at this point in the history
We should be taking the host_lock instead of the conn lock when
checking host_busy.

Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
zhenyu.z.wang@intel.com authored and James Bottomley committed Jan 14, 2006
1 parent bf310b8 commit 3e97c7e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/scsi/iscsi_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2559,6 +2559,7 @@ iscsi_conn_destroy(iscsi_connh_t connh)
{
struct iscsi_conn *conn = iscsi_ptr(connh);
struct iscsi_session *session = conn->session;
unsigned long flags;

mutex_lock(&conn->xmitmutex);
set_bit(SUSPEND_BIT, &conn->suspend_tx);
Expand Down Expand Up @@ -2598,12 +2599,12 @@ iscsi_conn_destroy(iscsi_connh_t connh)
* time out or fail.
*/
for (;;) {
spin_lock_bh(&conn->lock);
spin_lock_irqsave(session->host->host_lock, flags);
if (!session->host->host_busy) { /* OK for ERL == 0 */
spin_unlock_bh(&conn->lock);
spin_unlock_irqrestore(session->host->host_lock, flags);
break;
}
spin_unlock_bh(&conn->lock);
spin_unlock_irqrestore(session->host->host_lock, flags);
msleep_interruptible(500);
printk("conn_destroy(): host_busy %d host_failed %d\n",
session->host->host_busy, session->host->host_failed);
Expand Down

0 comments on commit 3e97c7e

Please sign in to comment.