Index: sys/dev/nvme/nvme_qpair.c =================================================================== --- sys/dev/nvme/nvme_qpair.c +++ sys/dev/nvme/nvme_qpair.c @@ -513,7 +513,17 @@ "cpl does not map to outstanding cmd\n"); /* nvme_dump_completion expects device endianess */ nvme_dump_completion(&qpair->cpl[qpair->cq_head]); - KASSERT(0, ("received completion for unknown cmd\n")); + /* + * If we're panicing, or we've stopped the sceudler just + * before we panic, don't assert consistency. We can + * arbitrarily interrupt other threads on panic, leading + * the qpair structure in an inconsistent state when we + * poll to complete the dumping I/O. This inconsistency is + * detected by the KASSERT bogusly, preventing a dump + * from completing while in this state. + */ + if (!(dumping || SCHEDULER_STOPPED())) + KASSERT(0, ("received completion for unknown cmd\n")); } if (++qpair->cq_head == qpair->num_entries) {