Skip to contentSkip to conversation

target: Simplify transport_generic_free_cmd() (2/2)

PATCH New Bart Van Assche 1 participant 1 message Dec 13, 2017 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 9/11 target: Simplify transport_generic_free_cmd() (2/2)

Since target_wait_free_cmd() skips TMFs with no associated LUN, it is safe to call that function for such commands. Use this to simplify transport_generic_free_cmd(). The only functional change in this patch is that CMD_T_FABRIC_STOP gets set for TMFs with no associated LUN by transport_generic_free_cmd().

Cc Nicholas Bellinger <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Mike Christie <[email protected]>
---
 drivers/target/target_core_transport.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/target/target_core_transport.c +4 -6
index 6beab4b89414..7bf2248e9664 100644
@@ -2634,12 +2634,10 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 	int ret = 0;
 	bool aborted = false, tas = false;
 
-	if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) {
-		if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
-			target_wait_free_cmd(cmd, &aborted, &tas);
-	} else {
-		if (wait_for_tasks)
-			target_wait_free_cmd(cmd, &aborted, &tas);
+	if (wait_for_tasks)
+		target_wait_free_cmd(cmd, &aborted, &tas);
+
+	if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) {
 		/*
 		 * Handle WRITE failure case where transport_generic_new_cmd()
 		 * has already added se_cmd to state_list, but fabric has
Signature · 1 line
2.15.1