Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262346
b: refs/heads/master
c: dd8ae59
h: refs/heads/master
v: v3
  • Loading branch information
Nicholas Bellinger committed Jul 30, 2011
1 parent dfd9cb0 commit dc68d2c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 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: d52a10d003694e48d28cf0218db16372ed61f1bd
refs/heads/master: dd8ae59d48790d5c25f47ebbe502c8ca379fdde0
31 changes: 29 additions & 2 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,13 +1747,17 @@ int transport_generic_handle_cdb(
}
EXPORT_SYMBOL(transport_generic_handle_cdb);

static void transport_generic_request_failure(struct se_cmd *,
struct se_device *, int, int);
/*
* Used by fabric module frontends to queue tasks directly.
* Many only be used from process context only
*/
int transport_handle_cdb_direct(
struct se_cmd *cmd)
{
int ret;

if (!cmd->se_lun) {
dump_stack();
pr_err("cmd->se_lun is NULL\n");
Expand All @@ -1765,8 +1769,31 @@ int transport_handle_cdb_direct(
" from interrupt context\n");
return -EINVAL;
}

return transport_generic_new_cmd(cmd);
/*
* Set TRANSPORT_NEW_CMD state and cmd->t_transport_active=1 following
* transport_generic_handle_cdb*() -> transport_add_cmd_to_queue()
* in existing usage to ensure that outstanding descriptors are handled
* correctly during shutdown via transport_generic_wait_for_tasks()
*
* Also, we don't take cmd->t_state_lock here as we only expect
* this to be called for initial descriptor submission.
*/
cmd->t_state = TRANSPORT_NEW_CMD;
atomic_set(&cmd->t_transport_active, 1);
/*
* transport_generic_new_cmd() is already handling QUEUE_FULL,
* so follow TRANSPORT_NEW_CMD processing thread context usage
* and call transport_generic_request_failure() if necessary..
*/
ret = transport_generic_new_cmd(cmd);
if (ret == -EAGAIN)
return 0;
else if (ret < 0) {
cmd->transport_error_status = ret;
transport_generic_request_failure(cmd, NULL, 0,
(cmd->data_direction != DMA_TO_DEVICE));
}
return 0;
}
EXPORT_SYMBOL(transport_handle_cdb_direct);

Expand Down

0 comments on commit dc68d2c

Please sign in to comment.