diff options
Diffstat (limited to 'drivers/xen/xen-scsiback.c')
-rw-r--r-- | drivers/xen/xen-scsiback.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index d6950e0802b7..7bc88fd43cfc 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
@@ -134,11 +134,8 @@ struct vscsibk_pend { | |||
134 | struct page *pages[VSCSI_MAX_GRANTS]; | 134 | struct page *pages[VSCSI_MAX_GRANTS]; |
135 | 135 | ||
136 | struct se_cmd se_cmd; | 136 | struct se_cmd se_cmd; |
137 | }; | ||
138 | 137 | ||
139 | struct scsiback_tmr { | 138 | struct completion tmr_done; |
140 | atomic_t tmr_complete; | ||
141 | wait_queue_head_t tmr_wait; | ||
142 | }; | 139 | }; |
143 | 140 | ||
144 | #define VSCSI_DEFAULT_SESSION_TAGS 128 | 141 | #define VSCSI_DEFAULT_SESSION_TAGS 128 |
@@ -599,36 +596,28 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, | |||
599 | struct scsiback_tpg *tpg = pending_req->v2p->tpg; | 596 | struct scsiback_tpg *tpg = pending_req->v2p->tpg; |
600 | struct scsiback_nexus *nexus = tpg->tpg_nexus; | 597 | struct scsiback_nexus *nexus = tpg->tpg_nexus; |
601 | struct se_cmd *se_cmd = &pending_req->se_cmd; | 598 | struct se_cmd *se_cmd = &pending_req->se_cmd; |
602 | struct scsiback_tmr *tmr; | ||
603 | u64 unpacked_lun = pending_req->v2p->lun; | 599 | u64 unpacked_lun = pending_req->v2p->lun; |
604 | int rc, err = FAILED; | 600 | int rc, err = FAILED; |
605 | 601 | ||
606 | tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL); | 602 | init_completion(&pending_req->tmr_done); |
607 | if (!tmr) { | ||
608 | target_put_sess_cmd(se_cmd); | ||
609 | goto err; | ||
610 | } | ||
611 | |||
612 | init_waitqueue_head(&tmr->tmr_wait); | ||
613 | 603 | ||
614 | rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess, | 604 | rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess, |
615 | &pending_req->sense_buffer[0], | 605 | &pending_req->sense_buffer[0], |
616 | unpacked_lun, tmr, act, GFP_KERNEL, | 606 | unpacked_lun, NULL, act, GFP_KERNEL, |
617 | tag, TARGET_SCF_ACK_KREF); | 607 | tag, TARGET_SCF_ACK_KREF); |
618 | if (rc) | 608 | if (rc) |
619 | goto err; | 609 | goto err; |
620 | 610 | ||
621 | wait_event(tmr->tmr_wait, atomic_read(&tmr->tmr_complete)); | 611 | wait_for_completion(&pending_req->tmr_done); |
622 | 612 | ||
623 | err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ? | 613 | err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ? |
624 | SUCCESS : FAILED; | 614 | SUCCESS : FAILED; |
625 | 615 | ||
626 | scsiback_do_resp_with_sense(NULL, err, 0, pending_req); | 616 | scsiback_do_resp_with_sense(NULL, err, 0, pending_req); |
627 | transport_generic_free_cmd(&pending_req->se_cmd, 1); | 617 | transport_generic_free_cmd(&pending_req->se_cmd, 0); |
628 | return; | 618 | return; |
619 | |||
629 | err: | 620 | err: |
630 | if (tmr) | ||
631 | kfree(tmr); | ||
632 | scsiback_do_resp_with_sense(NULL, err, 0, pending_req); | 621 | scsiback_do_resp_with_sense(NULL, err, 0, pending_req); |
633 | } | 622 | } |
634 | 623 | ||
@@ -1389,12 +1378,6 @@ static int scsiback_check_stop_free(struct se_cmd *se_cmd) | |||
1389 | static void scsiback_release_cmd(struct se_cmd *se_cmd) | 1378 | static void scsiback_release_cmd(struct se_cmd *se_cmd) |
1390 | { | 1379 | { |
1391 | struct se_session *se_sess = se_cmd->se_sess; | 1380 | struct se_session *se_sess = se_cmd->se_sess; |
1392 | struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; | ||
1393 | |||
1394 | if (se_tmr && se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) { | ||
1395 | struct scsiback_tmr *tmr = se_tmr->fabric_tmr_ptr; | ||
1396 | kfree(tmr); | ||
1397 | } | ||
1398 | 1381 | ||
1399 | percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); | 1382 | percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); |
1400 | } | 1383 | } |
@@ -1455,11 +1438,10 @@ static int scsiback_queue_status(struct se_cmd *se_cmd) | |||
1455 | 1438 | ||
1456 | static void scsiback_queue_tm_rsp(struct se_cmd *se_cmd) | 1439 | static void scsiback_queue_tm_rsp(struct se_cmd *se_cmd) |
1457 | { | 1440 | { |
1458 | struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; | 1441 | struct vscsibk_pend *pending_req = container_of(se_cmd, |
1459 | struct scsiback_tmr *tmr = se_tmr->fabric_tmr_ptr; | 1442 | struct vscsibk_pend, se_cmd); |
1460 | 1443 | ||
1461 | atomic_set(&tmr->tmr_complete, 1); | 1444 | complete(&pending_req->tmr_done); |
1462 | wake_up(&tmr->tmr_wait); | ||
1463 | } | 1445 | } |
1464 | 1446 | ||
1465 | static void scsiback_aborted_task(struct se_cmd *se_cmd) | 1447 | static void scsiback_aborted_task(struct se_cmd *se_cmd) |