diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-18 18:59:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-18 18:59:18 -0500 |
commit | 4ba3069fea9f0771dad3f4906b305ab50d5a1b30 (patch) | |
tree | 3f75f2c0a320a6f38538c5e63f46ef79b0b3f1d1 /drivers/target/tcm_fc/tfc_cmd.c | |
parent | 507a03c1cba0e32309223d23d19a1bfc0916c140 (diff) | |
parent | 895f3022523361e9b383cf48f51feb1f7d5e7e53 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
target: Set additional sense length field in sense data
target: Remove legacy device status check from transport_execute_tasks
target: Remove __transport_execute_tasks() for each processing context
target: Remove extra se_device->execute_task_lock access in fast path
target: Drop se_device TCQ queue_depth usage from I/O path
target: Fix possible NULL pointer with __transport_execute_tasks
target: Remove TFO->check_release_cmd() fabric API caller
tcm_fc: Convert ft_send_work to use target_submit_cmd
target: Add target_submit_cmd() for process context fabric submission
target: Make target_put_sess_cmd use target_release_cmd_kref
target: Set response format in INQUIRY response
target: tcm_mod_builder: small fixups
Documentation/target: Fix tcm_mod_builder.py build breakage
target: remove overagressive ____cacheline_aligned annoations
tcm_loop: bump max_sectors
target/configs: remove trailing newline from udev_path and alias
iscsi-target: fix chap identifier simple_strtoul usage
target: remove useless casts
target: simplify target_check_cdb_and_preempt
target: Move core_scsi3_check_cdb_abort_and_preempt
...
Diffstat (limited to 'drivers/target/tcm_fc/tfc_cmd.c')
-rw-r--r-- | drivers/target/tcm_fc/tfc_cmd.c | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 71fc9cea5dc9..addc18f727ea 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -39,12 +39,8 @@ | |||
39 | #include <scsi/fc_encode.h> | 39 | #include <scsi/fc_encode.h> |
40 | 40 | ||
41 | #include <target/target_core_base.h> | 41 | #include <target/target_core_base.h> |
42 | #include <target/target_core_transport.h> | 42 | #include <target/target_core_fabric.h> |
43 | #include <target/target_core_fabric_ops.h> | ||
44 | #include <target/target_core_device.h> | ||
45 | #include <target/target_core_tpg.h> | ||
46 | #include <target/target_core_configfs.h> | 43 | #include <target/target_core_configfs.h> |
47 | #include <target/target_core_tmr.h> | ||
48 | #include <target/configfs_macros.h> | 44 | #include <target/configfs_macros.h> |
49 | 45 | ||
50 | #include "tcm_fc.h" | 46 | #include "tcm_fc.h" |
@@ -367,6 +363,11 @@ static void ft_send_tm(struct ft_cmd *cmd) | |||
367 | struct ft_sess *sess; | 363 | struct ft_sess *sess; |
368 | u8 tm_func; | 364 | u8 tm_func; |
369 | 365 | ||
366 | transport_init_se_cmd(&cmd->se_cmd, &ft_configfs->tf_ops, | ||
367 | cmd->sess->se_sess, 0, DMA_NONE, 0, | ||
368 | &cmd->ft_sense_buffer[0]); | ||
369 | target_get_sess_cmd(cmd->sess->se_sess, &cmd->se_cmd, false); | ||
370 | |||
370 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); | 371 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); |
371 | 372 | ||
372 | switch (fcp->fc_tm_flags) { | 373 | switch (fcp->fc_tm_flags) { |
@@ -420,7 +421,6 @@ static void ft_send_tm(struct ft_cmd *cmd) | |||
420 | sess = cmd->sess; | 421 | sess = cmd->sess; |
421 | transport_send_check_condition_and_sense(&cmd->se_cmd, | 422 | transport_send_check_condition_and_sense(&cmd->se_cmd, |
422 | cmd->se_cmd.scsi_sense_reason, 0); | 423 | cmd->se_cmd.scsi_sense_reason, 0); |
423 | transport_generic_free_cmd(&cmd->se_cmd, 0); | ||
424 | ft_sess_put(sess); | 424 | ft_sess_put(sess); |
425 | return; | 425 | return; |
426 | } | 426 | } |
@@ -536,7 +536,6 @@ static void ft_send_work(struct work_struct *work) | |||
536 | { | 536 | { |
537 | struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); | 537 | struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); |
538 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); | 538 | struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); |
539 | struct se_cmd *se_cmd; | ||
540 | struct fcp_cmnd *fcp; | 539 | struct fcp_cmnd *fcp; |
541 | int data_dir = 0; | 540 | int data_dir = 0; |
542 | u32 data_len; | 541 | u32 data_len; |
@@ -591,15 +590,6 @@ static void ft_send_work(struct work_struct *work) | |||
591 | data_len = ntohl(fcp->fc_dl); | 590 | data_len = ntohl(fcp->fc_dl); |
592 | cmd->cdb = fcp->fc_cdb; | 591 | cmd->cdb = fcp->fc_cdb; |
593 | } | 592 | } |
594 | |||
595 | se_cmd = &cmd->se_cmd; | ||
596 | /* | ||
597 | * Initialize struct se_cmd descriptor from target_core_mod | ||
598 | * infrastructure | ||
599 | */ | ||
600 | transport_init_se_cmd(se_cmd, &ft_configfs->tf_ops, cmd->sess->se_sess, | ||
601 | data_len, data_dir, task_attr, | ||
602 | &cmd->ft_sense_buffer[0]); | ||
603 | /* | 593 | /* |
604 | * Check for FCP task management flags | 594 | * Check for FCP task management flags |
605 | */ | 595 | */ |
@@ -607,39 +597,20 @@ static void ft_send_work(struct work_struct *work) | |||
607 | ft_send_tm(cmd); | 597 | ft_send_tm(cmd); |
608 | return; | 598 | return; |
609 | } | 599 | } |
610 | |||
611 | fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); | 600 | fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); |
612 | |||
613 | cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); | 601 | cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); |
614 | ret = transport_lookup_cmd_lun(&cmd->se_cmd, cmd->lun); | 602 | /* |
603 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd | ||
604 | * directly from ft_check_stop_free callback in response path. | ||
605 | */ | ||
606 | ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, | ||
607 | &cmd->ft_sense_buffer[0], cmd->lun, data_len, | ||
608 | task_attr, data_dir, 0); | ||
609 | pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret); | ||
615 | if (ret < 0) { | 610 | if (ret < 0) { |
616 | ft_dump_cmd(cmd, __func__); | 611 | ft_dump_cmd(cmd, __func__); |
617 | transport_send_check_condition_and_sense(&cmd->se_cmd, | ||
618 | cmd->se_cmd.scsi_sense_reason, 0); | ||
619 | return; | ||
620 | } | ||
621 | |||
622 | ret = transport_generic_allocate_tasks(se_cmd, cmd->cdb); | ||
623 | |||
624 | pr_debug("r_ctl %x alloc task ret %d\n", fh->fh_r_ctl, ret); | ||
625 | ft_dump_cmd(cmd, __func__); | ||
626 | |||
627 | if (ret == -ENOMEM) { | ||
628 | transport_send_check_condition_and_sense(se_cmd, | ||
629 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); | ||
630 | transport_generic_free_cmd(se_cmd, 0); | ||
631 | return; | ||
632 | } | ||
633 | if (ret == -EINVAL) { | ||
634 | if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) | ||
635 | ft_queue_status(se_cmd); | ||
636 | else | ||
637 | transport_send_check_condition_and_sense(se_cmd, | ||
638 | se_cmd->scsi_sense_reason, 0); | ||
639 | transport_generic_free_cmd(se_cmd, 0); | ||
640 | return; | 612 | return; |
641 | } | 613 | } |
642 | transport_handle_cdb_direct(se_cmd); | ||
643 | return; | 614 | return; |
644 | 615 | ||
645 | err: | 616 | err: |