scsi: target/iscsi: Reduce number of __iscsit_free_cmd() callers
Instead of calling __iscsit_free_cmd() from inside iscsit_aborted_task() if a command has been aborted and from inside iscsit_free_cmd() if a command has not been aborted, call __iscsit_free_cmd() from inside lio_release_cmd(). The latter function is namely called for all commands once the reference count has dropped to zero. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Mike Christie <mchristi@redhat.com> Cc: Varun Prakash <varun@chelsio.com> Cc: Hannes Reinecke <hare@suse.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
7b2cc7dc0d
commit
ed88f05578
|
@ -497,8 +497,6 @@ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
|
||||||
!(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP))
|
!(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP))
|
||||||
list_del_init(&cmd->i_conn_node);
|
list_del_init(&cmd->i_conn_node);
|
||||||
spin_unlock_bh(&conn->cmd_lock);
|
spin_unlock_bh(&conn->cmd_lock);
|
||||||
|
|
||||||
__iscsit_free_cmd(cmd, true);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(iscsit_aborted_task);
|
EXPORT_SYMBOL(iscsit_aborted_task);
|
||||||
|
|
||||||
|
|
|
@ -1546,6 +1546,7 @@ static void lio_release_cmd(struct se_cmd *se_cmd)
|
||||||
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
|
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
|
||||||
|
|
||||||
pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd);
|
pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd);
|
||||||
|
__iscsit_free_cmd(cmd, true);
|
||||||
iscsit_release_cmd(cmd);
|
iscsit_release_cmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -772,10 +772,8 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown)
|
||||||
__iscsit_free_cmd(cmd, shutdown);
|
__iscsit_free_cmd(cmd, shutdown);
|
||||||
if (se_cmd) {
|
if (se_cmd) {
|
||||||
rc = transport_generic_free_cmd(se_cmd, shutdown);
|
rc = transport_generic_free_cmd(se_cmd, shutdown);
|
||||||
if (!rc && shutdown && se_cmd->se_sess) {
|
if (!rc && shutdown && se_cmd->se_sess)
|
||||||
__iscsit_free_cmd(cmd, shutdown);
|
|
||||||
target_put_sess_cmd(se_cmd);
|
target_put_sess_cmd(se_cmd);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
iscsit_release_cmd(cmd);
|
iscsit_release_cmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue