Skip to content

RFC Read-only bind mounts (-mm resend)

Dave Hansen lkml 1 version In review

Get series with b4
b4 am 20080208222641.6024A7CC@kernel

Versions newest first

  1. v1 RFC Latest30 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/30reiserfs: eliminate private use of struct file in xattrfs/reiserfs/xattr.c+30 -800 replies
2/30hppfs pass vfsmount to dentry_open()fs/hppfs/hppfs_kern.c+188 -1760 replies
3/30check for null vfsmount in dentry_open()fs/open.c+12 -00 replies
4/30fix up new filp allocatorsfs/anon_inodes.c fs/file_table.c fs/pipe.c+21 -200 replies
5/30do namei_flags calculation inside open_namei()fs/namei.c fs/open.c+36 -290 replies
6/30make open_namei() return a filpfs/namei.c fs/open.c include/linux/fs.h+59 -631 reply
7/30r/o bind mounts: stub functionsfs/namespace.c include/linux/mount.h+57 -00 replies
8/30r/o bind mounts: create helper to drop file write accessfs/file_table.c fs/nfsd/nfs4state.c include/linux/file.h+21 -20 replies
9/30r/o bind mounts: drop write during emergency remountfs/super.c+18 -20 replies
10/30r/o bind mounts: elevate write count for vfs_rmdir()fs/namei.c+5 -00 replies
11/30r/o bind mounts: elevate write count for callers of vfs_mkdir()fs/namei.c fs/nfsd/nfs4recover.c+10 -00 replies
12/30r/o bind mounts: elevate mnt_writers for unlink callersfs/namei.c ipc/mqueue.c+8 -10 replies
13/30r/o bind mounts: elevate write count for xattr_permission() callersfs/nfsd/nfs4proc.c fs/xattr.c+20 -30 replies
14/30r/o bind mounts: elevate write count for ncp_ioctl()fs/ncpfs/ioctl.c+53 -10 replies
15/30r/o bind mounts: write counts for time functionsfs/inode.c+20 -250 replies
16/30r/o bind mounts: elevate write count for do_utimes()fs/utimes.c+12 -60 replies
17/30r/o bind mounts: write count for file_update_time()fs/inode.c+5 -10 replies
18/30r/o bind mounts: write counts for link/symlinkfs/namei.c+10 -00 replies
19/30r/o bind mounts: elevate write count for ioctls()fs/ext2/ioctl.c fs/ext3/ioctl.c fs/fat/file.c +5 more+213 -1170 replies
20/30r/o bind mounts: elevate write count for open()sfs/file_table.c fs/namei.c fs/open.c +1 more+127 -140 replies
21/30r/o bind mounts: get write access for vfs_rename() callersfs/namei.c fs/nfsd/vfs.c+17 -40 replies
22/30r/o bind mounts: elevate write count for chmod/chown callersfs/open.c+30 -90 replies
23/30r/o bind mounts: write counts for truncate()fs/open.c+8 -60 replies
24/30r/o bind mounts: elevate count for xfs timestamp updatesfs/xfs/linux-2.6/xfs_iops.c fs/xfs/linux-2.6/xfs_lrw.c+8 -80 replies
25/30r/o bind mounts: make access() use new r/o helperfs/open.c+11 -20 replies
26/30r/o bind mounts: check mnt instead of superblock directlyfs/nfs/dir.c fs/nfsd/vfs.c+5 -30 replies
27/30r/o bind mounts: get callers of vfs_mknod/create()fs/namei.c fs/nfsd/vfs.c net/unix/af_unix.c+40 -110 replies
28/30r/o bind mounts: track numbers of writers to mountsfs/namespace.c include/linux/mount.h+232 -150 replies
29/30r/o bind mounts: honor mount writer counts at remountfs/namespace.c include/linux/mount.h+44 -70 replies
30/30r/o bind mounts: debugging for missed callsfs/file_table.c fs/open.c fs/super.c +2 more+82 -30 replies

Reviews trailers per patch

11 of 30 patches have a Reviewed-by or Acked-by.

PatchSerge HallynChristoph Hellwig
1/30
2/30
3/30
4/30
5/30
6/30
7/30A-b
8/30
9/30
10/30A-b A-b
11/30A-b
12/30
13/30A-b
14/30
15/30
16/30A-b
17/30
18/30
19/30A-b
20/30
21/30A-b
22/30A-b
23/30
24/30
25/30A-b
26/30A-b
27/30A-b
28/30
29/30
30/30

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC][PATCH 00/30] Read-only bind mounts (-mm resend)

This is against current Linus git
(a4ffc0a0b240a29cbe489f6db9dae112a49ef1c1).

This rolls up all the -mm bugfixes that were accumulated, and addresses some new review comments from Al. Also contains some reworking from hch and a patch from Jeff Dike.

Just posting here to let everyone have a sniff before we resend it back to -mm.

---

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 are 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 this script:

	http://sr71.net/~dave/linux/robind-test.sh

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.