Source-Changes-HG archive

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

[src/trunk]: src/sys Fix the build that was broken by struct lwp *updateproc ...



details:   https://anonhg.NetBSD.org/src/rev/b9ce86c61f12
branches:  trunk
changeset: 769778:b9ce86c61f12
user:      manu <manu%NetBSD.org@localhost>
date:      Fri Sep 23 01:57:32 2011 +0000

description:
Fix the build that was broken by struct lwp *updateproc reference in
RUMP-visible code. Instead of checking that updateproc (aka ioflush,
aka syncer) will not sleep in PUFFS code, I check for any kernel thread:
after all none of them are designed to hang awaiting for a remote filesystem
operation to complete.

diffstat:

 sys/fs/puffs/puffs_vnops.c    |  16 +++++++---------
 sys/miscfs/syncfs/sync_subr.c |   8 ++------
 2 files changed, 9 insertions(+), 15 deletions(-)

diffs (88 lines):

diff -r c4be615c0d0a -r b9ce86c61f12 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Fri Sep 23 00:03:29 2011 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Fri Sep 23 01:57:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.156 2011/09/21 15:36:33 manu Exp $   */
+/*     $NetBSD: puffs_vnops.c,v 1.157 2011/09/23 01:57:32 manu Exp $   */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.156 2011/09/21 15:36:33 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.157 2011/09/23 01:57:32 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -50,8 +50,6 @@
 #include <miscfs/genfs/genfs.h>
 #include <miscfs/specfs/specdev.h>
 
-extern struct lwp *updateproc;
-
 int    puffs_vnop_lookup(void *);
 int    puffs_vnop_create(void *);
 int    puffs_vnop_access(void *);
@@ -1360,11 +1358,11 @@
        int error, dofaf;
 
        /*
-        * Make sure ioflush does not get stuck in low
-        * memory conditions: it should not wait for the
-        * mutex.
+        * Make sure kernel threads such as ioflush do not get 
+        * stuck in low memory conditions: they should not wait 
+        * for the mutex.
         */
-       if (curlwp == updateproc)
+       if (curlwp->l_flag & LW_SYSTEM)
                KASSERT((ap->a_flags & FSYNC_WAIT) == 0);
 
        if (ap->a_flags & FSYNC_WAIT) {
@@ -2281,7 +2279,7 @@
        /* allocate transport structure */
        tomove = PUFFS_TOMOVE(bp->b_bcount, pmp);
        argsize = sizeof(struct puffs_vnmsg_rw);
-       cansleep = (dofaf || (curlwp == updateproc)) ? 0 : 1; 
+       cansleep = (dofaf || (curlwp->l_flag & LW_SYSTEM)) ? 0 : 1; 
        error = puffs_msgmem_alloc(argsize + tomove, &park_rw,
            (void *)&rw_msg, cansleep);
        if (error)
diff -r c4be615c0d0a -r b9ce86c61f12 sys/miscfs/syncfs/sync_subr.c
--- a/sys/miscfs/syncfs/sync_subr.c     Fri Sep 23 00:03:29 2011 +0000
+++ b/sys/miscfs/syncfs/sync_subr.c     Fri Sep 23 01:57:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sync_subr.c,v 1.46 2011/09/22 21:58:07 christos Exp $  */
+/*     $NetBSD: sync_subr.c,v 1.47 2011/09/23 01:57:32 manu Exp $      */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.46 2011/09/22 21:58:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sync_subr.c,v 1.47 2011/09/23 01:57:32 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -129,8 +129,6 @@
 static long            syncer_last;
 static synclist_t *    syncer_workitem_pending;
 
-struct lwp *           updateproc;
-
 void
 vn_initialize_syncerd(void)
 {
@@ -222,8 +220,6 @@
        time_t starttime;
        bool synced;
 
-       updateproc = curlwp;
-
        for (;;) {
                mutex_enter(&syncer_mutex);
                mutex_enter(&syncer_data_lock);



Home | Main Index | Thread Index | Old Index