Skip to content

Read-only bind mounts

Dave Hansen linux-xfs lkml 1 version In review

Get series with b4
b4 am 20070920195249.852667D5@kernel

Versions newest first

  1. v1 Latest25 patches 21 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/25filesystem helpers for custom 'struct file'sfs/configfs/dir.c fs/file_table.c fs/hugetlbfs/inode.c +5 more+104 -490 replies
2/25rearrange may_open() to be r/o friendlyfs/namei.c+4 -40 replies
3/25give may_open() a local 'mnt' variablefs/namei.c+5 -11 reply
4/25create cleanup helper svc_msnfs()fs/nfsd/vfs.c+11 -40 replies
5/25r/o bind mounts: stub functionsfs/namespace.c include/linux/mount.h+57 -00 replies
6/25elevate write count open()'d filesfs/file_table.c fs/namei.c ipc/mqueue.c+27 -52 replies
7/25r/o bind mounts: elevate write count for some ioctlsfs/ext2/ioctl.c fs/ext3/ioctl.c fs/ext4/ioctl.c +8 more+274 -1576 replies
8/25elevate writer count for chown and friendsfs/open.c+30 -90 replies
9/25make access() use mnt checkfs/open.c+11 -20 replies
10/25elevate mnt writers for callers of vfs_mkdir()fs/namei.c fs/nfsd/nfs4recover.c+9 -00 replies
11/25elevate write count during entire ncp_ioctl()fs/ncpfs/ioctl.c+53 -10 replies
12/25elevate write count for link and symlink callsfs/namei.c+10 -00 replies
13/25elevate mount count for extended attributesfs/nfsd/nfs4proc.c fs/xattr.c+20 -30 replies
14/25elevate write count for file_update_time()fs/inode.c+12 -10 replies
15/25unix_find_other() elevate write count for touch_atime()net/unix/af_unix.c+12 -40 replies
16/25elevate write count over calls to vfs_rename()fs/namei.c fs/nfsd/vfs.c+15 -40 replies
17/25nfs: check mnt instead of superblock directlyfs/nfs/dir.c fs/nfsd/vfs.c+4 -30 replies
18/25elevate writer count for do_sys_truncate()fs/open.c+8 -60 replies
19/25elevate write count for do_utimes()fs/utimes.c+9 -60 replies
20/25elevate write count for do_sys_utime() and touch_atime()fs/inode.c+12 -80 replies
21/25sys_mknodat(): elevate write count for vfs_mknod/create()fs/namei.c fs/nfsd/vfs.c net/unix/af_unix.c+29 -110 replies
22/25elevate mnt writers for vfs_unlink() callersfs/namei.c ipc/mqueue.c+8 -10 replies
23/25do_rmdir(): elevate write countfs/namei.c+5 -00 replies
24/25r/o bind mounts: track number of mount writersfs/namespace.c include/linux/mount.h+198 -1513 replies
25/25honor r/w changes at do_remount() timefs/namespace.c include/linux/mount.h+40 -70 replies

Reviews trailers per patch

18 of 25 patches have a Reviewed-by or Acked-by.

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

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/25] Read-only bind mounts

This is against 2.6.23-rc6. Compared to 2.6.23-rc6-mm1, there are a few (trivial) merge conflicts with the audit git tree, and one slightly more complicated one with ext2-reservations.patch.

Changes from last post:
- added several kerneldoc comments for exported functions
- broke out the 'mnt' variable patch
- removed WARN_ON() in ioctl patch

The first four patches here are very simple cleanups, and can go in ahead of the rest of the patches.

If you are reviewing this, the things that need the most review are the last two patches that actually add the logic for tracking mount write counts.

---

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.