On 6.2.2017 14:27, Kashyap Desai wrote:
>>> /**
>>> + * megasas_complete_r1_command -
>>> + * completes R1 FP write commands which has valid peer smid
>>> + * @instance: Adapter soft state
>>> + * @cmd_fusion: MPT command frame
>>> + *
>>> + */
>>> +static inline void
>>> +megasas_complete_r1_command(struct megasas_instance *instance,
>>> + struct megasas_cmd_fusion *cmd) {
>>> + u8 *sense, status, ex_status;
>>> + u32 data_length;
>>> + u16 peer_smid;
>>> + struct fusion_context *fusion;
>>> + struct megasas_cmd_fusion *r1_cmd = NULL;
>>> + struct scsi_cmnd *scmd_local = NULL;
>>> + struct RAID_CONTEXT_G35 *rctx_g35;
>>> +
>>> + rctx_g35 = &cmd->io_request->RaidContext.raid_context_g35;
>>> + fusion = instance->ctrl_context;
>>> + peer_smid = le16_to_cpu(rctx_g35->smid.peer_smid);
>>> +
>>> + r1_cmd = fusion->cmd_list[peer_smid - 1];
>>> + scmd_local = cmd->scmd;
>>> + status = rctx_g35->status;
>>> + ex_status = rctx_g35->ex_status;
>>> + data_length = cmd->io_request->DataLength;
>>> + sense = cmd->sense;
>>> +
>>> + cmd->cmd_completed = true;
>>> +
>>> + /* Check if peer command is completed or not*/
>>> + if (r1_cmd->cmd_completed) {
>>> + if (rctx_g35->status != MFI_STAT_OK) {
>>> + status = rctx_g35->status;
>>> + ex_status = rctx_g35->ex_status;
>> Both status + ex_status were already set to the same value, why is it
>> repeated here ?
> Tomas, This need a fix. Raid context should be switch to r1_cmd, but it
> that is not done here.
> We want if r1 cmd is completed with failure, check status and extended
> status from r1_cmd to send final status to mid layer.
>
> We will fix this and resend patch. It will be like this -
>
> if (r1_cmd->cmd_completed) {
> rctx_g35 =
> &r1_cmd->io_request->RaidContext.raid_context_g35; << -This line
> should be added.
> if (rctx_g35->status != MFI_STAT_OK) {
> status = rctx_g35->status;
> ex_status = rctx_g35->ex_status;
That makes sense, thanks.
>
> Thanks, Kashyap
>
>> Tomas
>>