Source-Changes-HG archive

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

[src/trunk]: src/sys/kern drop wl_mtx mutex during call to pool_get() with PR...



details:   https://anonhg.NetBSD.org/src/rev/7a549ded28dd
branches:  trunk
changeset: 348048:7a549ded28dd
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Oct 02 16:52:27 2016 +0000

description:
drop wl_mtx mutex during call to pool_get() with PR_WAITOK

pointed out by riastradh

diffstat:

 sys/kern/vfs_wapbl.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 24e3f2df2b86 -r 7a549ded28dd sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c      Sun Oct 02 16:44:02 2016 +0000
+++ b/sys/kern/vfs_wapbl.c      Sun Oct 02 16:52:27 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $  */
+/*     $NetBSD: vfs_wapbl.c,v 1.84 2016/10/02 16:52:27 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.83 2016/10/02 16:44:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.84 2016/10/02 16:52:27 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -1946,16 +1946,19 @@
        if (__predict_false(wl->wl_dealloccnt >= wl->wl_dealloclim))
                panic("wapbl_register_deallocation: out of resources");
 
+       wl->wl_dealloccnt++;
+       mutex_exit(&wl->wl_mtx);
+
        wd = pool_get(&wapbl_dealloc_pool, PR_WAITOK);
        wd->wd_blkno = blk;
        wd->wd_len = len;
 
+       mutex_enter(&wl->wl_mtx);
        SIMPLEQ_INSERT_TAIL(&wl->wl_dealloclist, wd, wd_entries);
-       wl->wl_dealloccnt++;
+       mutex_exit(&wl->wl_mtx);
 
        WAPBL_PRINTF(WAPBL_PRINT_ALLOC,
            ("wapbl_register_deallocation: blk=%"PRId64" len=%d\n", blk, len));
-       mutex_exit(&wl->wl_mtx);
 }
 
 /****************************************************************/



Home | Main Index | Thread Index | Old Index