On Sun, 2014-02-16 at 19:38 +0200, Sagi Grimberg wrote:
> In case protection information is involved, allocate
> protection SG-list for transport.
> 
> Signed-off-by: Sagi Grimberg <[email protected]>
> ---
>  drivers/target/target_core_transport.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/target/target_core_transport.c 
> b/drivers/target/target_core_transport.c
> index 24b4f65..f029bb7 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -2036,6 +2036,10 @@ static inline void transport_free_pages(struct se_cmd 
> *cmd)
>       transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
>       cmd->t_bidi_data_sg = NULL;
>       cmd->t_bidi_data_nents = 0;
> +
> +     transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
> +     cmd->t_prot_sg = NULL;
> +     cmd->t_prot_nents = 0;
>  }
>  
>  /**
> @@ -2199,6 +2203,14 @@ transport_generic_new_cmd(struct se_cmd *cmd)
>                               return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
>               }
>  
> +             if (cmd->prot_type != TARGET_PROT_NORMAL) {
> +                     ret = target_alloc_sgl(&cmd->t_prot_sg,
> +                                            &cmd->t_prot_nents,
> +                                            cmd->prot_length, zero_flag);
> +                     if (ret < 0)
> +                             return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> +             }
> +
>               ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
>                                      cmd->data_length, zero_flag);
>               if (ret < 0)

So the 'zero_flag' for the t_prot_sg allocation should always be true to
avoid garbage in the app-tag field..

--nab

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to