Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove the syncer dance from dounmount(). The syncer skips



details:   https://anonhg.NetBSD.org/src/rev/d0a117a39902
branches:  trunk
changeset: 353812:d0a117a39902
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed May 24 09:52:59 2017 +0000

description:
Remove the syncer dance from dounmount().  The syncer skips
unmounting file systems as they are suspended.

Remove now unused syncer_mutex.

diffstat:

 sys/kern/vfs_mount.c |  32 ++------------------------------
 sys/kern/vfs_subr.c  |   9 ++-------
 sys/sys/mount.h      |   3 +--
 3 files changed, 5 insertions(+), 39 deletions(-)

diffs (157 lines):

diff -r 926892299e72 -r d0a117a39902 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Wed May 24 09:34:48 2017 +0000
+++ b/sys/kern/vfs_mount.c      Wed May 24 09:52:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_mount.c,v 1.62 2017/05/17 12:45:03 hannken Exp $   */
+/*     $NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 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.62 2017/05/17 12:45:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.63 2017/05/24 09:52:59 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -869,15 +869,8 @@
        }
        mountlist_iterator_destroy(iter);
 
-       /*
-        * XXX Freeze syncer.  Must do this before locking the
-        * mount point.  See dounmount() for details.
-        */
-       mutex_enter(&syncer_mutex);
-
        error = vfs_suspend(mp, 0);
        if (error) {
-               mutex_exit(&syncer_mutex);
                return error;
        }
 
@@ -887,7 +880,6 @@
        mutex_enter(&mp->mnt_unmounting);
        if (mp->mnt_busynest != 0) {
                mutex_exit(&mp->mnt_unmounting);
-               mutex_exit(&syncer_mutex);
                vfs_resume(mp);
                return EBUSY;
        }
@@ -897,28 +889,12 @@
         */
        if ((mp->mnt_iflag & IMNT_GONE) != 0) {
                mutex_exit(&mp->mnt_unmounting);
-               mutex_exit(&syncer_mutex);
                return ENOENT;
        }
 
        used_syncer = (mp->mnt_iflag & IMNT_ONWORKLIST) != 0;
        used_extattr = mp->mnt_flag & MNT_EXTATTR;
 
-       /*
-        * XXX Syncer must be frozen when we get here.  This should really
-        * be done on a per-mountpoint basis, but the syncer doesn't work
-        * like that.
-        *
-        * The caller of dounmount() must acquire syncer_mutex because
-        * the syncer itself acquires locks in syncer_mutex -> vfs_busy
-        * order, and we must preserve that order to avoid deadlock.
-        *
-        * So, if the file system did not use the syncer, now is
-        * the time to release the syncer_mutex.
-        */
-       if (used_syncer == 0) {
-               mutex_exit(&syncer_mutex);
-       }
        mp->mnt_iflag |= IMNT_UNMOUNT;
        mutex_enter(&mp->mnt_updating);
        async = mp->mnt_flag & MNT_ASYNC;
@@ -941,8 +917,6 @@
                mp->mnt_flag |= async;
                mutex_exit(&mp->mnt_updating);
                vfs_resume(mp);
-               if (used_syncer)
-                       mutex_exit(&syncer_mutex);
                if (used_extattr) {
                        if (start_extattr(mp) != 0)
                                mp->mnt_flag &= ~MNT_EXTATTR;
@@ -973,8 +947,6 @@
        mountlist_remove(mp);
        if (TAILQ_FIRST(&mp->mnt_vnodelist) != NULL)
                panic("unmount: dangling vnode");
-       if (used_syncer)
-               mutex_exit(&syncer_mutex);
        vfs_hooks_unmount(mp);
 
        fstrans_unmount(mp);
diff -r 926892299e72 -r d0a117a39902 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Wed May 24 09:34:48 2017 +0000
+++ b/sys/kern/vfs_subr.c       Wed May 24 09:52:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.464 2017/05/07 08:26:58 hannken Exp $   */
+/*     $NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 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.464 2017/05/07 08:26:58 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.465 2017/05/24 09:52:59 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -568,7 +568,6 @@
 time_t metadelay = 10;                 /* time to delay syncing metadata */
 time_t lockdelay = 1;                  /* time to delay if locking fails */
 
-kmutex_t               syncer_mutex;   /* used to freeze syncer, long term */
 static kmutex_t                syncer_data_lock; /* short term lock on data structs */
 
 static int             syncer_delayno = 0;
@@ -590,7 +589,6 @@
        for (i = 0; i < syncer_last; i++)
                TAILQ_INIT(&syncer_workitem_pending[i]);
 
-       mutex_init(&syncer_mutex, MUTEX_DEFAULT, IPL_NONE);
        mutex_init(&syncer_data_lock, MUTEX_DEFAULT, IPL_NONE);
 }
 
@@ -767,8 +765,6 @@
        bool synced;
 
        for (;;) {
-               mutex_enter(&syncer_mutex);
-
                starttime = time_second;
 
                /*
@@ -830,7 +826,6 @@
                                    synced ? syncdelay : lockdelay);
                        }
                }
-               mutex_exit(&syncer_mutex);
 
                /*
                 * If it has taken us less than a second to process the
diff -r 926892299e72 -r d0a117a39902 sys/sys/mount.h
--- a/sys/sys/mount.h   Wed May 24 09:34:48 2017 +0000
+++ b/sys/sys/mount.h   Wed May 24 09:52:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount.h,v 1.226 2017/04/17 08:34:27 hannken Exp $      */
+/*     $NetBSD: mount.h,v 1.227 2017/05/24 09:52:59 hannken Exp $      */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -458,7 +458,6 @@
 
 /* Syncer */
 extern int     syncer_maxdelay;
-extern kmutex_t        syncer_mutex;
 extern time_t  syncdelay;
 extern time_t  filedelay;
 extern time_t  dirdelay;



Home | Main Index | Thread Index | Old Index