aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-09-08 08:39:57 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-09-16 22:54:19 -0400
commit44a24cb3731495336d77f3a955a7004997270dfd (patch)
tree3fdf2df31c2f528e6bd01c99a942ae2de2b9d39a /drivers/s390
parentf8210e34887e1feb977a9b6b8caa086855af40c9 (diff)
[SCSI] zfcp: Change spin_lock_bh to spin_lock_irq to fix lockdep warning
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>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c72
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c18
2 files changed, 46 insertions, 44 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 2fbd80257bca..48aa16a40d93 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -773,7 +773,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
773 struct fsf_status_read_buffer *sr_buf; 773 struct fsf_status_read_buffer *sr_buf;
774 int retval = -EIO; 774 int retval = -EIO;
775 775
776 spin_lock_bh(&qdio->req_q_lock); 776 spin_lock_irq(&qdio->req_q_lock);
777 if (zfcp_qdio_sbal_get(qdio)) 777 if (zfcp_qdio_sbal_get(qdio))
778 goto out; 778 goto out;
779 779
@@ -807,7 +807,7 @@ failed_buf:
807 zfcp_fsf_req_free(req); 807 zfcp_fsf_req_free(req);
808 zfcp_dbf_hba_fsf_unsol("fail", adapter->dbf, NULL); 808 zfcp_dbf_hba_fsf_unsol("fail", adapter->dbf, NULL);
809out: 809out:
810 spin_unlock_bh(&qdio->req_q_lock); 810 spin_unlock_irq(&qdio->req_q_lock);
811 return retval; 811 return retval;
812} 812}
813 813
@@ -876,7 +876,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
876 struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio; 876 struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio;
877 unsigned long old_req_id = (unsigned long) scmnd->host_scribble; 877 unsigned long old_req_id = (unsigned long) scmnd->host_scribble;
878 878
879 spin_lock_bh(&qdio->req_q_lock); 879 spin_lock_irq(&qdio->req_q_lock);
880 if (zfcp_qdio_sbal_get(qdio)) 880 if (zfcp_qdio_sbal_get(qdio))
881 goto out; 881 goto out;
882 req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, 882 req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND,
@@ -907,7 +907,7 @@ out_error_free:
907 zfcp_fsf_req_free(req); 907 zfcp_fsf_req_free(req);
908 req = NULL; 908 req = NULL;
909out: 909out:
910 spin_unlock_bh(&qdio->req_q_lock); 910 spin_unlock_irq(&qdio->req_q_lock);
911 return req; 911 return req;
912} 912}
913 913
@@ -1046,7 +1046,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
1046 struct zfcp_fsf_req *req; 1046 struct zfcp_fsf_req *req;
1047 int ret = -EIO; 1047 int ret = -EIO;
1048 1048
1049 spin_lock_bh(&qdio->req_q_lock); 1049 spin_lock_irq(&qdio->req_q_lock);
1050 if (zfcp_qdio_sbal_get(qdio)) 1050 if (zfcp_qdio_sbal_get(qdio))
1051 goto out; 1051 goto out;
1052 1052
@@ -1078,7 +1078,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
1078failed_send: 1078failed_send:
1079 zfcp_fsf_req_free(req); 1079 zfcp_fsf_req_free(req);
1080out: 1080out:
1081 spin_unlock_bh(&qdio->req_q_lock); 1081 spin_unlock_irq(&qdio->req_q_lock);
1082 return ret; 1082 return ret;
1083} 1083}
1084 1084
@@ -1142,7 +1142,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
1142 struct zfcp_qdio *qdio = adapter->qdio; 1142 struct zfcp_qdio *qdio = adapter->qdio;
1143 int ret = -EIO; 1143 int ret = -EIO;
1144 1144
1145 spin_lock_bh(&qdio->req_q_lock); 1145 spin_lock_irq(&qdio->req_q_lock);
1146 if (zfcp_qdio_sbal_get(qdio)) 1146 if (zfcp_qdio_sbal_get(qdio))
1147 goto out; 1147 goto out;
1148 1148
@@ -1178,7 +1178,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
1178failed_send: 1178failed_send:
1179 zfcp_fsf_req_free(req); 1179 zfcp_fsf_req_free(req);
1180out: 1180out:
1181 spin_unlock_bh(&qdio->req_q_lock); 1181 spin_unlock_irq(&qdio->req_q_lock);
1182 return ret; 1182 return ret;
1183} 1183}
1184 1184
@@ -1188,7 +1188,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1188 struct zfcp_qdio *qdio = erp_action->adapter->qdio; 1188 struct zfcp_qdio *qdio = erp_action->adapter->qdio;
1189 int retval = -EIO; 1189 int retval = -EIO;
1190 1190
1191 spin_lock_bh(&qdio->req_q_lock); 1191 spin_lock_irq(&qdio->req_q_lock);
1192 if (zfcp_qdio_sbal_get(qdio)) 1192 if (zfcp_qdio_sbal_get(qdio))
1193 goto out; 1193 goto out;
1194 1194
@@ -1220,7 +1220,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1220 erp_action->fsf_req_id = 0; 1220 erp_action->fsf_req_id = 0;
1221 } 1221 }
1222out: 1222out:
1223 spin_unlock_bh(&qdio->req_q_lock); 1223 spin_unlock_irq(&qdio->req_q_lock);
1224 return retval; 1224 return retval;
1225} 1225}
1226 1226
@@ -1230,7 +1230,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
1230 struct zfcp_fsf_req *req = NULL; 1230 struct zfcp_fsf_req *req = NULL;
1231 int retval = -EIO; 1231 int retval = -EIO;
1232 1232
1233 spin_lock_bh(&qdio->req_q_lock); 1233 spin_lock_irq(&qdio->req_q_lock);
1234 if (zfcp_qdio_sbal_get(qdio)) 1234 if (zfcp_qdio_sbal_get(qdio))
1235 goto out_unlock; 1235 goto out_unlock;
1236 1236
@@ -1256,7 +1256,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
1256 1256
1257 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1257 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1258 retval = zfcp_fsf_req_send(req); 1258 retval = zfcp_fsf_req_send(req);
1259 spin_unlock_bh(&qdio->req_q_lock); 1259 spin_unlock_irq(&qdio->req_q_lock);
1260 if (!retval) 1260 if (!retval)
1261 wait_for_completion(&req->completion); 1261 wait_for_completion(&req->completion);
1262 1262
@@ -1264,7 +1264,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
1264 return retval; 1264 return retval;
1265 1265
1266out_unlock: 1266out_unlock:
1267 spin_unlock_bh(&qdio->req_q_lock); 1267 spin_unlock_irq(&qdio->req_q_lock);
1268 return retval; 1268 return retval;
1269} 1269}
1270 1270
@@ -1282,7 +1282,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1282 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1282 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1283 return -EOPNOTSUPP; 1283 return -EOPNOTSUPP;
1284 1284
1285 spin_lock_bh(&qdio->req_q_lock); 1285 spin_lock_irq(&qdio->req_q_lock);
1286 if (zfcp_qdio_sbal_get(qdio)) 1286 if (zfcp_qdio_sbal_get(qdio))
1287 goto out; 1287 goto out;
1288 1288
@@ -1309,7 +1309,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1309 erp_action->fsf_req_id = 0; 1309 erp_action->fsf_req_id = 0;
1310 } 1310 }
1311out: 1311out:
1312 spin_unlock_bh(&qdio->req_q_lock); 1312 spin_unlock_irq(&qdio->req_q_lock);
1313 return retval; 1313 return retval;
1314} 1314}
1315 1315
@@ -1328,7 +1328,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
1328 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1328 if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1329 return -EOPNOTSUPP; 1329 return -EOPNOTSUPP;
1330 1330
1331 spin_lock_bh(&qdio->req_q_lock); 1331 spin_lock_irq(&qdio->req_q_lock);
1332 if (zfcp_qdio_sbal_get(qdio)) 1332 if (zfcp_qdio_sbal_get(qdio))
1333 goto out_unlock; 1333 goto out_unlock;
1334 1334
@@ -1348,7 +1348,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
1348 req->handler = zfcp_fsf_exchange_port_data_handler; 1348 req->handler = zfcp_fsf_exchange_port_data_handler;
1349 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1349 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1350 retval = zfcp_fsf_req_send(req); 1350 retval = zfcp_fsf_req_send(req);
1351 spin_unlock_bh(&qdio->req_q_lock); 1351 spin_unlock_irq(&qdio->req_q_lock);
1352 1352
1353 if (!retval) 1353 if (!retval)
1354 wait_for_completion(&req->completion); 1354 wait_for_completion(&req->completion);
@@ -1358,7 +1358,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
1358 return retval; 1358 return retval;
1359 1359
1360out_unlock: 1360out_unlock:
1361 spin_unlock_bh(&qdio->req_q_lock); 1361 spin_unlock_irq(&qdio->req_q_lock);
1362 return retval; 1362 return retval;
1363} 1363}
1364 1364
@@ -1442,7 +1442,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1442 struct zfcp_fsf_req *req; 1442 struct zfcp_fsf_req *req;
1443 int retval = -EIO; 1443 int retval = -EIO;
1444 1444
1445 spin_lock_bh(&qdio->req_q_lock); 1445 spin_lock_irq(&qdio->req_q_lock);
1446 if (zfcp_qdio_sbal_get(qdio)) 1446 if (zfcp_qdio_sbal_get(qdio))
1447 goto out; 1447 goto out;
1448 1448
@@ -1473,7 +1473,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1473 put_device(&port->dev); 1473 put_device(&port->dev);
1474 } 1474 }
1475out: 1475out:
1476 spin_unlock_bh(&qdio->req_q_lock); 1476 spin_unlock_irq(&qdio->req_q_lock);
1477 return retval; 1477 return retval;
1478} 1478}
1479 1479
@@ -1510,7 +1510,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1510 struct zfcp_fsf_req *req; 1510 struct zfcp_fsf_req *req;
1511 int retval = -EIO; 1511 int retval = -EIO;
1512 1512
1513 spin_lock_bh(&qdio->req_q_lock); 1513 spin_lock_irq(&qdio->req_q_lock);
1514 if (zfcp_qdio_sbal_get(qdio)) 1514 if (zfcp_qdio_sbal_get(qdio))
1515 goto out; 1515 goto out;
1516 1516
@@ -1539,7 +1539,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1539 erp_action->fsf_req_id = 0; 1539 erp_action->fsf_req_id = 0;
1540 } 1540 }
1541out: 1541out:
1542 spin_unlock_bh(&qdio->req_q_lock); 1542 spin_unlock_irq(&qdio->req_q_lock);
1543 return retval; 1543 return retval;
1544} 1544}
1545 1545
@@ -1585,7 +1585,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
1585 struct zfcp_fsf_req *req; 1585 struct zfcp_fsf_req *req;
1586 int retval = -EIO; 1586 int retval = -EIO;
1587 1587
1588 spin_lock_bh(&qdio->req_q_lock); 1588 spin_lock_irq(&qdio->req_q_lock);
1589 if (zfcp_qdio_sbal_get(qdio)) 1589 if (zfcp_qdio_sbal_get(qdio))
1590 goto out; 1590 goto out;
1591 1591
@@ -1610,7 +1610,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
1610 if (retval) 1610 if (retval)
1611 zfcp_fsf_req_free(req); 1611 zfcp_fsf_req_free(req);
1612out: 1612out:
1613 spin_unlock_bh(&qdio->req_q_lock); 1613 spin_unlock_irq(&qdio->req_q_lock);
1614 return retval; 1614 return retval;
1615} 1615}
1616 1616
@@ -1638,7 +1638,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
1638 struct zfcp_fsf_req *req; 1638 struct zfcp_fsf_req *req;
1639 int retval = -EIO; 1639 int retval = -EIO;
1640 1640
1641 spin_lock_bh(&qdio->req_q_lock); 1641 spin_lock_irq(&qdio->req_q_lock);
1642 if (zfcp_qdio_sbal_get(qdio)) 1642 if (zfcp_qdio_sbal_get(qdio))
1643 goto out; 1643 goto out;
1644 1644
@@ -1663,7 +1663,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
1663 if (retval) 1663 if (retval)
1664 zfcp_fsf_req_free(req); 1664 zfcp_fsf_req_free(req);
1665out: 1665out:
1666 spin_unlock_bh(&qdio->req_q_lock); 1666 spin_unlock_irq(&qdio->req_q_lock);
1667 return retval; 1667 return retval;
1668} 1668}
1669 1669
@@ -1728,7 +1728,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1728 struct zfcp_fsf_req *req; 1728 struct zfcp_fsf_req *req;
1729 int retval = -EIO; 1729 int retval = -EIO;
1730 1730
1731 spin_lock_bh(&qdio->req_q_lock); 1731 spin_lock_irq(&qdio->req_q_lock);
1732 if (zfcp_qdio_sbal_get(qdio)) 1732 if (zfcp_qdio_sbal_get(qdio))
1733 goto out; 1733 goto out;
1734 1734
@@ -1757,7 +1757,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1757 erp_action->fsf_req_id = 0; 1757 erp_action->fsf_req_id = 0;
1758 } 1758 }
1759out: 1759out:
1760 spin_unlock_bh(&qdio->req_q_lock); 1760 spin_unlock_irq(&qdio->req_q_lock);
1761 return retval; 1761 return retval;
1762} 1762}
1763 1763
@@ -1900,7 +1900,7 @@ int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action)
1900 struct zfcp_fsf_req *req; 1900 struct zfcp_fsf_req *req;
1901 int retval = -EIO; 1901 int retval = -EIO;
1902 1902
1903 spin_lock_bh(&qdio->req_q_lock); 1903 spin_lock_irq(&qdio->req_q_lock);
1904 if (zfcp_qdio_sbal_get(qdio)) 1904 if (zfcp_qdio_sbal_get(qdio))
1905 goto out; 1905 goto out;
1906 1906
@@ -1933,7 +1933,7 @@ int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action)
1933 erp_action->fsf_req_id = 0; 1933 erp_action->fsf_req_id = 0;
1934 } 1934 }
1935out: 1935out:
1936 spin_unlock_bh(&qdio->req_q_lock); 1936 spin_unlock_irq(&qdio->req_q_lock);
1937 return retval; 1937 return retval;
1938} 1938}
1939 1939
@@ -1987,7 +1987,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action)
1987 struct zfcp_fsf_req *req; 1987 struct zfcp_fsf_req *req;
1988 int retval = -EIO; 1988 int retval = -EIO;
1989 1989
1990 spin_lock_bh(&qdio->req_q_lock); 1990 spin_lock_irq(&qdio->req_q_lock);
1991 if (zfcp_qdio_sbal_get(qdio)) 1991 if (zfcp_qdio_sbal_get(qdio))
1992 goto out; 1992 goto out;
1993 1993
@@ -2017,7 +2017,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action)
2017 erp_action->fsf_req_id = 0; 2017 erp_action->fsf_req_id = 0;
2018 } 2018 }
2019out: 2019out:
2020 spin_unlock_bh(&qdio->req_q_lock); 2020 spin_unlock_irq(&qdio->req_q_lock);
2021 return retval; 2021 return retval;
2022} 2022}
2023 2023
@@ -2363,7 +2363,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,
2363 ZFCP_STATUS_COMMON_UNBLOCKED))) 2363 ZFCP_STATUS_COMMON_UNBLOCKED)))
2364 return NULL; 2364 return NULL;
2365 2365
2366 spin_lock_bh(&qdio->req_q_lock); 2366 spin_lock_irq(&qdio->req_q_lock);
2367 if (zfcp_qdio_sbal_get(qdio)) 2367 if (zfcp_qdio_sbal_get(qdio))
2368 goto out; 2368 goto out;
2369 2369
@@ -2397,7 +2397,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,
2397 zfcp_fsf_req_free(req); 2397 zfcp_fsf_req_free(req);
2398 req = NULL; 2398 req = NULL;
2399out: 2399out:
2400 spin_unlock_bh(&qdio->req_q_lock); 2400 spin_unlock_irq(&qdio->req_q_lock);
2401 return req; 2401 return req;
2402} 2402}
2403 2403
@@ -2433,7 +2433,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2433 return ERR_PTR(-EINVAL); 2433 return ERR_PTR(-EINVAL);
2434 } 2434 }
2435 2435
2436 spin_lock_bh(&qdio->req_q_lock); 2436 spin_lock_irq(&qdio->req_q_lock);
2437 if (zfcp_qdio_sbal_get(qdio)) 2437 if (zfcp_qdio_sbal_get(qdio))
2438 goto out; 2438 goto out;
2439 2439
@@ -2460,7 +2460,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2460 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 2460 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
2461 retval = zfcp_fsf_req_send(req); 2461 retval = zfcp_fsf_req_send(req);
2462out: 2462out:
2463 spin_unlock_bh(&qdio->req_q_lock); 2463 spin_unlock_irq(&qdio->req_q_lock);
2464 2464
2465 if (!retval) { 2465 if (!retval) {
2466 wait_for_completion(&req->completion); 2466 wait_for_completion(&req->completion);
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index b2635759721c..60e6e5714eb9 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -60,13 +60,11 @@ static inline void zfcp_qdio_account(struct zfcp_qdio *qdio)
60 unsigned long long now, span; 60 unsigned long long now, span;
61 int used; 61 int used;
62 62
63 spin_lock(&qdio->stat_lock);
64 now = get_clock_monotonic(); 63 now = get_clock_monotonic();
65 span = (now - qdio->req_q_time) >> 12; 64 span = (now - qdio->req_q_time) >> 12;
66 used = QDIO_MAX_BUFFERS_PER_Q - atomic_read(&qdio->req_q_free); 65 used = QDIO_MAX_BUFFERS_PER_Q - atomic_read(&qdio->req_q_free);
67 qdio->req_q_util += used * span; 66 qdio->req_q_util += used * span;
68 qdio->req_q_time = now; 67 qdio->req_q_time = now;
69 spin_unlock(&qdio->stat_lock);
70} 68}
71 69
72static void zfcp_qdio_int_req(struct ccw_device *cdev, unsigned int qdio_err, 70static void zfcp_qdio_int_req(struct ccw_device *cdev, unsigned int qdio_err,
@@ -84,7 +82,9 @@ static void zfcp_qdio_int_req(struct ccw_device *cdev, unsigned int qdio_err,
84 /* cleanup all SBALs being program-owned now */ 82 /* cleanup all SBALs being program-owned now */
85 zfcp_qdio_zero_sbals(qdio->req_q, idx, count); 83 zfcp_qdio_zero_sbals(qdio->req_q, idx, count);
86 84
85 spin_lock_irq(&qdio->stat_lock);
87 zfcp_qdio_account(qdio); 86 zfcp_qdio_account(qdio);
87 spin_unlock_irq(&qdio->stat_lock);
88 atomic_add(count, &qdio->req_q_free); 88 atomic_add(count, &qdio->req_q_free);
89 wake_up(&qdio->req_q_wq); 89 wake_up(&qdio->req_q_wq);
90} 90}
@@ -201,11 +201,11 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
201 201
202static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio) 202static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio)
203{ 203{
204 spin_lock_bh(&qdio->req_q_lock); 204 spin_lock_irq(&qdio->req_q_lock);
205 if (atomic_read(&qdio->req_q_free) || 205 if (atomic_read(&qdio->req_q_free) ||
206 !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP)) 206 !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
207 return 1; 207 return 1;
208 spin_unlock_bh(&qdio->req_q_lock); 208 spin_unlock_irq(&qdio->req_q_lock);
209 return 0; 209 return 0;
210} 210}
211 211
@@ -223,7 +223,7 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio)
223{ 223{
224 long ret; 224 long ret;
225 225
226 spin_unlock_bh(&qdio->req_q_lock); 226 spin_unlock_irq(&qdio->req_q_lock);
227 ret = wait_event_interruptible_timeout(qdio->req_q_wq, 227 ret = wait_event_interruptible_timeout(qdio->req_q_wq,
228 zfcp_qdio_sbal_check(qdio), 5 * HZ); 228 zfcp_qdio_sbal_check(qdio), 5 * HZ);
229 229
@@ -239,7 +239,7 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio)
239 zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdsbg_1", NULL); 239 zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdsbg_1", NULL);
240 } 240 }
241 241
242 spin_lock_bh(&qdio->req_q_lock); 242 spin_lock_irq(&qdio->req_q_lock);
243 return -EIO; 243 return -EIO;
244} 244}
245 245
@@ -254,7 +254,9 @@ int zfcp_qdio_send(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
254 int retval; 254 int retval;
255 u8 sbal_number = q_req->sbal_number; 255 u8 sbal_number = q_req->sbal_number;
256 256
257 spin_lock(&qdio->stat_lock);
257 zfcp_qdio_account(qdio); 258 zfcp_qdio_account(qdio);
259 spin_unlock(&qdio->stat_lock);
258 260
259 retval = do_QDIO(qdio->adapter->ccw_device, QDIO_FLAG_SYNC_OUTPUT, 0, 261 retval = do_QDIO(qdio->adapter->ccw_device, QDIO_FLAG_SYNC_OUTPUT, 0,
260 q_req->sbal_first, sbal_number); 262 q_req->sbal_first, sbal_number);
@@ -328,9 +330,9 @@ void zfcp_qdio_close(struct zfcp_qdio *qdio)
328 return; 330 return;
329 331
330 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ 332 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */
331 spin_lock_bh(&qdio->req_q_lock); 333 spin_lock_irq(&qdio->req_q_lock);
332 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); 334 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
333 spin_unlock_bh(&qdio->req_q_lock); 335 spin_unlock_irq(&qdio->req_q_lock);
334 336
335 wake_up(&qdio->req_q_wq); 337 wake_up(&qdio->req_q_wq);
336 338