Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2019 17:10:46 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351704 - head/sys/dev/nvme
Message-ID:  <201909021710.x82HAkTe095242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Sep  2 17:10:46 2019
New Revision: 351704
URL: https://svnweb.freebsd.org/changeset/base/351704

Log:
  Add a brief comment explaining why we can return ETIMEDOUT from the call to the
  polled interface. Normally this would have the potential to corrupt stack memory
  because the completion routines would run after we return. In this case,
  however, we're doing a dump so it's safe for reasons explained in the comment.

Modified:
  head/sys/dev/nvme/nvme_ns_cmd.c

Modified: head/sys/dev/nvme/nvme_ns_cmd.c
==============================================================================
--- head/sys/dev/nvme/nvme_ns_cmd.c	Mon Sep  2 16:57:42 2019	(r351703)
+++ head/sys/dev/nvme/nvme_ns_cmd.c	Mon Sep  2 17:10:46 2019	(r351704)
@@ -191,6 +191,14 @@ nvme_ns_dump(struct nvme_namespace *ns, void *virt, of
 		nvme_qpair_process_completions(req->qpair);
 	}
 
+	/*
+	 * Normally, when using the polling interface, we can't return a
+	 * timeout error because we don't know when the completion routines
+	 * will be called if the command later completes. However, in this
+	 * case we're running a system dump, so all interrupts are turned
+	 * off, the scheduler isn't running so there's nothing to complete
+	 * the transaction.
+	 */
 	if (status.done == FALSE)
 		return (ETIMEDOUT);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909021710.x82HAkTe095242>