Source-Changes-HG archive

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

[src/trunk]: src/sys/kern pool_grow can now fail even when sleeping is ok. Ca...



details:   https://anonhg.NetBSD.org/src/rev/a1251544ff92
branches:  trunk
changeset: 827610:a1251544ff92
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Nov 05 07:49:45 2017 +0000

description:
pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.

diffstat:

 sys/kern/subr_pool.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 922c6757b8c7 -r a1251544ff92 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Sun Nov 05 07:03:37 2017 +0000
+++ b/sys/kern/subr_pool.c      Sun Nov 05 07:49:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.209 2017/10/28 17:06:43 riastradh Exp $        */
+/*     $NetBSD: subr_pool.c,v 1.210 2017/11/05 07:49:45 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.209 2017/10/28 17:06:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.210 2017/11/05 07:49:45 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -830,6 +830,14 @@
                error = pool_grow(pp, flags);
                if (error != 0) {
                        /*
+                        * pool_grow aborts when another thread
+                        * is allocating a new page. Retry if it
+                        * waited for it.
+                        */
+                       if (error == ERESTART)
+                               goto startover;
+
+                       /*
                         * We were unable to allocate a page or item
                         * header, but we released the lock during
                         * allocation, so perhaps items were freed



Home | Main Index | Thread Index | Old Index