Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Enter fstrans from _vfs_busy() and leave from vfs_u...
details: https://anonhg.NetBSD.org/src/rev/ae00dbdff9d7
branches: trunk
changeset: 823753:ae00dbdff9d7
user: hannken <hannken%NetBSD.org@localhost>
date: Sun May 07 08:26:58 2017 +0000
description:
Enter fstrans from _vfs_busy() and leave from vfs_unbusy().
Adapt sched_sync() and do_sys_sync().
diffstat:
sys/kern/vfs_mount.c | 16 ++++++++++++----
sys/kern/vfs_subr.c | 9 +++------
sys/kern/vfs_syscalls.c | 6 ++----
3 files changed, 17 insertions(+), 14 deletions(-)
diffs (112 lines):
diff -r 35ccda504bd6 -r ae00dbdff9d7 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Sun May 07 08:25:54 2017 +0000
+++ b/sys/kern/vfs_mount.c Sun May 07 08:26:58 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.60 2017/05/07 08:24:20 hannken Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.61 2017/05/07 08:26:58 hannken 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.60 2017/05/07 08:24:20 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.61 2017/05/07 08:26:58 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -324,12 +324,19 @@
KASSERT(mp->mnt_refcnt > 0);
if (wait) {
+ fstrans_start(mp, FSTRANS_SHARED);
mutex_enter(&mp->mnt_unmounting);
- } else if (!mutex_tryenter(&mp->mnt_unmounting)) {
- return EBUSY;
+ } else {
+ if (fstrans_start_nowait(mp, FSTRANS_SHARED))
+ return EBUSY;
+ if (!mutex_tryenter(&mp->mnt_unmounting)) {
+ fstrans_done(mp);
+ return EBUSY;
+ }
}
if (__predict_false((mp->mnt_iflag & IMNT_GONE) != 0)) {
mutex_exit(&mp->mnt_unmounting);
+ fstrans_done(mp);
return ENOENT;
}
++mp->mnt_busynest;
@@ -368,6 +375,7 @@
KASSERT(mp->mnt_busynest != 0);
mp->mnt_busynest--;
mutex_exit(&mp->mnt_unmounting);
+ fstrans_done(mp);
vfs_rele(mp);
}
diff -r 35ccda504bd6 -r ae00dbdff9d7 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Sun May 07 08:25:54 2017 +0000
+++ b/sys/kern/vfs_subr.c Sun May 07 08:26:58 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.463 2017/04/17 08:34:27 hannken Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.464 2017/05/07 08:26:58 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.463 2017/04/17 08:34:27 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.464 2017/05/07 08:26:58 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -781,10 +781,7 @@
continue;
}
mp->mnt_synclist_slot = sync_delay_slot(sync_delay(mp));
- if (fstrans_start_nowait(mp, FSTRANS_SHARED) == 0) {
- VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
- fstrans_done(mp);
- }
+ VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
}
mountlist_iterator_destroy(iter);
diff -r 35ccda504bd6 -r ae00dbdff9d7 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Sun May 07 08:25:54 2017 +0000
+++ b/sys/kern/vfs_syscalls.c Sun May 07 08:26:58 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.514 2017/05/07 08:25:54 hannken Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.515 2017/05/07 08:26:58 hannken 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.514 2017/05/07 08:25:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.515 2017/05/07 08:26:58 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -641,7 +641,6 @@
mountlist_iterator_init(&iter);
while ((mp = mountlist_iterator_next(iter)) != NULL) {
- fstrans_start(mp, FSTRANS_SHARED);
mutex_enter(&mp->mnt_updating);
if ((mp->mnt_flag & MNT_RDONLY) == 0) {
asyncflag = mp->mnt_flag & MNT_ASYNC;
@@ -651,7 +650,6 @@
mp->mnt_flag |= MNT_ASYNC;
}
mutex_exit(&mp->mnt_updating);
- fstrans_done(mp);
}
mountlist_iterator_destroy(iter);
#ifdef DEBUG
Home |
Main Index |
Thread Index |
Old Index