Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix a logic error introduced with Rev. 1.507: defer...



details:   https://anonhg.NetBSD.org/src/rev/a0d2c79c389e
branches:  trunk
changeset: 822208:a0d2c79c389e
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Mar 07 11:54:16 2017 +0000

description:
Fix a logic error introduced with Rev. 1.507: defer setting MNT_RDONLY
only if going from read-write to read-only.

Should fix PR kern/52045 (panic: ffs_sync: rofs mod, fs=/ after fsck)

diffstat:

 sys/kern/vfs_syscalls.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r b7de5d49c4d6 -r a0d2c79c389e sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Tue Mar 07 11:15:08 2017 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Mar 07 11:54:16 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.508 2017/03/01 10:45:24 hannken Exp $       */
+/*     $NetBSD: vfs_syscalls.c,v 1.509 2017/03/07 11:54:16 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.508 2017/03/01 10:45:24 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.509 2017/03/07 11:54:16 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -306,7 +306,10 @@
                        mp->mnt_iflag |= IMNT_WANTRDWR;
        }
        mp->mnt_flag &= ~MNT_BASIC_FLAGS;
-       mp->mnt_flag |= (flags & ~MNT_RDONLY) & MNT_BASIC_FLAGS;
+       mp->mnt_flag |= flags & MNT_BASIC_FLAGS;
+       if ((mp->mnt_iflag & IMNT_WANTRDONLY))
+               mp->mnt_flag &= ~MNT_RDONLY;
+
        error = VFS_MOUNT(mp, path, data, data_len);
 
        if (error && data != NULL) {
@@ -329,8 +332,6 @@
 
        if (error == 0 && (mp->mnt_iflag & IMNT_WANTRDONLY))
                mp->mnt_flag |= MNT_RDONLY;
-       else if (error == 0 && (mp->mnt_iflag & IMNT_WANTRDWR))
-               mp->mnt_flag &= ~MNT_RDONLY;
        if (error)
                mp->mnt_flag = saved_flags;
        mp->mnt_flag &= ~MNT_OP_FLAGS;



Home | Main Index | Thread Index | Old Index