Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Do not VFS_SYNC before VFS_UNMOUNT on force unmount



details:   https://anonhg.NetBSD.org/src/rev/29ee202c7fb9
branches:  trunk
changeset: 809785:29ee202c7fb9
user:      manu <manu%NetBSD.org@localhost>
date:      Sun Aug 02 03:29:22 2015 +0000

description:
Do not VFS_SYNC before VFS_UNMOUNT on force unmount

VFS_SYNC does not consider whether we are performing a force unmount or not,
and therefore it can wait for a while if the filesytstem is misbehaving.
Removing VFS_SYNC before VFS_UNMOUNT on forced unmount fixes the problem.

This should not cause harm as the VFS_SYNC seems just useless.
As noted by Chuck Silvers in
http://mail-index.netbsd.org/tech-kern/2015/07/13/msg019156.html
- Nothing seems to prevent vnodes from getting dirty again after VFS_SYNC call.
- Filesystems do flush data through vflush() in VFS_UNMOUNT anyway.

As a consequence, the VFS_SYNC call in do_unmount() could probably be
completely removed. But since such a change is quite dangerous, we just
remove it in the case of forced unmounts, which are situations where
the risk of data loss is known to the operator.

diffstat:

 sys/kern/vfs_mount.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 115b9953a0e4 -r 29ee202c7fb9 sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Sun Aug 02 03:19:02 2015 +0000
+++ b/sys/kern/vfs_mount.c      Sun Aug 02 03:29:22 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_mount.c,v 1.35 2015/05/06 15:57:08 hannken Exp $   */
+/*     $NetBSD: vfs_mount.c,v 1.36 2015/08/02 03:29:22 manu 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.35 2015/05/06 15:57:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.36 2015/08/02 03:29:22 manu Exp $");
 
 #define _VFS_VNODE_PRIVATE
 
@@ -824,7 +824,7 @@
        if (used_syncer)
                vfs_syncer_remove_from_worklist(mp);
        error = 0;
-       if ((mp->mnt_flag & MNT_RDONLY) == 0) {
+       if (((mp->mnt_flag & MNT_RDONLY) == 0) && ((flags & MNT_FORCE) == 0)) {
                error = VFS_SYNC(mp, MNT_WAIT, l->l_cred);
        }
        if (error == 0 || (flags & MNT_FORCE)) {



Home | Main Index | Thread Index | Old Index