Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys With dounmount() working on a suspended file system remo...
details: https://anonhg.NetBSD.org/src/rev/fbc2f5be765e
branches: trunk
changeset: 824114:fbc2f5be765e
user: hannken <hannken%NetBSD.org@localhost>
date: Wed May 24 09:53:55 2017 +0000
description:
With dounmount() working on a suspended file system remove no longer
needed fields mnt_busynest and mnt_unmounting from struct mount.
Welcome to 7.99.73
diffstat:
sys/kern/vfs_mount.c | 42 ++--------------------------------------
sys/kern/vfs_subr.c | 7 ++---
sys/miscfs/genfs/genfs_vfsops.c | 6 +---
sys/sys/mount.h | 4 +--
sys/sys/param.h | 4 +-
5 files changed, 11 insertions(+), 52 deletions(-)
diffs (213 lines):
diff -r 8aca053ad8fe -r fbc2f5be765e sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c Wed May 24 09:52:59 2017 +0000
+++ b/sys/kern/vfs_mount.c Wed May 24 09:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $ */
+/* $NetBSD: vfs_mount.c,v 1.64 2017/05/24 09:53:55 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.63 2017/05/24 09:52:59 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.64 2017/05/24 09:53:55 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -158,7 +158,6 @@
mp->mnt_op = vfsops;
mp->mnt_refcnt = 1;
TAILQ_INIT(&mp->mnt_vnodelist);
- mutex_init(&mp->mnt_unmounting, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&mp->mnt_renamelock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&mp->mnt_updating, MUTEX_DEFAULT, IPL_NONE);
mp->mnt_vnodecovered = vp;
@@ -298,7 +297,6 @@
*/
KASSERT(mp->mnt_refcnt == 0);
specificdata_fini(mount_specificdata_domain, &mp->mnt_specdataref);
- mutex_destroy(&mp->mnt_unmounting);
mutex_destroy(&mp->mnt_updating);
mutex_destroy(&mp->mnt_renamelock);
if (mp->mnt_op != NULL) {
@@ -325,23 +323,14 @@
if (wait) {
fstrans_start(mp, FSTRANS_SHARED);
- mutex_enter(&mp->mnt_unmounting);
} 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;
- KASSERT(mp->mnt_busynest != 0);
- mutex_exit(&mp->mnt_unmounting);
vfs_ref(mp);
return 0;
}
@@ -371,10 +360,6 @@
KASSERT(mp->mnt_refcnt > 0);
- mutex_enter(&mp->mnt_unmounting);
- KASSERT(mp->mnt_busynest != 0);
- mp->mnt_busynest--;
- mutex_exit(&mp->mnt_unmounting);
fstrans_done(mp);
vfs_rele(mp);
}
@@ -874,23 +859,7 @@
return error;
}
- /*
- * Abort unmount attempt when the filesystem is in use
- */
- mutex_enter(&mp->mnt_unmounting);
- if (mp->mnt_busynest != 0) {
- mutex_exit(&mp->mnt_unmounting);
- vfs_resume(mp);
- return EBUSY;
- }
-
- /*
- * Abort unmount attempt when the filesystem is not mounted
- */
- if ((mp->mnt_iflag & IMNT_GONE) != 0) {
- mutex_exit(&mp->mnt_unmounting);
- return ENOENT;
- }
+ KASSERT((mp->mnt_iflag & IMNT_GONE) == 0);
used_syncer = (mp->mnt_iflag & IMNT_ONWORKLIST) != 0;
used_extattr = mp->mnt_flag & MNT_EXTATTR;
@@ -911,7 +880,6 @@
}
if (error) {
mp->mnt_iflag &= ~IMNT_UNMOUNT;
- mutex_exit(&mp->mnt_unmounting);
if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0)
vfs_syncer_add_to_worklist(mp);
mp->mnt_flag |= async;
@@ -928,15 +896,11 @@
mutex_exit(&mp->mnt_updating);
/*
- * release mnt_umounting lock here, because other code calls
- * vfs_busy() while holding the mountlist_lock.
- *
* mark filesystem as gone to prevent further umounts
* after mnt_umounting lock is gone, this also prevents
* vfs_busy() from succeeding.
*/
mp->mnt_iflag |= IMNT_GONE;
- mutex_exit(&mp->mnt_unmounting);
vfs_resume(mp);
if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) {
diff -r 8aca053ad8fe -r fbc2f5be765e sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Wed May 24 09:52:59 2017 +0000
+++ b/sys/kern/vfs_subr.c Wed May 24 09:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.466 2017/05/24 09:53:55 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.465 2017/05/24 09:52:59 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.466 2017/05/24 09:53:55 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1561,8 +1561,7 @@
snprintb(sbuf, sizeof(sbuf), __IMNT_FLAG_BITS, mp->mnt_iflag);
(*pr)("iflag = %s\n", sbuf);
- (*pr)("refcnt = %d unmounting @ %p updating @ %p\n", mp->mnt_refcnt,
- &mp->mnt_unmounting, &mp->mnt_updating);
+ (*pr)("refcnt = %d updating @ %p\n", mp->mnt_refcnt, &mp->mnt_updating);
(*pr)("statvfs cache:\n");
(*pr)("\tbsize = %lu\n",mp->mnt_stat.f_bsize);
diff -r 8aca053ad8fe -r fbc2f5be765e sys/miscfs/genfs/genfs_vfsops.c
--- a/sys/miscfs/genfs/genfs_vfsops.c Wed May 24 09:52:59 2017 +0000
+++ b/sys/miscfs/genfs/genfs_vfsops.c Wed May 24 09:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vfsops.c,v 1.6 2017/05/07 08:25:54 hannken Exp $ */
+/* $NetBSD: genfs_vfsops.c,v 1.7 2017/05/24 09:53:55 hannken Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.6 2017/05/07 08:25:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vfsops.c,v 1.7 2017/05/24 09:53:55 hannken Exp $");
#include <sys/types.h>
#include <sys/mount.h>
@@ -85,10 +85,8 @@
case SUSPEND_SUSPEND:
error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
if (error == 0) {
- mutex_enter(&mp->mnt_unmounting);
if ((mp->mnt_iflag & IMNT_GONE) != 0)
error = ENOENT;
- mutex_exit(&mp->mnt_unmounting);
if (error) {
error2 = fstrans_setstate(mp, FSTRANS_NORMAL);
KASSERT(error2 == 0);
diff -r 8aca053ad8fe -r fbc2f5be765e sys/sys/mount.h
--- a/sys/sys/mount.h Wed May 24 09:52:59 2017 +0000
+++ b/sys/sys/mount.h Wed May 24 09:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mount.h,v 1.227 2017/05/24 09:52:59 hannken Exp $ */
+/* $NetBSD: mount.h,v 1.228 2017/05/24 09:53:55 hannken Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@@ -115,10 +115,8 @@
int mnt_synclist_slot; /* synclist slot index */
void *mnt_transinfo; /* for FS-internal use */
void *mnt_data; /* private data */
- kmutex_t mnt_unmounting; /* to prevent new activity */
kmutex_t mnt_renamelock; /* per-fs rename lock */
int mnt_refcnt; /* ref count on this structure */
- unsigned int mnt_busynest; /* vfs_busy nestings */
int mnt_flag; /* flags */
int mnt_iflag; /* internal flags */
int mnt_fs_bshift; /* offset shift for lblkno */
diff -r 8aca053ad8fe -r fbc2f5be765e sys/sys/param.h
--- a/sys/sys/param.h Wed May 24 09:52:59 2017 +0000
+++ b/sys/sys/param.h Wed May 24 09:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.539 2017/05/19 00:01:34 pgoyette Exp $ */
+/* $NetBSD: param.h,v 1.540 2017/05/24 09:53:55 hannken Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
* 2.99.9 (299000900)
*/
-#define __NetBSD_Version__ 799007200 /* NetBSD 7.99.72 */
+#define __NetBSD_Version__ 799007300 /* NetBSD 7.99.73 */
#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
(m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
Home |
Main Index |
Thread Index |
Old Index