Mount writer count API (read-only bind mounts prep)
Get series with b4
b4 am 20070712001710.654CD9ED@kernelVersions newest first
- v1 Latest23 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/23 | rearrange may_open() to be r/o friendlyfs/ | +9 | 0 replies | |
| 2/23 | create cleanup helper svc_msnfs()fs/ | +11 | 0 replies | |
| 3/23 | filesystem helpers for custom 'struct file'sfs/ fs/ fs/ +5 more | +78 | 0 replies | |
| 4/23 | r/o bind mounts: stub functionsfs/ include/ | +49 | 0 replies | |
| 5/23 | elevate write count open()'d filesfs/ fs/ ipc/ | +27 | 0 replies | |
| 6/23 | r/o bind mounts: elevate write count for some ioctlsfs/ fs/ fs/ +8 more | +272 | 0 replies | |
| 7/23 | elevate writer count for chown and friendsfs/ | +30 | 0 replies | |
| 8/23 | make access() use mnt checkfs/ | +11 | 0 replies | |
| 9/23 | elevate mnt writers for callers of vfs_mkdir()fs/ fs/ | +9 | 0 replies | |
| 10/23 | elevate write count during entire ncp_ioctl()fs/ | +54 | 0 replies | |
| 11/23 | elevate write count for link and symlink callsfs/ | +10 | 0 replies | |
| 12/23 | elevate mount count for extended attributesfs/ fs/ | +20 | 0 replies | |
| 13/23 | elevate write count for file_update_time()fs/ | +12 | 0 replies | |
| 14/23 | mount_is_safe(): add commentfs/ | +4 | 0 replies | |
| 15/23 | unix_find_other() elevate write count for touch_atime()net/ | +12 | 0 replies | |
| 16/23 | elevate write count over calls to vfs_rename()fs/ fs/ | +15 | 0 replies | |
| 17/23 | nfs: check mnt instead of superblock directlyfs/ fs/ | +4 | 0 replies | |
| 18/23 | elevate writer count for do_sys_truncate()fs/ | +9 | 0 replies | |
| 19/23 | elevate write count for do_utimes()fs/ | +9 | 0 replies | |
| 20/23 | elevate write count for do_sys_utime() and touch_atime()fs/ | +12 | 0 replies | |
| 21/23 | sys_mknodat(): elevate write count for vfs_mknod/create()fs/ fs/ net/ | +29 | 0 replies | |
| 22/23 | elevate mnt writers for vfs_unlink() callersfs/ ipc/ | +8 | 0 replies | |
| 23/23 | do_rmdir(): elevate write countfs/ | +5 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/23] Mount writer count API (read-only bind mounts prep)
The most contentious part of the r/o bind mount patches is actually implementing the count tracking. It has NUMA and SMP implications, and is going to need to have a whole discussion on that one patch.
These patches, on the other hand, simply introduce a new
API: mnt_want_write() and mnt_drop_write(). They do not functionally change the kernel, just alter the way in which we check filesystems for our ability to write to them.
These functions should be used in place of IS_RDONLY(inode) as they explicitly spell out when a mount is expected to _stay_ r/w instead of simply checking at a single point in time.
It should take a very small number (like 3) of small patches to actually implement read-only bind mounts on top of this new API.
These apply to current -git (as of July 11th, 2007).
---
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.