Source-Changes-HG archive

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

[src/trunk]: src/sys allow file system to decide if it can be downgraded from...



details:   https://anonhg.NetBSD.org/src/rev/497b65a8375e
branches:  trunk
changeset: 760798:497b65a8375e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 13 07:25:50 2011 +0000

description:
allow file system to decide if it can be downgraded from r/w to r/o

diffstat:

 sys/kern/vfs_syscalls.c |  7 ++++---
 sys/sys/fstypes.h       |  4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r cb72319b6e10 -r 497b65a8375e sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Thu Jan 13 07:23:39 2011 +0000
+++ b/sys/kern/vfs_syscalls.c   Thu Jan 13 07:25:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.413 2011/01/02 05:12:33 dholland Exp $      */
+/*     $NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.413 2011/01/02 05:12:33 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.414 2011/01/13 07:25:50 pooka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -169,7 +169,8 @@
         * prevent read-write to read-only downgrades.
         */
        if ((flags & (MNT_RELOAD | MNT_RDONLY)) != 0 &&
-           (mp->mnt_flag & MNT_RDONLY) == 0) {
+           (mp->mnt_flag & MNT_RDONLY) == 0 &&
+           (mp->mnt_iflag & IMNT_CAN_RWTORO) == 0) {
                error = EOPNOTSUPP;     /* Needs translation */
                goto out;
        }
diff -r cb72319b6e10 -r 497b65a8375e sys/sys/fstypes.h
--- a/sys/sys/fstypes.h Thu Jan 13 07:23:39 2011 +0000
+++ b/sys/sys/fstypes.h Thu Jan 13 07:25:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fstypes.h,v 1.27 2011/01/13 07:23:39 pooka Exp $       */
+/*     $NetBSD: fstypes.h,v 1.28 2011/01/13 07:25:50 pooka Exp $       */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -210,6 +210,7 @@
 #define        IMNT_DTYPE      0x00000040      /* returns d_type fields */
 #define        IMNT_HAS_TRANS  0x00000080      /* supports transactions */
 #define        IMNT_MPSAFE     0x00000100      /* file system code MP safe */
+#define        IMNT_CAN_RWTORO 0x00000200      /* can downgrade fs to from rw to r/o */
 
 #define        __MNT_FLAGS \
        __MNT_BASIC_FLAGS \
@@ -254,6 +255,7 @@
 
 #define        __IMNT_FLAG_BITS \
        "\20" \
+       "\12IMNT_CAN_RWTORO" \
         "\11IMNT_MPSAFE" \
        "\10IMNT_HAS_TRANS" \
        "\07IMNT_DTYPE" \



Home | Main Index | Thread Index | Old Index