Module Name:    src
Committed By:   manu
Date:           Fri Sep 23 01:57:32 UTC 2011

Modified Files:
        src/sys/fs/puffs: puffs_vnops.c
        src/sys/miscfs/syncfs: sync_subr.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/miscfs/syncfs/sync_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/puffs/puffs_vnops.c
diff -u src/sys/fs/puffs/puffs_vnops.c:1.156 src/sys/fs/puffs/puffs_vnops.c:1.157
--- src/sys/fs/puffs/puffs_vnops.c:1.156	Wed Sep 21 15:36:33 2011
+++ src/sys/fs/puffs/puffs_vnops.c	Fri Sep 23 01:57:32 2011
@@ -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)

Index: src/sys/miscfs/syncfs/sync_subr.c
diff -u src/sys/miscfs/syncfs/sync_subr.c:1.46 src/sys/miscfs/syncfs/sync_subr.c:1.47
--- src/sys/miscfs/syncfs/sync_subr.c:1.46	Thu Sep 22 21:58:07 2011
+++ src/sys/miscfs/syncfs/sync_subr.c	Fri Sep 23 01:57:32 2011
@@ -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);

Reply via email to