git: 5cdedf676d03 - main - nvme: Log reset success or failure to devd

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 07 Mar 2024 01:39:15 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5cdedf676d0300966b0dbed073d0f34c59282e03

commit 5cdedf676d0300966b0dbed073d0f34c59282e03
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-03-07 01:22:34 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-03-07 01:38:59 +0000

    nvme: Log reset success or failure to devd
    
    We're logging when we start a reset, but not when we complete it, nor
    the result. Create now log a success or timed_out event for the reset.
    Currently, the only detectable error we have from reset is 'failure to
    become ready in time,' though the code looks like it might be more
    generic. Log this and if we ever have other failure modes, change the
    logging to devd when that happens.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D44211
---
 sys/dev/nvme/nvme_ctrlr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 609794edbf67..ca26ca8e92d8 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1179,10 +1179,13 @@ nvme_ctrlr_reset_task(void *arg, int pending)
 
 	nvme_ctrlr_devctl_log(ctrlr, "RESET", "event=\"start\"");
 	status = nvme_ctrlr_hw_reset(ctrlr);
-	if (status == 0)
+	if (status == 0) {
+		nvme_ctrlr_devctl_log(ctrlr, "RESET", "event=\"success\"");
 		nvme_ctrlr_start(ctrlr, true);
-	else
+	} else {
+		nvme_ctrlr_devctl_log(ctrlr, "RESET", "event=\"timed_out\"");
 		nvme_ctrlr_fail(ctrlr);
+	}
 
 	atomic_cmpset_32(&ctrlr->is_resetting, 1, 0);
 }