Skip to content

Commit c1c35d5

Browse files
author
Nicholas Bellinger
committed
target: Remove legacy t_fe_count + avoid t_state_lock access in transport_put_cmd
This patch removes legacy se_cmd->t_fe_count usage in order to avoid se_cmd->t_state_lock access within transport_put_cmd() during normal fast path se_cmd descriptor release. Also drop the left-over parameter usage within core_tmr_handle_tas_abort() Cc: Christoph Hellwig <hch@lst.de> Cc: Roland Dreier <roland@kernel.org> Cc: Kent Overstreet <koverstreet@google.com> Cc: Or Gerlitz <ogerlitz@mellanox.com> Cc: Moussa Ba <moussaba@micron.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 0b66818 commit c1c35d5

3 files changed

Lines changed: 2 additions & 29 deletions

File tree

‎drivers/target/target_core_tmr.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,8 @@ void core_tmr_release_req(
8585
static void core_tmr_handle_tas_abort(
8686
struct se_node_acl *tmr_nacl,
8787
struct se_cmd *cmd,
88-
int tas,
89-
int fe_count)
88+
int tas)
9089
{
91-
if (!fe_count) {
92-
transport_cmd_finish_abort(cmd, 1);
93-
return;
94-
}
9590
/*
9691
* TASK ABORTED status (TAS) bit support
9792
*/
@@ -253,7 +248,6 @@ static void core_tmr_drain_state_list(
253248
LIST_HEAD(drain_task_list);
254249
struct se_cmd *cmd, *next;
255250
unsigned long flags;
256-
int fe_count;
257251

258252
/*
259253
* Complete outstanding commands with TASK_ABORTED SAM status.
@@ -329,12 +323,10 @@ static void core_tmr_drain_state_list(
329323
spin_lock_irqsave(&cmd->t_state_lock, flags);
330324
target_stop_cmd(cmd, &flags);
331325

332-
fe_count = atomic_read(&cmd->t_fe_count);
333-
334326
cmd->transport_state |= CMD_T_ABORTED;
335327
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
336328

337-
core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count);
329+
core_tmr_handle_tas_abort(tmr_nacl, cmd, tas);
338330
}
339331
}
340332

‎drivers/target/target_core_transport.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,21 +1968,6 @@ static int transport_release_cmd(struct se_cmd *cmd)
19681968
*/
19691969
static int transport_put_cmd(struct se_cmd *cmd)
19701970
{
1971-
unsigned long flags;
1972-
1973-
spin_lock_irqsave(&cmd->t_state_lock, flags);
1974-
if (atomic_read(&cmd->t_fe_count) &&
1975-
!atomic_dec_and_test(&cmd->t_fe_count)) {
1976-
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
1977-
return 0;
1978-
}
1979-
1980-
if (cmd->transport_state & CMD_T_DEV_ACTIVE) {
1981-
cmd->transport_state &= ~CMD_T_DEV_ACTIVE;
1982-
target_remove_from_state_list(cmd);
1983-
}
1984-
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
1985-
19861971
transport_free_pages(cmd);
19871972
return transport_release_cmd(cmd);
19881973
}
@@ -2100,9 +2085,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
21002085
if (ret < 0)
21012086
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
21022087
}
2103-
2104-
atomic_inc(&cmd->t_fe_count);
2105-
21062088
/*
21072089
* If this command is not a write we can execute it right here,
21082090
* for write buffers we need to notify the fabric driver first

‎include/target/target_core_base.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ struct se_cmd {
454454
unsigned char *t_task_cdb;
455455
unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
456456
unsigned long long t_task_lba;
457-
atomic_t t_fe_count;
458457
unsigned int transport_state;
459458
#define CMD_T_ABORTED (1 << 0)
460459
#define CMD_T_ACTIVE (1 << 1)

0 commit comments

Comments
 (0)