Skip to content

Commit

Permalink
[SCSI] zfcp: Change spin_lock_bh to spin_lock_irq to fix lockdep warning
Browse files Browse the repository at this point in the history
With the change to use the data on the SCSI device, iterating through
all LUNs/scsi_devices takes the SCSI host_lock. This triggers warnings
from the lock dependency checker:

=========================================================
[ INFO: possible irq lock inversion dependency detected ]
2.6.34.1 #97
---------------------------------------------------------
chchp/3224 just changed the state of lock:
 (&(shost->host_lock)->rlock){-.-...}, at: [<00000000003a73f4>] __scsi_iterate_devices+0x38/0xbc
but this lock took another, HARDIRQ-unsafe lock in the past:
 (&(&qdio->req_q_lock)->rlock){+.-...}

and interrupts could create inverse lock ordering between them.

other info that might help us debug this: [   24.972394] 2 locks held by chchp/3224:
 #0:  (&(sch->lock)->rlock){-.-...}, at: [<0000000000401efa>] do_IRQ+0xb2/0x1e4
 #1:  (&adapter->port_list_lock){.-....}, at: [<0000000000490302>] zfcp_erp_modify_adapter_status+0x9e/0x16c
[...]

=========================================================
[ INFO: possible irq lock inversion dependency detected ]
2.6.34.1 #98
---------------------------------------------------------
chchp/3235 just changed the state of lock:
 (&(shost->host_lock)->rlock){-.-...}, at: [<00000000003a73f4>] __scsi_iterate_devices+0x38/0xbc
but this lock took another, HARDIRQ-unsafe lock in the past:
 (&(&qdio->stat_lock)->rlock){+.-...}

and interrupts could create inverse lock ordering between them.

other info that might help us debug this:
2 locks held by chchp/3235:
 #0:  (&(sch->lock)->rlock){-.-...}, at: [<0000000000401efa>] do_IRQ+0xb2/0x1e4
 #1:  (&adapter->port_list_lock){.-.-..}, at: [<00000000004902f6>] zfcp_erp_modify_adapter_status+0x9e/0x16c
[...]

To stop this warning, change the request queue lock to disable irqs,
not only softirq. The changes are required only outside of the
critical "send fcp command" path.

Reviewed-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Christof Schmitt authored and James Bottomley committed Sep 17, 2010
1 parent f8210e3 commit 44a24cb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 44 deletions.
72 changes: 36 additions & 36 deletions drivers/s390/scsi/zfcp_fsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
struct fsf_status_read_buffer *sr_buf;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -807,7 +807,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
zfcp_fsf_req_free(req);
zfcp_dbf_hba_fsf_unsol("fail", adapter->dbf, NULL);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -876,7 +876,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio;
unsigned long old_req_id = (unsigned long) scmnd->host_scribble;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;
req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND,
Expand Down Expand Up @@ -907,7 +907,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
zfcp_fsf_req_free(req);
req = NULL;
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return req;
}

Expand Down Expand Up @@ -1046,7 +1046,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
struct zfcp_fsf_req *req;
int ret = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1078,7 +1078,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
failed_send:
zfcp_fsf_req_free(req);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return ret;
}

Expand Down Expand Up @@ -1142,7 +1142,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
struct zfcp_qdio *qdio = adapter->qdio;
int ret = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1178,7 +1178,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
failed_send:
zfcp_fsf_req_free(req);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return ret;
}

Expand All @@ -1188,7 +1188,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
struct zfcp_qdio *qdio = erp_action->adapter->qdio;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1220,7 +1220,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand All @@ -1230,7 +1230,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
struct zfcp_fsf_req *req = NULL;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out_unlock;

Expand All @@ -1256,15 +1256,15 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,

zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
retval = zfcp_fsf_req_send(req);
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
if (!retval)
wait_for_completion(&req->completion);

zfcp_fsf_req_free(req);
return retval;

out_unlock:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand All @@ -1282,7 +1282,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
return -EOPNOTSUPP;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand All @@ -1309,7 +1309,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand All @@ -1328,7 +1328,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
return -EOPNOTSUPP;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out_unlock;

Expand All @@ -1348,7 +1348,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
req->handler = zfcp_fsf_exchange_port_data_handler;
zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
retval = zfcp_fsf_req_send(req);
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);

if (!retval)
wait_for_completion(&req->completion);
Expand All @@ -1358,7 +1358,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
return retval;

out_unlock:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1442,7 +1442,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1473,7 +1473,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
put_device(&port->dev);
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1510,7 +1510,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1539,7 +1539,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1585,7 +1585,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand All @@ -1610,7 +1610,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
if (retval)
zfcp_fsf_req_free(req);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1638,7 +1638,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand All @@ -1663,7 +1663,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
if (retval)
zfcp_fsf_req_free(req);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1728,7 +1728,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1757,7 +1757,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1900,7 +1900,7 @@ int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -1933,7 +1933,7 @@ int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -1987,7 +1987,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action)
struct zfcp_fsf_req *req;
int retval = -EIO;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -2017,7 +2017,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action)
erp_action->fsf_req_id = 0;
}
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return retval;
}

Expand Down Expand Up @@ -2363,7 +2363,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,
ZFCP_STATUS_COMMON_UNBLOCKED)))
return NULL;

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand Down Expand Up @@ -2397,7 +2397,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,
zfcp_fsf_req_free(req);
req = NULL;
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);
return req;
}

Expand Down Expand Up @@ -2433,7 +2433,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
return ERR_PTR(-EINVAL);
}

spin_lock_bh(&qdio->req_q_lock);
spin_lock_irq(&qdio->req_q_lock);
if (zfcp_qdio_sbal_get(qdio))
goto out;

Expand All @@ -2460,7 +2460,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
retval = zfcp_fsf_req_send(req);
out:
spin_unlock_bh(&qdio->req_q_lock);
spin_unlock_irq(&qdio->req_q_lock);

if (!retval) {
wait_for_completion(&req->completion);
Expand Down
Loading

0 comments on commit 44a24cb

Please sign in to comment.