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);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to