All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 00/27] Read-only bind mounts
@ 2006-06-08  0:10 Dave Hansen
  2006-06-08  0:10 ` [RFC][PATCH 01/27] Add vfsmount writer count Dave Hansen
                   ` (26 more replies)
  0 siblings, 27 replies; 56+ messages in thread
From: Dave Hansen @ 2006-06-08  0:10 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: herbert, viro, hch, trond.myklebust, Dave Hansen

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.patch

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.tar.bz2

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>

^ permalink raw reply	[flat|nested] 56+ messages in thread
* [RFC][PATCH 00/27] Mount writer count and read-only bind mounts (v4)
@ 2006-07-12 18:17 Dave Hansen
  2006-07-12 18:17 ` [RFC][PATCH 22/27] sys_mknodat(): elevate write count for vfs_mknod/create() Dave Hansen
  0 siblings, 1 reply; 56+ messages in thread
From: Dave Hansen @ 2006-07-12 18:17 UTC (permalink / raw)
  To: viro; +Cc: serue, linux-kernel, Dave Hansen

Tries to incorporate comments from Al:
http://article.gmane.org/gmane.linux.kernel/421029

Al wrote:
>  b) figuring out what (if anything) should be done with
>  propagation when we have shared subtrees... (not trivial at all)

Talked with Ram:  Shared subtrees are about having identical views
into the filesystem.  Changing the mount permissions doesn't affect
the view of the filesystem, so it should not be propagated.  

The things that probably need the heaviest review in here are the
i_nlink monitoring patch (including the inode state flag patches 03
and 06) and the new MNT_SB_WRITABLE flag (patch 05).  

---

The following series implements read-only bind mounts.  This feature
allows a read-only view into a read-write filesystem.  In the process
of doing that, it also provides infrastructure for keeping track of
the number of writers to any given mount.  In this version, if there
are writers on a superblock, the filesystem may not be remounted 
r/o.  The same goes for MS_BIND mounts, and writers on a vfsmount.

This has a number of uses.  It allows chroots to have parts of
filesystems writable.  It will be useful for containers in the future
and is intended to replace patches that vserver has had out of the
tree for several years.  It allows security enhancement by making
sure that parts of your filesystem read-only, when you don't want
to have entire new filesystems mounted, or when you want atime
selectively updated.

This set makes no attempt to keep the return codes for these
r/o bind mounts the same as for a real r/o filesystem or device.
It would require significantly more code and be quite a bit more
invasive.

Using this feature requires two steps:

	mount --bind /source /dest
	mount -o remount,ro  /dest

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2006-07-12 18:20 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-08  0:10 [RFC][PATCH 00/27] Read-only bind mounts Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 01/27] Add vfsmount writer count Dave Hansen
2006-06-08 10:33   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 02/27] vfs_rmdir: change if() into goto Dave Hansen
2006-06-08 10:37   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 04/27] elevate mnt writers for vfs_unlink() callers Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 03/27] do_rmdir(): elevate write count Dave Hansen
2006-06-08 10:42   ` Herbert Poetzl
2006-06-08 15:04     ` Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 05/27] elevate mnt writers for nfsd caller of vfs_mkdir() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 06/27] elevate write count during entire ncp_ioctl() Dave Hansen
2006-06-08 10:44   ` Herbert Poetzl
2006-06-08 15:07     ` Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 07/27] sys_mkdirat(): collapse if() Dave Hansen
2006-06-08 10:46   ` Herbert Poetzl
2006-06-08 15:10     ` Dave Hansen
2006-06-08 15:54       ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 09/27] elevate mnt writers for sys_mkdirat() call of vfs_mkdir() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 08/27] sys_mkdirat(): one more goto Dave Hansen
2006-06-08 10:48   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 10/27] sys_symlinkat() collapse if()s Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 11/27] sys_symlinkat() collapse one more if () Dave Hansen
2006-06-08 10:49   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 12/27] sys_symlinkat() elevate write count around vfs_symlink() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 13/27] sys_linkat(): elevate write count around vfs_link() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 14/27] tricky: elevate write count files are open()ed Dave Hansen
2006-06-08 10:54   ` Herbert Poetzl
2006-06-08 15:12     ` Dave Hansen
2006-06-08 16:07       ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 15/27] elevate writer count for do_sys_truncate() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 16/27] elevate write count for do_sys_utime() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 17/27] elevate write count for do_utimes() Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 19/27] sys_faccessat() elevate writer count Dave Hansen
2006-06-08 11:03   ` Herbert Poetzl
2006-06-08 15:15     ` Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 18/27] sys_faccessat(): collapse if() Dave Hansen
2006-06-08 11:05   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 20/27] unix_find_other() elevate write count for touch_atime() Dave Hansen
2006-06-08 11:07   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 21/27] mount_is_safe(): add comment Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 22/27] sys_mknodat(): elevate write count for vfs_mknod/create() Dave Hansen
2006-06-08 11:16   ` Herbert Poetzl
2006-06-08 15:23     ` Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 23/27] elevate write count over calls to vfs_rename() Dave Hansen
2006-06-08 11:23   ` Herbert Poetzl
2006-06-08 15:24     ` Dave Hansen
2006-06-12 18:18   ` Al Viro
2006-06-12 18:29     ` Dave Hansen
2006-06-12 19:03       ` Al Viro
2006-06-08  0:10 ` [RFC][PATCH 24/27] elevate mount count for extended attributes Dave Hansen
2006-06-08  0:10 ` [RFC][PATCH 25/27] /proc/mounts: prep for flags from sb or mnt Dave Hansen
2006-06-08 11:25   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 26/27] /proc/mounts: treat ro/rw like the rest Dave Hansen
2006-06-08 11:26   ` Herbert Poetzl
2006-06-08  0:10 ` [RFC][PATCH 27/27] create and pass read-only mnt flag into do_loopback() Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2006-07-12 18:17 [RFC][PATCH 00/27] Mount writer count and read-only bind mounts (v4) Dave Hansen
2006-07-12 18:17 ` [RFC][PATCH 22/27] sys_mknodat(): elevate write count for vfs_mknod/create() Dave Hansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.