Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Don't directly call sys_sync() from random bits of code, ...
details: https://anonhg.NetBSD.org/src/rev/f9995cdb496c
branches: trunk
changeset: 765760:f9995cdb496c
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Jun 05 09:04:22 2011 +0000
description:
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.
diffstat:
sys/kern/kern_pmf.c | 8 ++++----
sys/kern/vfs_mount.c | 7 ++++---
sys/kern/vfs_syscalls.c | 20 ++++++++++++--------
sys/sys/vfs_syscalls.h | 3 ++-
4 files changed, 22 insertions(+), 16 deletions(-)
diffs (150 lines):
diff -r 16588f9bad5b -r f9995cdb496c sys/kern/kern_pmf.c
--- a/sys/kern/kern_pmf.c Sun Jun 05 08:42:59 2011 +0000
+++ b/sys/kern/kern_pmf.c Sun Jun 05 09:04:22 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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
diff -r 16588f9bad5b -r f9995cdb496c sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Sun Jun 05 08:42:59 2011 +0000
+++ b/sys/kern/vfs_mount.c Sun Jun 05 09:04:22 2011 +0000
@@ -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) {
diff -r 16588f9bad5b -r f9995cdb496c sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Sun Jun 05 08:42:59 2011 +0000
+++ b/sys/kern/vfs_syscalls.c Sun Jun 05 09:04:22 2011 +0000
@@ -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.
*/
diff -r 16588f9bad5b -r f9995cdb496c sys/sys/vfs_syscalls.h
--- a/sys/sys/vfs_syscalls.h Sun Jun 05 08:42:59 2011 +0000
+++ b/sys/sys/vfs_syscalls.h Sun Jun 05 09:04:22 2011 +0000
@@ -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 *);
Home |
Main Index |
Thread Index |
Old Index