Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev dk_start(): retry device-dependent start() routine l...



details:   https://anonhg.NetBSD.org/src/rev/86ba77f2093b
branches:  trunk
changeset: 1020533:86ba77f2093b
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Apr 15 00:32:50 2021 +0000

description:
dk_start(): retry device-dependent start() routine later, also when it
returns ENOMEM in addition to EAGAIN.

Device-dependent start() routine may allocate buffer directly, or via
bus_dma(9) API (some implementations for bus_dma(9) like alpha allocate
memory internally).

If these attempts fail with ENOMEM, this is not a disk error, therefore
we must retry later, as already done for EAGAIN.

diffstat:

 sys/dev/dksubr.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 7173eecc1656 -r 86ba77f2093b sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Thu Apr 15 00:19:52 2021 +0000
+++ b/sys/dev/dksubr.c  Thu Apr 15 00:32:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.112 2020/03/01 03:21:54 riastradh Exp $ */
+/* $NetBSD: dksubr.c,v 1.113 2021/04/15 00:32:50 rin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.112 2020/03/01 03:21:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.113 2021/04/15 00:32:50 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -428,7 +428,10 @@
                        mutex_exit(&dksc->sc_iolock);
                        error = dkd->d_diskstart(dksc->sc_dev, bp);
                        mutex_enter(&dksc->sc_iolock);
-                       if (error == EAGAIN) {
+                       if (error == EAGAIN || error == ENOMEM) {
+                               /*
+                                * Not a disk error. Retry later.
+                                */
                                KASSERT(dksc->sc_deferred == NULL);
                                dksc->sc_deferred = bp;
                                disk_unbusy(&dksc->sc_dkdev, 0, (bp->b_flags & B_READ));



Home | Main Index | Thread Index | Old Index