aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
authorAndreas Herrmann <aherrman@de.ibm.com>2005-09-13 15:47:52 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-19 14:01:23 -0400
commit059c97d0434834d291eff94669ca2dd3eaac9d28 (patch)
tree70719559f65366c74eb82ee8c7c7a01a0d80aca9 /drivers/s390/scsi/zfcp_fsf.c
parent3734d24b2e8d85796de70c13705cfb7cbb1d77df (diff)
[SCSI] zfcp: remove union zfcp_req_data, use unit refcount for FCP commands
o union zfcp_req_data removed o increment unit refcount when processing FCP commands (This fixes a theoretical race: When all scsi commands of a unit are aborted and the scsi_device is removed then the unit could be removed before all fsf_requests of that unit are completely processed.) Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c101
1 files changed, 50 insertions, 51 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c007b6424e74..64e2c3480189 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -821,7 +821,7 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
821 goto failed_buf; 821 goto failed_buf;
822 } 822 }
823 memset(status_buffer, 0, sizeof (struct fsf_status_read_buffer)); 823 memset(status_buffer, 0, sizeof (struct fsf_status_read_buffer));
824 fsf_req->data.status_read.buffer = status_buffer; 824 fsf_req->data = (unsigned long) status_buffer;
825 825
826 /* insert pointer to respective buffer */ 826 /* insert pointer to respective buffer */
827 sbale = zfcp_qdio_sbale_curr(fsf_req); 827 sbale = zfcp_qdio_sbale_curr(fsf_req);
@@ -859,7 +859,7 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
859 struct zfcp_port *port; 859 struct zfcp_port *port;
860 unsigned long flags; 860 unsigned long flags;
861 861
862 status_buffer = fsf_req->data.status_read.buffer; 862 status_buffer = (struct fsf_status_read_buffer *) fsf_req->data;
863 adapter = fsf_req->adapter; 863 adapter = fsf_req->adapter;
864 864
865 read_lock_irqsave(&zfcp_data.config_lock, flags); 865 read_lock_irqsave(&zfcp_data.config_lock, flags);
@@ -918,7 +918,7 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
918 int retval = 0; 918 int retval = 0;
919 struct zfcp_adapter *adapter = fsf_req->adapter; 919 struct zfcp_adapter *adapter = fsf_req->adapter;
920 struct fsf_status_read_buffer *status_buffer = 920 struct fsf_status_read_buffer *status_buffer =
921 fsf_req->data.status_read.buffer; 921 (struct fsf_status_read_buffer *) fsf_req->data;
922 922
923 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 923 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
924 mempool_free(status_buffer, adapter->pool.data_status_read); 924 mempool_free(status_buffer, adapter->pool.data_status_read);
@@ -1093,7 +1093,7 @@ zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
1093 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1093 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1094 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1094 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1095 1095
1096 fsf_req->data.abort_fcp_command.unit = unit; 1096 fsf_req->data = (unsigned long) unit;
1097 1097
1098 /* set handles of unit and its parent port in QTCB */ 1098 /* set handles of unit and its parent port in QTCB */
1099 fsf_req->qtcb->header.lun_handle = unit->handle; 1099 fsf_req->qtcb->header.lun_handle = unit->handle;
@@ -1139,7 +1139,7 @@ static int
1139zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req) 1139zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1140{ 1140{
1141 int retval = -EINVAL; 1141 int retval = -EINVAL;
1142 struct zfcp_unit *unit = new_fsf_req->data.abort_fcp_command.unit; 1142 struct zfcp_unit *unit;
1143 unsigned char status_qual = 1143 unsigned char status_qual =
1144 new_fsf_req->qtcb->header.fsf_status_qual.word[0]; 1144 new_fsf_req->qtcb->header.fsf_status_qual.word[0];
1145 1145
@@ -1150,6 +1150,8 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1150 goto skip_fsfstatus; 1150 goto skip_fsfstatus;
1151 } 1151 }
1152 1152
1153 unit = (struct zfcp_unit *) new_fsf_req->data;
1154
1153 /* evaluate FSF status in QTCB */ 1155 /* evaluate FSF status in QTCB */
1154 switch (new_fsf_req->qtcb->header.fsf_status) { 1156 switch (new_fsf_req->qtcb->header.fsf_status) {
1155 1157
@@ -1414,7 +1416,7 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1414 fsf_req->qtcb->header.port_handle = port->handle; 1416 fsf_req->qtcb->header.port_handle = port->handle;
1415 fsf_req->qtcb->bottom.support.service_class = adapter->fc_service_class; 1417 fsf_req->qtcb->bottom.support.service_class = adapter->fc_service_class;
1416 fsf_req->qtcb->bottom.support.timeout = ct->timeout; 1418 fsf_req->qtcb->bottom.support.timeout = ct->timeout;
1417 fsf_req->data.send_ct = ct; 1419 fsf_req->data = (unsigned long) ct;
1418 1420
1419 /* start QDIO request for this FSF request */ 1421 /* start QDIO request for this FSF request */
1420 ret = zfcp_fsf_req_send(fsf_req, ct->timer); 1422 ret = zfcp_fsf_req_send(fsf_req, ct->timer);
@@ -1445,10 +1447,10 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1445 * zfcp_fsf_send_ct_handler - handler for Generic Service requests 1447 * zfcp_fsf_send_ct_handler - handler for Generic Service requests
1446 * @fsf_req: pointer to struct zfcp_fsf_req 1448 * @fsf_req: pointer to struct zfcp_fsf_req
1447 * 1449 *
1448 * Data specific for the Generic Service request is passed by 1450 * Data specific for the Generic Service request is passed using
1449 * fsf_req->data.send_ct 1451 * fsf_req->data. There we find the pointer to struct zfcp_send_ct.
1450 * Usually a specific handler for the request is called via 1452 * Usually a specific handler for the CT request is called which is
1451 * fsf_req->data.send_ct->handler at end of this function. 1453 * found in this structure.
1452 */ 1454 */
1453static int 1455static int
1454zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req) 1456zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
@@ -1462,7 +1464,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1462 u16 subtable, rule, counter; 1464 u16 subtable, rule, counter;
1463 1465
1464 adapter = fsf_req->adapter; 1466 adapter = fsf_req->adapter;
1465 send_ct = fsf_req->data.send_ct; 1467 send_ct = (struct zfcp_send_ct *) fsf_req->data;
1466 port = send_ct->port; 1468 port = send_ct->port;
1467 header = &fsf_req->qtcb->header; 1469 header = &fsf_req->qtcb->header;
1468 bottom = &fsf_req->qtcb->bottom.support; 1470 bottom = &fsf_req->qtcb->bottom.support;
@@ -1714,7 +1716,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1714 fsf_req->qtcb->bottom.support.d_id = d_id; 1716 fsf_req->qtcb->bottom.support.d_id = d_id;
1715 fsf_req->qtcb->bottom.support.service_class = adapter->fc_service_class; 1717 fsf_req->qtcb->bottom.support.service_class = adapter->fc_service_class;
1716 fsf_req->qtcb->bottom.support.timeout = ZFCP_ELS_TIMEOUT; 1718 fsf_req->qtcb->bottom.support.timeout = ZFCP_ELS_TIMEOUT;
1717 fsf_req->data.send_els = els; 1719 fsf_req->data = (unsigned long) els;
1718 1720
1719 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); 1721 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0);
1720 1722
@@ -1746,10 +1748,10 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1746 * zfcp_fsf_send_els_handler - handler for ELS commands 1748 * zfcp_fsf_send_els_handler - handler for ELS commands
1747 * @fsf_req: pointer to struct zfcp_fsf_req 1749 * @fsf_req: pointer to struct zfcp_fsf_req
1748 * 1750 *
1749 * Data specific for the ELS command is passed by 1751 * Data specific for the ELS command is passed using
1750 * fsf_req->data.send_els 1752 * fsf_req->data. There we find the pointer to struct zfcp_send_els.
1751 * Usually a specific handler for the command is called via 1753 * Usually a specific handler for the ELS command is called which is
1752 * fsf_req->data.send_els->handler at end of this function. 1754 * found in this structure.
1753 */ 1755 */
1754static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req) 1756static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1755{ 1757{
@@ -1762,7 +1764,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1762 int retval = -EINVAL; 1764 int retval = -EINVAL;
1763 u16 subtable, rule, counter; 1765 u16 subtable, rule, counter;
1764 1766
1765 send_els = fsf_req->data.send_els; 1767 send_els = (struct zfcp_send_els *) fsf_req->data;
1766 adapter = send_els->adapter; 1768 adapter = send_els->adapter;
1767 port = send_els->port; 1769 port = send_els->port;
1768 d_id = send_els->d_id; 1770 d_id = send_els->d_id;
@@ -2211,12 +2213,12 @@ zfcp_fsf_exchange_port_data(struct zfcp_adapter *adapter,
2211 goto out; 2213 goto out;
2212 } 2214 }
2213 2215
2216 fsf_req->data = (unsigned long) data;
2217
2214 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); 2218 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0);
2215 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2219 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
2216 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2220 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2217 2221
2218 fsf_req->data.port_data = data;
2219
2220 init_timer(timer); 2222 init_timer(timer);
2221 timer->function = zfcp_fsf_request_timeout_handler; 2223 timer->function = zfcp_fsf_request_timeout_handler;
2222 timer->data = (unsigned long) adapter; 2224 timer->data = (unsigned long) adapter;
@@ -2257,7 +2259,9 @@ static void
2257zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req) 2259zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req)
2258{ 2260{
2259 struct fsf_qtcb_bottom_port *bottom; 2261 struct fsf_qtcb_bottom_port *bottom;
2260 struct fsf_qtcb_bottom_port *data = fsf_req->data.port_data; 2262 struct fsf_qtcb_bottom_port *data;
2263
2264 data = (struct fsf_qtcb_bottom_port*) fsf_req->data;
2261 2265
2262 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) 2266 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
2263 return; 2267 return;
@@ -2312,7 +2316,7 @@ zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
2312 2316
2313 erp_action->fsf_req->qtcb->bottom.support.d_id = erp_action->port->d_id; 2317 erp_action->fsf_req->qtcb->bottom.support.d_id = erp_action->port->d_id;
2314 atomic_set_mask(ZFCP_STATUS_COMMON_OPENING, &erp_action->port->status); 2318 atomic_set_mask(ZFCP_STATUS_COMMON_OPENING, &erp_action->port->status);
2315 erp_action->fsf_req->data.open_port.port = erp_action->port; 2319 erp_action->fsf_req->data = (unsigned long) erp_action->port;
2316 erp_action->fsf_req->erp_action = erp_action; 2320 erp_action->fsf_req->erp_action = erp_action;
2317 2321
2318 /* start QDIO request for this FSF request */ 2322 /* start QDIO request for this FSF request */
@@ -2353,7 +2357,7 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2353 struct fsf_qtcb_header *header; 2357 struct fsf_qtcb_header *header;
2354 u16 subtable, rule, counter; 2358 u16 subtable, rule, counter;
2355 2359
2356 port = fsf_req->data.open_port.port; 2360 port = (struct zfcp_port *) fsf_req->data;
2357 header = &fsf_req->qtcb->header; 2361 header = &fsf_req->qtcb->header;
2358 2362
2359 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 2363 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
@@ -2566,7 +2570,7 @@ zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
2566 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2570 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2567 2571
2568 atomic_set_mask(ZFCP_STATUS_COMMON_CLOSING, &erp_action->port->status); 2572 atomic_set_mask(ZFCP_STATUS_COMMON_CLOSING, &erp_action->port->status);
2569 erp_action->fsf_req->data.close_port.port = erp_action->port; 2573 erp_action->fsf_req->data = (unsigned long) erp_action->port;
2570 erp_action->fsf_req->erp_action = erp_action; 2574 erp_action->fsf_req->erp_action = erp_action;
2571 erp_action->fsf_req->qtcb->header.port_handle = 2575 erp_action->fsf_req->qtcb->header.port_handle =
2572 erp_action->port->handle; 2576 erp_action->port->handle;
@@ -2606,7 +2610,7 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2606 int retval = -EINVAL; 2610 int retval = -EINVAL;
2607 struct zfcp_port *port; 2611 struct zfcp_port *port;
2608 2612
2609 port = fsf_req->data.close_port.port; 2613 port = (struct zfcp_port *) fsf_req->data;
2610 2614
2611 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 2615 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
2612 /* don't change port status in our bookkeeping */ 2616 /* don't change port status in our bookkeeping */
@@ -2703,7 +2707,7 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
2703 atomic_set_mask(ZFCP_STATUS_PORT_PHYS_CLOSING, 2707 atomic_set_mask(ZFCP_STATUS_PORT_PHYS_CLOSING,
2704 &erp_action->port->status); 2708 &erp_action->port->status);
2705 /* save a pointer to this port */ 2709 /* save a pointer to this port */
2706 erp_action->fsf_req->data.close_physical_port.port = erp_action->port; 2710 erp_action->fsf_req->data = (unsigned long) erp_action->port;
2707 /* port to be closeed */ 2711 /* port to be closeed */
2708 erp_action->fsf_req->qtcb->header.port_handle = 2712 erp_action->fsf_req->qtcb->header.port_handle =
2709 erp_action->port->handle; 2713 erp_action->port->handle;
@@ -2747,7 +2751,7 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2747 struct fsf_qtcb_header *header; 2751 struct fsf_qtcb_header *header;
2748 u16 subtable, rule, counter; 2752 u16 subtable, rule, counter;
2749 2753
2750 port = fsf_req->data.close_physical_port.port; 2754 port = (struct zfcp_port *) fsf_req->data;
2751 header = &fsf_req->qtcb->header; 2755 header = &fsf_req->qtcb->header;
2752 2756
2753 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 2757 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
@@ -2911,7 +2915,7 @@ zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2911 erp_action->fsf_req->qtcb->bottom.support.option = 2915 erp_action->fsf_req->qtcb->bottom.support.option =
2912 FSF_OPEN_LUN_SUPPRESS_BOXING; 2916 FSF_OPEN_LUN_SUPPRESS_BOXING;
2913 atomic_set_mask(ZFCP_STATUS_COMMON_OPENING, &erp_action->unit->status); 2917 atomic_set_mask(ZFCP_STATUS_COMMON_OPENING, &erp_action->unit->status);
2914 erp_action->fsf_req->data.open_unit.unit = erp_action->unit; 2918 erp_action->fsf_req->data = (unsigned long) erp_action->unit;
2915 erp_action->fsf_req->erp_action = erp_action; 2919 erp_action->fsf_req->erp_action = erp_action;
2916 2920
2917 /* start QDIO request for this FSF request */ 2921 /* start QDIO request for this FSF request */
@@ -2957,7 +2961,7 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
2957 u16 subtable, rule, counter; 2961 u16 subtable, rule, counter;
2958 u32 allowed, exclusive, readwrite; 2962 u32 allowed, exclusive, readwrite;
2959 2963
2960 unit = fsf_req->data.open_unit.unit; 2964 unit = (struct zfcp_unit *) fsf_req->data;
2961 2965
2962 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 2966 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
2963 /* don't change unit status in our bookkeeping */ 2967 /* don't change unit status in our bookkeeping */
@@ -3242,7 +3246,7 @@ zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
3242 erp_action->port->handle; 3246 erp_action->port->handle;
3243 erp_action->fsf_req->qtcb->header.lun_handle = erp_action->unit->handle; 3247 erp_action->fsf_req->qtcb->header.lun_handle = erp_action->unit->handle;
3244 atomic_set_mask(ZFCP_STATUS_COMMON_CLOSING, &erp_action->unit->status); 3248 atomic_set_mask(ZFCP_STATUS_COMMON_CLOSING, &erp_action->unit->status);
3245 erp_action->fsf_req->data.close_unit.unit = erp_action->unit; 3249 erp_action->fsf_req->data = (unsigned long) erp_action->unit;
3246 erp_action->fsf_req->erp_action = erp_action; 3250 erp_action->fsf_req->erp_action = erp_action;
3247 3251
3248 /* start QDIO request for this FSF request */ 3252 /* start QDIO request for this FSF request */
@@ -3281,7 +3285,7 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3281 int retval = -EINVAL; 3285 int retval = -EINVAL;
3282 struct zfcp_unit *unit; 3286 struct zfcp_unit *unit;
3283 3287
3284 unit = fsf_req->data.close_unit.unit; /* restore unit */ 3288 unit = (struct zfcp_unit *) fsf_req->data;
3285 3289
3286 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 3290 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
3287 /* don't change unit status in our bookkeeping */ 3291 /* don't change unit status in our bookkeeping */
@@ -3436,21 +3440,14 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3436 goto failed_req_create; 3440 goto failed_req_create;
3437 } 3441 }
3438 3442
3439 /* 3443 zfcp_unit_get(unit);
3440 * associate FSF request with SCSI request 3444 fsf_req->unit = unit;
3441 * (need this for look up on abort)
3442 */
3443 fsf_req->data.send_fcp_command_task.fsf_req = fsf_req;
3444 scsi_cmnd->host_scribble = (char *) &(fsf_req->data);
3445 3445
3446 /* 3446 /* associate FSF request with SCSI request (for look up on abort) */
3447 * associate SCSI command with FSF request 3447 scsi_cmnd->host_scribble = (char *) fsf_req;
3448 * (need this for look up on normal command completion) 3448
3449 */ 3449 /* associate SCSI command with FSF request */
3450 fsf_req->data.send_fcp_command_task.scsi_cmnd = scsi_cmnd; 3450 fsf_req->data = (unsigned long) scsi_cmnd;
3451 fsf_req->data.send_fcp_command_task.start_jiffies = jiffies;
3452 fsf_req->data.send_fcp_command_task.unit = unit;
3453 ZFCP_LOG_DEBUG("unit=%p, fcp_lun=0x%016Lx\n", unit, unit->fcp_lun);
3454 3451
3455 /* set handles of unit and its parent port in QTCB */ 3452 /* set handles of unit and its parent port in QTCB */
3456 fsf_req->qtcb->header.lun_handle = unit->handle; 3453 fsf_req->qtcb->header.lun_handle = unit->handle;
@@ -3584,6 +3581,7 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3584 send_failed: 3581 send_failed:
3585 no_fit: 3582 no_fit:
3586 failed_scsi_cmnd: 3583 failed_scsi_cmnd:
3584 zfcp_unit_put(unit);
3587 zfcp_fsf_req_free(fsf_req); 3585 zfcp_fsf_req_free(fsf_req);
3588 fsf_req = NULL; 3586 fsf_req = NULL;
3589 scsi_cmnd->host_scribble = NULL; 3587 scsi_cmnd->host_scribble = NULL;
@@ -3640,7 +3638,7 @@ zfcp_fsf_send_fcp_command_task_management(struct zfcp_adapter *adapter,
3640 * hold a pointer to the unit being target of this 3638 * hold a pointer to the unit being target of this
3641 * task management request 3639 * task management request
3642 */ 3640 */
3643 fsf_req->data.send_fcp_command_task_management.unit = unit; 3641 fsf_req->data = (unsigned long) unit;
3644 3642
3645 /* set FSF related fields in QTCB */ 3643 /* set FSF related fields in QTCB */
3646 fsf_req->qtcb->header.lun_handle = unit->handle; 3644 fsf_req->qtcb->header.lun_handle = unit->handle;
@@ -3706,9 +3704,9 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3706 header = &fsf_req->qtcb->header; 3704 header = &fsf_req->qtcb->header;
3707 3705
3708 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)) 3706 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT))
3709 unit = fsf_req->data.send_fcp_command_task_management.unit; 3707 unit = (struct zfcp_unit *) fsf_req->data;
3710 else 3708 else
3711 unit = fsf_req->data.send_fcp_command_task.unit; 3709 unit = fsf_req->unit;
3712 3710
3713 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) { 3711 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
3714 /* go directly to calls of special handlers */ 3712 /* go directly to calls of special handlers */
@@ -3947,6 +3945,8 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3947 zfcp_fsf_send_fcp_command_task_management_handler(fsf_req); 3945 zfcp_fsf_send_fcp_command_task_management_handler(fsf_req);
3948 } else { 3946 } else {
3949 retval = zfcp_fsf_send_fcp_command_task_handler(fsf_req); 3947 retval = zfcp_fsf_send_fcp_command_task_handler(fsf_req);
3948 fsf_req->unit = NULL;
3949 zfcp_unit_put(unit);
3950 } 3950 }
3951 return retval; 3951 return retval;
3952} 3952}
@@ -3970,10 +3970,10 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3970 u32 sns_len; 3970 u32 sns_len;
3971 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 3971 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
3972 unsigned long flags; 3972 unsigned long flags;
3973 struct zfcp_unit *unit = fsf_req->data.send_fcp_command_task.unit; 3973 struct zfcp_unit *unit = fsf_req->unit;
3974 3974
3975 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags); 3975 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags);
3976 scpnt = fsf_req->data.send_fcp_command_task.scsi_cmnd; 3976 scpnt = (struct scsi_cmnd *) fsf_req->data;
3977 if (unlikely(!scpnt)) { 3977 if (unlikely(!scpnt)) {
3978 ZFCP_LOG_DEBUG 3978 ZFCP_LOG_DEBUG
3979 ("Command with fsf_req %p is not associated to " 3979 ("Command with fsf_req %p is not associated to "
@@ -4198,8 +4198,7 @@ zfcp_fsf_send_fcp_command_task_management_handler(struct zfcp_fsf_req *fsf_req)
4198 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *) 4198 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
4199 &(fsf_req->qtcb->bottom.io.fcp_rsp); 4199 &(fsf_req->qtcb->bottom.io.fcp_rsp);
4200 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 4200 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
4201 struct zfcp_unit *unit = 4201 struct zfcp_unit *unit = (struct zfcp_unit *) fsf_req->data;
4202 fsf_req->data.send_fcp_command_task_management.unit;
4203 4202
4204 del_timer(&fsf_req->adapter->scsi_er_timer); 4203 del_timer(&fsf_req->adapter->scsi_er_timer);
4205 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 4204 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {