Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286526
b: refs/heads/master
c: 4355a91
h: refs/heads/master
v: v3
  • Loading branch information
Nicholas Bellinger committed Dec 14, 2011
1 parent 14bdf87 commit 3d8b35b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a63607855224702ea17e6016ecf3f7d544e83625
refs/heads/master: 4355a9110eeb2eaf1dd44fcab16ccbd1c8c5fad4
51 changes: 13 additions & 38 deletions trunk/drivers/target/tcm_fc/tfc_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ static void ft_send_tm(struct ft_cmd *cmd)
struct ft_sess *sess;
u8 tm_func;

transport_init_se_cmd(&cmd->se_cmd, &ft_configfs->tf_ops,
cmd->sess->se_sess, 0, DMA_NONE, 0,
&cmd->ft_sense_buffer[0]);
target_get_sess_cmd(cmd->sess->se_sess, &cmd->se_cmd, false);

fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp));

switch (fcp->fc_tm_flags) {
Expand Down Expand Up @@ -416,7 +421,6 @@ static void ft_send_tm(struct ft_cmd *cmd)
sess = cmd->sess;
transport_send_check_condition_and_sense(&cmd->se_cmd,
cmd->se_cmd.scsi_sense_reason, 0);
transport_generic_free_cmd(&cmd->se_cmd, 0);
ft_sess_put(sess);
return;
}
Expand Down Expand Up @@ -532,7 +536,6 @@ static void ft_send_work(struct work_struct *work)
{
struct ft_cmd *cmd = container_of(work, struct ft_cmd, work);
struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame);
struct se_cmd *se_cmd;
struct fcp_cmnd *fcp;
int data_dir = 0;
u32 data_len;
Expand Down Expand Up @@ -587,55 +590,27 @@ static void ft_send_work(struct work_struct *work)
data_len = ntohl(fcp->fc_dl);
cmd->cdb = fcp->fc_cdb;
}

se_cmd = &cmd->se_cmd;
/*
* Initialize struct se_cmd descriptor from target_core_mod
* infrastructure
*/
transport_init_se_cmd(se_cmd, &ft_configfs->tf_ops, cmd->sess->se_sess,
data_len, data_dir, task_attr,
&cmd->ft_sense_buffer[0]);
/*
* Check for FCP task management flags
*/
if (fcp->fc_tm_flags) {
ft_send_tm(cmd);
return;
}

fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd);

cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun);
ret = transport_lookup_cmd_lun(&cmd->se_cmd, cmd->lun);
/*
* Use a single se_cmd->cmd_kref as we expect to release se_cmd
* directly from ft_check_stop_free callback in response path.
*/
ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb,
&cmd->ft_sense_buffer[0], cmd->lun, data_len,
task_attr, data_dir, 0);
pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret);
if (ret < 0) {
ft_dump_cmd(cmd, __func__);
transport_send_check_condition_and_sense(&cmd->se_cmd,
cmd->se_cmd.scsi_sense_reason, 0);
return;
}

ret = transport_generic_allocate_tasks(se_cmd, cmd->cdb);

pr_debug("r_ctl %x alloc task ret %d\n", fh->fh_r_ctl, ret);
ft_dump_cmd(cmd, __func__);

if (ret == -ENOMEM) {
transport_send_check_condition_and_sense(se_cmd,
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
transport_generic_free_cmd(se_cmd, 0);
return;
}
if (ret == -EINVAL) {
if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
ft_queue_status(se_cmd);
else
transport_send_check_condition_and_sense(se_cmd,
se_cmd->scsi_sense_reason, 0);
transport_generic_free_cmd(se_cmd, 0);
return;
}
transport_handle_cdb_direct(se_cmd);
return;

err:
Expand Down

0 comments on commit 3d8b35b

Please sign in to comment.