nvme: do not log errors for user commands
RFC 1/1 nvme: do not log errors for user commands
User space might issue commands which fail. Currently this gets logged and irretates users.
libnvme's nvme_scan_topology function is using Namespace Identification Descriptor list (CNS Value 0x03) for discovering. It handles the case where it fails but the kernel logs this as error:
nvme0: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) DNR
nvme1: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) DNR
Thus filter out error logs for user commands.
---
Only compile tested, just wanted to ask if this approach would be acceptable?
drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
@@ -325,6 +325,9 @@ static void nvme_log_error(struct request *req)return ; } +if (nr->flags &NVME_REQ_USERCMD ) +return ; + pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s\n", dev_name(nr->ctrl->device), nvme_get_admin_opcode_str(nr->cmd->common.opcode),
Signature · 1 line
2.37.3
Keith Busch
maintainerdrivers/nvme/host/core.c static void nvme_log_error(struct request *req) · line 330
Quoted 7 lines · Daniel Wagner
drivers/nvme/host/core.c +3
-0@@ -325,6 +325,9 @@ static void nvme_log_error(struct request *req)return ; } +if (nr->flags &NVME_REQ_USERCMD ) +return ; +
It would be more consistent with existing usage to set RQF_QUIET in the request's rq_flags before dispatching if we wanted to suppress user space admin command errors. If we did that, though, there are no more admin queue users for the verbose logging since internally generated commands already set RQF_QUIET.
Quoted 5 lines · Keith Busch
Quoted 4 lines · Daniel Wagner
(quoted diff) +0
-0@@ -325,6 +325,9 @@ static void nvme_log_error(struct request *req) return; }
Quoted 8 lines
drivers/nvme/host/core.c static void nvme_log_error(struct request *req) · line 330
Quoted 3 lines
drivers/nvme/host/core.c +3
-0+if (nr->flags &NVME_REQ_USERCMD ) +return ; +It would be more consistent with existing usage to set
RQF_QUIETin the request'srq_flagsbefore dispatching if we wanted to suppress user space admin command errors. If we did that, though, there are no more admin queue users for the verbose logging since internally generated commands already setRQF_QUIET.
I've tried to find a way how we could pass a quiet flag from user land. I don't see how to add this flag on the existing IOCTL APIs except by adding a new IOCTL like NVME_IOCTL_SET_CONFIG or so.
In my books this new logging infrastructure bd83fe6f2cd2 ("nvme: add verbose error logging") is causing a regression. Thus I would like to suggest we add the RQF_QUIET flag to the admin passthrough commands as well and let those who are interested in the additional logging figuring out a solution.