[PATCH] nvme: quiet user passthrough command errors

Alan Adamson alan.adamson at oracle.com
Wed Oct 26 14:27:42 PDT 2022



> On Oct 26, 2022, at 10:07 AM, Keith Busch <kbusch at meta.com> wrote:
> 
> From: Keith Busch <kbusch at kernel.org>
> 
> The driver is spamming the kernel logs for entirely harmless errors from
> user space submitting unsupported commmands. Just silence the errors.
> The application has direct access to command status, so there's no need
> to log these.
> 
> Cc: Daniel Wagner <dwagner at suse.de>
> Cc: Alan Adamson <alan.adamson at oracle.com>
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
> drivers/nvme/host/core.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 686c55cb5d1a..da874172a31d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
> 	struct nvme_ns *ns = rq->q->queuedata;
> 
> 	*effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
> +	rq->rq_flags |= RQF_QUIET;
> 	return nvme_execute_rq(rq, false);
> }
> EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU);
> -- 
> 2.30.2
> 

Signed-off-by: Alan Adamson <alan.adamson at oracle.com>

I tested the change with blktests which uses user passthrough:

Before patch:
[   69.041515] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unrecovered Read Error (sct 0x2 / sc 0x81) DNR
[   69.041557] critical medium error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   69.055721] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
[   69.055754] I/O error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   69.067335] nvme0n1: Write(0x1) @ LBA 0, 1 blocks, Write Fault (sct 0x2 / sc 0x80) DNR
[   69.067385] critical medium error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg 1 prio class 2
[   69.085449] nvme0: Identify(0x6), Access Denied (sct 0x2 / sc 0x86) DNR
[   69.103265] nvme0: Unknown(0x96), Invalid Command Opcode (sct 0x0 / sc 0x1) DNR

After patch:
[  167.375311] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unrecovered Read Error (sct 0x2 / sc 0x81) DNR
[  167.375362] critical medium error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[  167.388812] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
[  167.388839] I/O error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[  167.399907] nvme0n1: Write(0x1) @ LBA 0, 1 blocks, Write Fault (sct 0x2 / sc 0x80) DNR
[  167.399928] critical medium error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg 1 prio class 2


The messages that are due to passthrough are no longer present as expcted.

Tested-by: Alan Adamson <alan.adamson at oracle.com>


blktests will need to updated, specifically blktests/tests/nvme/039.out.

Alan






More information about the Linux-nvme mailing list