Skip to content

Read-only bind mounts (-mm resend)

Dave Hansen lkml 1 version In review

Get series with b4
b4 am 20071101230826.9A4F6E00@kernel

Versions newest first

  1. v1 Latest27 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27do namei_flags calculation inside open_namei()fs/namei.c fs/open.c+36 -290 replies
2/27make open_namei() return a filpfs/namei.c fs/open.c include/linux/fs.h+10 -150 replies
3/27kill do_filp_open()fs/open.c+18 -210 replies
4/27kill filp_open()drivers/usb/gadget/file_storage.c fs/exec.c fs/namei.c +7 more+53 -496 replies
5/27rename open_namei() to open_pathname()drivers/usb/gadget/file_storage.c fs/exec.c fs/namei.c +5 more+12 -181 reply
6/27r-o-bind-mounts-stub-functionsfs/namespace.c include/linux/mount.h+57 -00 replies
7/27r-o-bind-mounts-do_rmdir-elevate-write-countfs/namei.c+5 -00 replies
8/27r-o-bind-mounts-elevate-mnt-writers-for-callers-of-vfs_mkdirfs/namei.c fs/nfsd/nfs4recover.c+10 -00 replies
9/27r-o-bind-mounts-elevate-mnt-writers-for-vfs_unlink-callersfs/namei.c ipc/mqueue.c+8 -10 replies
10/27r-o-bind-mounts-elevate-mount-count-for-extended-attributesfs/nfsd/nfs4proc.c fs/xattr.c+20 -30 replies
11/27r-o-bind-mounts-elevate-write-count-during-entire-ncp_ioctlfs/ncpfs/ioctl.c+55 -20 replies
12/27r-o-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atimefs/inode.c+12 -80 replies
13/27r-o-bind-mounts-elevate-write-count-for-do_utimesfs/utimes.c+12 -60 replies
14/27r-o-bind-mounts-elevate-write-count-for-file_update_timefs/inode.c+12 -10 replies
15/27r-o-bind-mounts-elevate-write-count-for-link-and-symlink-callsfs/namei.c+10 -00 replies
16/27r-o-bind-mounts-elevate-write-count-for-some-ioctlsfs/ext2/ioctl.c fs/ext3/ioctl.c fs/ext4/ioctl.c +8 more+274 -1573 replies
17/27r-o-bind-mounts-elevate-write-count-opend-filesfs/file_table.c fs/namei.c fs/open.c +1 more+116 -130 replies
18/27r-o-bind-mounts-elevate-write-count-over-calls-to-vfs_renamefs/namei.c fs/nfsd/vfs.c+15 -40 replies
19/27r-o-bind-mounts-elevate-writer-count-for-chown-and-friendsfs/open.c+30 -90 replies
20/27r-o-bind-mounts-elevate-writer-count-for-do_sys_truncatefs/open.c+8 -60 replies
21/27r-o-bind-mounts-make-access-use-mnt-checkfs/open.c+11 -20 replies
22/27r-o-bind-mounts-nfs-check-mnt-instead-of-superblock-directlyfs/nfs/dir.c fs/nfsd/vfs.c+4 -30 replies
23/27r-o-bind-mounts-sys_mknodat-elevate-write-count-for-vfs_mknod-createfs/namei.c fs/nfsd/vfs.c net/unix/af_unix.c+40 -110 replies
24/27r-o-bind-mounts-track-number-of-mount-writersfs/namespace.c include/linux/mount.h+198 -150 replies
25/27r-o-bind-mounts-track-number-of-mount-writers-make-lockdep-happy-with-r-o-bind-mountsfs/namespace.c+2 -01 reply
26/27r-o-bind-mounts-honor-r-w-changes-at-do_remount-timefs/namespace.c include/linux/mount.h+40 -70 replies
27/27keep track of mnt_writer state of struct filefs/file_table.c fs/open.c include/linux/fs.h+36 -30 replies

Reviews trailers per patch

16 of 27 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigSerge Hallyn
1/27
2/27
3/27
4/27
5/27
6/27A-b
7/27A-b A-b
8/27A-b
9/27A-b
10/27A-b
11/27
12/27A-b
13/27A-b
14/27A-b
15/27A-b
16/27A-b
17/27
18/27A-b
19/27A-b
20/27A-b
21/27A-b
22/27A-b
23/27A-b
24/27
25/27
26/27
27/27

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

Read the v1 thread

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

This is against 2.6.24-rc1 + recent git.

I've integrated all of the fixes from mm, and included cleanups in a different order. This also includes some extra fput-time checking to ensure that we have balanced mount writer counts.

These replace the patches in -mm mostly because the new fixes require some cleanups that are functionally independent from the r/o bind mount code itself. These fixes precent the rest of the set and require some by hand merging.

If you're going to review one and only one patch, 17/27 (the one for "opend" files) is the most critical.

---

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.