User: Password:
|
|
Subscribe / Log in / New account

Read-only bind mounts

From:  Dave Hansen <haveblue@us.ibm.com>
To:  linux-fsdevel@vger.kernel.org
Subject:  [RFC][PATCH 00/27] Read-only bind mounts
Date:  Wed, 07 Jun 2006 17:10:13 -0700
Cc:  herbert@13thfloor.at, viro@ftp.linux.org.uk, hch@infradead.org, trond.myklebust@fys.uio.no, Dave Hansen <haveblue@us.ibm.com>
Archive-link:  Article, Thread

The following series implements read-only bind mounts.  This set does
not take the previously tried approach of pushing down the vfsmount
structure deeply into call paths, such that it might be checked in
functions like permission(), may_create() and may_open().  Instead,
it does checks near the entry points in the kernel, bumping a
reference count in the vfsmount structure and effetively holding
a kind of a lock on the vfsmount.

This approach will come in handy in the future, allowing transitions
from rw to ro mounts while guaranteeing that no writers are currently
active.

I apologize for so many small patches, but breaking them up like this
really did help me find bugs.  A rollup is here:

	http://sr71.net/~dave/patches/ro-bind-mounts-06-07-2006.p...

This series passes a test I got from Herbert Poetzl, checking to see
that these r/o bind mounts have the same properties as regular r/o
device mounts for a number of syscalls.

http://vserver.13thfloor.at/Experimental/BME/fstest-0.03....

Here is the script I used to generate and compare the output from
that test:

#!/bin/sh
{ umount ro-bind-mount ro-mount;
  rm -rf ro-mount-source ro-bind-mount-source ro-mount ro-bind-mount;
  dd if=/dev/zero of=ro-mount-source count=10000;
  mkfs.ext3 -F ro-mount-source;
  mkdir ro-mount ro-bind-mount;
  mkdir ro-bind-mount-source
  } > /dev/null 2>&1


mount --bind -o ro ro-bind-mount-source ro-bind-mount
mount -t ext3 -o loop,ro ro-mount-source ro-mount

function fstest_and_diff
{
        ARG1="$1"
        shift
        ARG2="$1"
        ./fstest -d "$ARG1" > "$ARG1".log;
        ./fstest -d "$ARG2" > "$ARG2".log;
        diff -ru "$ARG1".log "$ARG2".log
}

fstest_and_diff ro-mount ro-bind-mount

umount ro-bind-mount ro-mount

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds