Skip to content

Mount writer count and read-only bind mounts

Dave Hansen linux-fsdevel 1 version In review

Get series with b4
b4 am 20070622200303.82D9CC3A@kernel

Versions newest first

  1. v1 Latest26 patches 56 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/26document nlink functioninclude/linux/fs.h+27 -01 reply
2/26ext3: remove extra IS_RDONLY() checkfs/ext3/inode.c+1 -11 reply
3/26ext4: remove extra IS_RDONLY() checkfs/ext4/inode.c+1 -11 reply
4/26filesystem helpers for custom 'struct file'sfs/configfs/dir.c fs/file_table.c fs/hugetlbfs/inode.c +6 more+81 -517 replies
5/26r/o bind mounts: stub functionsfs/namespace.c include/linux/mount.h+26 -03 replies
6/26elevate write count open()'d filesfs/file_table.c fs/namei.c ipc/mqueue.c+27 -52 replies
7/26r/o bind mounts: elevate write count for some ioctlsfs/ext2/ioctl.c fs/ext3/ioctl.c fs/ext4/ioctl.c +8 more+272 -1561 reply
8/26elevate writer count for chown and friendsfs/open.c+30 -91 reply
9/26make access() use mnt checkfs/open.c+1 -15 replies
10/26elevate mnt writers for callers of vfs_mkdir()fs/namei.c fs/nfsd/nfs4recover.c+9 -01 reply
11/26elevate write count during entire ncp_ioctl()fs/ncpfs/ioctl.c+54 -10 replies
12/26elevate write count for link and symlink callsfs/namei.c+10 -00 replies
13/26elevate mount count for extended attributesfs/nfsd/nfs4proc.c fs/xattr.c+20 -30 replies
14/26elevate write count for file_update_time()fs/inode.c+6 -14 replies
15/26mount_is_safe(): add commentfs/namespace.c+4 -02 replies
16/26unix_find_other() elevate write count for touch_atime()net/unix/af_unix.c+12 -41 reply
17/26elevate write count over calls to vfs_rename()fs/namei.c fs/nfsd/vfs.c+23 -41 reply
18/26nfs: check mnt instead of superblock directlyfs/nfs/dir.c fs/nfsd/vfs.c+4 -31 reply
19/26elevate writer count for do_sys_truncate()fs/open.c+9 -71 reply
20/26elevate write count for do_utimes()fs/utimes.c+16 -111 reply
21/26elevate write count for do_sys_utime() and touch_atime()fs/inode.c+12 -81 reply
22/26sys_mknodat(): elevate write count for vfs_mknod/create()fs/namei.c fs/nfsd/vfs.c net/unix/af_unix.c+22 -29 replies
23/26elevate mnt writers for vfs_unlink() callersfs/namei.c ipc/mqueue.c+8 -11 reply
24/26do_rmdir(): elevate write countfs/namei.c+5 -01 reply
25/26r/o bind mounts: scalable writer countfs/namei.c fs/namespace.c include/linux/mount.h+150 -56 replies
26/26honor r/w changes at do_remount() timefs/namespace.c include/linux/mount.h+40 -71 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/26] Mount writer count and read-only bind mounts

The largest change from last time is in patch 25/26. It has been reworked to use per-cpu lock instead of a per-node one. See the patch for more details.

I would also appreciate any close review of patch 08/27. It touches a lot of code, and I'm a bit worried that a buglet or two could have snuck in there.

Note that there are a few stragglers left using IS_RDONLY() in reiser4 and in some other low-level filesystem code. The reiser4 asserts should be just fine left the way they are, plus reiser4 needs quite a bit of work before merging anyway. The ntfs usage appears to be internal, and not related to user activity.

This patch survives running ltp as well as a home-grown set of filesystem operations here:

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

---

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.