Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376517
b: refs/heads/master
c: d5ddad4
h: refs/heads/master
i:
  376515: c217358
v: v3
  • Loading branch information
Nicholas Bellinger committed May 31, 2013
1 parent 1972c08 commit 88e39cd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 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: cea4dcfdad926a27a18e188720efe0f2c9403456
refs/heads/master: d5ddad4168348337d98d6b8f156a3892de444411
28 changes: 15 additions & 13 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd);
static void transport_handle_queue_full(struct se_cmd *cmd,
struct se_device *dev);
static int transport_generic_get_mem(struct se_cmd *cmd);
static void transport_put_cmd(struct se_cmd *cmd);
static int transport_put_cmd(struct se_cmd *cmd);
static void target_complete_ok_work(struct work_struct *work);

int init_se_kmem_caches(void)
Expand Down Expand Up @@ -1944,7 +1944,7 @@ static inline void transport_free_pages(struct se_cmd *cmd)
* This routine unconditionally frees a command, and reference counting
* or list removal must be done in the caller.
*/
static void transport_release_cmd(struct se_cmd *cmd)
static int transport_release_cmd(struct se_cmd *cmd)
{
BUG_ON(!cmd->se_tfo);

Expand All @@ -1956,11 +1956,11 @@ static void transport_release_cmd(struct se_cmd *cmd)
* If this cmd has been setup with target_get_sess_cmd(), drop
* the kref and call ->release_cmd() in kref callback.
*/
if (cmd->check_release != 0) {
target_put_sess_cmd(cmd->se_sess, cmd);
return;
}
if (cmd->check_release != 0)
return target_put_sess_cmd(cmd->se_sess, cmd);

cmd->se_tfo->release_cmd(cmd);
return 1;
}

/**
Expand All @@ -1969,15 +1969,15 @@ static void transport_release_cmd(struct se_cmd *cmd)
*
* This routine releases our reference to the command and frees it if possible.
*/
static void transport_put_cmd(struct se_cmd *cmd)
static int transport_put_cmd(struct se_cmd *cmd)
{
unsigned long flags;

spin_lock_irqsave(&cmd->t_state_lock, flags);
if (atomic_read(&cmd->t_fe_count) &&
!atomic_dec_and_test(&cmd->t_fe_count)) {
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
return;
return 0;
}

if (cmd->transport_state & CMD_T_DEV_ACTIVE) {
Expand All @@ -1987,8 +1987,7 @@ static void transport_put_cmd(struct se_cmd *cmd)
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

transport_free_pages(cmd);
transport_release_cmd(cmd);
return;
return transport_release_cmd(cmd);
}

void *transport_kmap_data_sg(struct se_cmd *cmd)
Expand Down Expand Up @@ -2153,22 +2152,25 @@ static void transport_write_pending_qf(struct se_cmd *cmd)
}
}

void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
{
int ret = 0;

if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) {
if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
transport_wait_for_tasks(cmd);

transport_release_cmd(cmd);
ret = transport_release_cmd(cmd);
} else {
if (wait_for_tasks)
transport_wait_for_tasks(cmd);

if (cmd->se_lun)
transport_lun_remove_cmd(cmd);

transport_put_cmd(cmd);
ret = transport_put_cmd(cmd);
}
return ret;
}
EXPORT_SYMBOL(transport_generic_free_cmd);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/target/target_core_fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ sense_reason_t transport_generic_new_cmd(struct se_cmd *);

void target_execute_cmd(struct se_cmd *cmd);

void transport_generic_free_cmd(struct se_cmd *, int);
int transport_generic_free_cmd(struct se_cmd *, int);

bool transport_wait_for_tasks(struct se_cmd *);
int transport_check_aborted_status(struct se_cmd *, int);
Expand Down

0 comments on commit 88e39cd

Please sign in to comment.