On Thu, Jul 16, 2020 at 02:33:11PM -0600, Logan Gunthorpe wrote:
> The host driver should decide whether to use SGLs or PRPs and they
> currently assume the flags are cleared after the call to
> nvme_setup_cmd(). However, passed-through commands may erroneously
> set these bits; so clear them for all cases.
> 
> Signed-off-by: Logan Gunthorpe <[email protected]>
> Reviewed-by: Sagi Grimberg <[email protected]>
> ---
>  drivers/nvme/host/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f49085bcaa42..63a59186e68b 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -759,6 +759,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct 
> request *req,
>       case REQ_OP_DRV_IN:
>       case REQ_OP_DRV_OUT:
>               memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd));
> +             /* passthru commands should let the driver set the SGL flags */
> +             cmd->common.flags &= ~NVME_CMD_SGL_ALL;
>               break;

This probably wants to be split into a little helper like the
other cases.

Reply via email to