Skip to content

Read-only bind mounts

Dave Hansen lkml 1 version In review

Get series with b4
b4 am 20070917182718.70494C9B@kernel

Versions newest first

  1. v1 Latest22 of 24 patches 34 repliesIn review

22 of 24 patches are in this archive. The cover letter announces 24.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/24filesystem helpers for custom 'struct file'sfs/configfs/dir.c fs/file_table.c fs/hugetlbfs/inode.c +5 more+78 -495 replies
2/24rearrange may_open() to be r/o friendlyfs/namei.c+9 -52 replies
3/24create cleanup helper svc_msnfs()fs/nfsd/vfs.c+11 -46 replies
4/24r/o bind mounts: stub functionsfs/namespace.c include/linux/mount.h+49 -01 reply
5/24elevate write count open()'d filesfs/file_table.c fs/namei.c ipc/mqueue.c+27 -51 reply
6/24r/o bind mounts: elevate write count for some ioctlsfs/ext2/ioctl.c fs/ext3/ioctl.c fs/ext4/ioctl.c +8 more+273 -1571 reply
7/24elevate writer count for chown and friendsfs/open.c+30 -91 reply
8/24make access() use mnt checkfs/open.c+11 -21 reply
9/24elevate mnt writers for callers of vfs_mkdir()fs/namei.c fs/nfsd/nfs4recover.c+9 -01 reply
10/24elevate write count during entire ncp_ioctl()fs/ncpfs/ioctl.c+54 -11 reply
11/24elevate write count for link and symlink callsfs/namei.c+10 -01 reply
12/24elevate mount count for extended attributesfs/nfsd/nfs4proc.c fs/xattr.c+20 -31 reply
13/24elevate write count for file_update_time()fs/inode.c+12 -11 reply
14/24unix_find_other() elevate write count for touch_atime()net/unix/af_unix.c+12 -41 reply
15/24elevate write count over calls to vfs_rename()fs/namei.c fs/nfsd/vfs.c+15 -41 reply
16/24nfs: check mnt instead of superblock directlyfs/nfs/dir.c fs/nfsd/vfs.c+4 -31 reply
17/24elevate writer count for do_sys_truncate()fs/open.c+8 -61 reply
18/24elevate write count for do_utimes()fs/utimes.c+9 -61 reply
19/24elevate write count for do_sys_utime() and touch_atime()fs/inode.c+12 -81 reply
20/24sys_mknodat(): elevate write count for vfs_mknod/create()fs/namei.c fs/nfsd/vfs.c net/unix/af_unix.c+29 -111 reply
21/24elevate mnt writers for vfs_unlink() callersfs/namei.c ipc/mqueue.c+8 -11 reply
22/24do_rmdir(): elevate write countfs/namei.c+5 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/24] Read-only bind mounts

If we can't pull the entire series into -mm, can we just put the first three patches for now? They can stand on their own.

---

Why do we need r/o 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.

This has a number of uses. It allows chroots to have parts of filesystems writable. It will be useful for containers in the future because users may have root inside a container, but should not be allowed to write to somefilesystems. This also replaces 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 (such as when you don't trust your FTP server), when you don't want to have entire new filesystems mounted, or when you want atime selectively updated. I've been using the following script to test that the feature is working as desired. It takes a directory and makes a regular bind and a r/o bind mount of it. It then performs some normal filesystem operations on the three directories, including ones that are expected to fail, like creating a file on the r/o mount.