History

target/user: Fix UFLAG_UNKNOWN_OP handling

Calling transport_generic_request_failure() from here causes list corruption. We should be using target_complete_cmd() instead. Which we do in all other cases, so the UNKNOWN_OP case can become just another member of the big else/if chain in tcmu_handle_completion().

Andy Grover committed 11 years ago

Commit ed97d0c1 parent 06b967e1 file · +2 −8Browse files

Unified · Split

drivers/target/target_core_user.c+2−8
@@ -538,14 +538,8 @@ static void tcmu_handle_completion(struct tcmu_cmd *cmd, struct tcmu_cmd_entry * · 537 unmodified lines
538538 UPDATE_HEAD(udev->data_tail, cmd->data_length, udev->data_size);
539539 pr_warn("TCMU: Userspace set UNKNOWN_OP flag on se_cmd %p\n",
540540 cmd->se_cmd);
541− transport_generic_request_failure(cmd->se_cmd,
542− TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE);
543− cmd->se_cmd = NULL;
544− kmem_cache_free(tcmu_cmd_cache, cmd);
545− return;
546− }
547−
548− if (entry->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
541+ entry->rsp.scsi_status = SAM_STAT_CHECK_CONDITION;
542+ } else if (entry->rsp.scsi_status == SAM_STAT_CHECK_CONDITION) {
549543 memcpy(se_cmd->sense_buffer, entry->rsp.sense_buffer,
550544 se_cmd->scsi_sense_length);
551545