Module Name:    src
Committed By:   dsl
Date:           Sun Jun  5 09:04:22 UTC 2011

Modified Files:
        src/sys/kern: kern_pmf.c vfs_mount.c vfs_syscalls.c
        src/sys/sys: vfs_syscalls.h

Log Message:
Don't directly call sys_sync() from random bits of code, instead
  add do_sys_sync() that takes an 'lwp' (for l_cred) as an argument.
Explicitly pass &lwp0 rather than NULL and expecting sys_sync to
  substitute some random lwp.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_pmf.c
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/vfs_mount.c
cvs rdiff -u -r1.424 -r1.425 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.14 -r1.15 src/sys/sys/vfs_syscalls.h

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

Modified files:

Index: src/sys/kern/kern_pmf.c
diff -u src/sys/kern/kern_pmf.c:1.34 src/sys/kern/kern_pmf.c:1.35
--- src/sys/kern/kern_pmf.c:1.34	Wed Apr 27 00:36:47 2011
+++ src/sys/kern/kern_pmf.c	Sun Jun  5 09:04:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_pmf.c,v 1.34 2011/04/27 00:36:47 rmind Exp $ */
+/* $NetBSD: kern_pmf.c,v 1.35 2011/06/05 09:04:22 dsl Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.34 2011/04/27 00:36:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pmf.c,v 1.35 2011/06/05 09:04:22 dsl Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -39,7 +39,6 @@
 #include <sys/pmf.h>
 #include <sys/queue.h>
 #include <sys/sched.h>
-#include <sys/syscallargs.h> /* for sys_sync */
 #include <sys/workqueue.h>
 #include <prop/proplib.h>
 #include <sys/condvar.h>
@@ -47,6 +46,7 @@
 #include <sys/proc.h>
 #include <sys/reboot.h>	/* for RB_NOSYNC */
 #include <sys/sched.h>
+#include <sys/vfs_syscalls.h>
 
 /* XXX ugly special case, but for now the only client */
 #include "wsdisplay.h"
@@ -322,7 +322,7 @@
 	 */
 	if (doing_shutdown == 0 && panicstr == NULL) {
 		printf("Flushing disk caches: ");
-		sys_sync(NULL, NULL, NULL);
+		do_sys_sync(&lwp0);
 		if (buf_syncwait() != 0)
 			printf("giving up\n");
 		else

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.4 src/sys/kern/vfs_mount.c:1.5
--- src/sys/kern/vfs_mount.c:1.4	Sun Apr  3 01:20:23 2011
+++ src/sys/kern/vfs_mount.c	Sun Jun  5 09:04:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.4 2011/04/03 01:20:23 rmind Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.5 2011/06/05 09:04:22 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.4 2011/04/03 01:20:23 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.5 2011/06/05 09:04:22 dsl Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -86,6 +86,7 @@
 #include <sys/syscallargs.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
+#include <sys/vfs_syscalls.h>
 #include <sys/vnode.h>
 
 #include <miscfs/genfs/genfs.h>
@@ -984,7 +985,7 @@
 	/* avoid coming back this way again if we panic. */
 	doing_shutdown = 1;
 
-	sys_sync(l, NULL, NULL);
+	do_sys_sync(l);
 
 	/* Wait for sync to finish. */
 	if (buf_syncwait() != 0) {

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.424 src/sys/kern/vfs_syscalls.c:1.425
--- src/sys/kern/vfs_syscalls.c:1.424	Thu Jun  2 18:54:43 2011
+++ src/sys/kern/vfs_syscalls.c	Sun Jun  5 09:04:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.424 2011/06/02 18:54:43 dsl Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.425 2011/06/05 09:04:22 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.424 2011/06/02 18:54:43 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.425 2011/06/05 09:04:22 dsl Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -538,16 +538,12 @@
 struct ctldebug debug0 = { "syncprt", &syncprt };
 #endif
 
-/* ARGSUSED */
-int
-sys_sync(struct lwp *l, const void *v, register_t *retval)
+void
+do_sys_sync(struct lwp *l)
 {
 	struct mount *mp, *nmp;
 	int asyncflag;
 
-	if (l == NULL)
-		l = &lwp0;
-
 	mutex_enter(&mountlist_lock);
 	for (mp = CIRCLEQ_FIRST(&mountlist); mp != (void *)&mountlist;
 	     mp = nmp) {
@@ -570,9 +566,17 @@
 	if (syncprt)
 		vfs_bufstats();
 #endif /* DEBUG */
+}
+
+/* ARGSUSED */
+int
+sys_sync(struct lwp *l, const void *v, register_t *retval)
+{
+	do_sys_sync(l);
 	return (0);
 }
 
+
 /*
  * Change filesystem quotas.
  */

Index: src/sys/sys/vfs_syscalls.h
diff -u src/sys/sys/vfs_syscalls.h:1.14 src/sys/sys/vfs_syscalls.h:1.15
--- src/sys/sys/vfs_syscalls.h:1.14	Wed Jun 30 15:44:55 2010
+++ src/sys/sys/vfs_syscalls.h	Sun Jun  5 09:04:22 2011
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.h,v 1.14 2010/06/30 15:44:55 pooka Exp $        */
+/*     $NetBSD: vfs_syscalls.h,v 1.15 2011/06/05 09:04:22 dsl Exp $        */
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,6 +66,7 @@
     enum uio_seg);
 int	do_sys_mkdir(const char *, mode_t, enum uio_seg);
 int	do_sys_symlink(const char *, const char *, enum uio_seg);
+void	do_sys_sync(struct lwp *);
 
 int	chdir_lookup(const char *, int, struct vnode **, struct lwp *);
 void	change_root(struct cwdinfo *, struct vnode *, struct lwp *);

Reply via email to