提交 2bf5d3bb 编写于 作者: L Logan Gunthorpe 提交者: Christoph Hellwig

nvme: clear any SGL flags in passthru commands

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: NLogan Gunthorpe <logang@deltatee.com>
Reviewed-by: NKeith Busch <kbusch@kernel.org>
Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 ece0278c
...@@ -604,6 +604,14 @@ static void nvme_assign_write_stream(struct nvme_ctrl *ctrl, ...@@ -604,6 +604,14 @@ static void nvme_assign_write_stream(struct nvme_ctrl *ctrl,
req->q->write_hints[streamid] += blk_rq_bytes(req) >> 9; req->q->write_hints[streamid] += blk_rq_bytes(req) >> 9;
} }
static void nvme_setup_passthrough(struct request *req,
struct nvme_command *cmd)
{
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;
}
static inline void nvme_setup_flush(struct nvme_ns *ns, static inline void nvme_setup_flush(struct nvme_ns *ns,
struct nvme_command *cmnd) struct nvme_command *cmnd)
{ {
...@@ -769,7 +777,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, ...@@ -769,7 +777,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
switch (req_op(req)) { switch (req_op(req)) {
case REQ_OP_DRV_IN: case REQ_OP_DRV_IN:
case REQ_OP_DRV_OUT: case REQ_OP_DRV_OUT:
memcpy(cmd, nvme_req(req)->cmd, sizeof(*cmd)); nvme_setup_passthrough(req, cmd);
break; break;
case REQ_OP_FLUSH: case REQ_OP_FLUSH:
nvme_setup_flush(ns, cmd); nvme_setup_flush(ns, cmd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册