Bind Mount Extensions 0.04
PATCH 1/1 Bind Mount Extensions 0.04
Greetings!
The following patch extends the 'noatime', 'nodiratime' and last but not least the 'ro' (read only) mount option to the vfs --bind mounts, allowing them to behave like any other mount, by honoring those mount flags (which are silently ignored by the current implementation)
an older version of this patch was included in 2.6.0-test6-mm2, and it is currently used by several people, without any issues, so I'd kindly request to consider it for inclusion into mainline.
if the size of the patch is an issue, I can break it down into three parts, one preparing the existing structures, one adding noatime/nodiratime and one doing the read only stuff.
the patch makes the following syscalls behave like expected
- open (read/write/trunc), create
- link, symlink, unlink
- mknod (reg/block/char/fifo), mkfifo
- mkdir, rmdir
- (f)chown, (f)chmod, utime
- access, truncate, mmap
- ioctl (gen/ext2/ext3/reiser)
the following cases where verified for --bind ro (test tool) and showed no difference to a 'real' ro mounted filesystem:
- open()
- O_RDONLY: file, dir, symlink, broken, cdev, bdev, fifo, new
- O_WRONLY: file, dir, symlink, broken, cdev, bdev, fifo, new
- O_RDWR: file, dir, symlink, broken, cdev, bdev, fifo, new
- O_CREAT: file
- mkdir() dir, new, invalid
- mkfifo() fifo, new, invalid
- mknod()
- S_IFREG: file, new, invalid
- S_IFCHR: cdev, new, invalid
- S_IFBLK: bdev, new, invalid
- S_IFIFO: fifo, new, invalid
- chown() file, invalid - fchown() file
- chmod() file, invalid - fchmod() file
- link() file/file, file/invalid, invalid/file
- symlink() file/file, file/invalid, invalid/file
- rename() file/file, file/invalid, invalid/file
- rmdir() dir, new, invalid
- truncate() file, new invalid - ftruncate() file
- unlink() file, bdev, cdev, fifo, new, invalid
you can download them here, if you prefer that over extracting them from emails ...
http://www.13thfloor.at/patches/
TIA,
Herbert
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Willy Tarreau
Hi Herbert,
Quoted 3 lines · Herbert Poetzl
an older version of this patch was included in 2.6.0-test6-mm2, and it is currently used by several people, without any issues, so I'd kindly request to consider it for inclusion into mainline.
Quoted 5 lines
I have tested 0.03 on 2.4.25 + some other patches, and discovered something annoying : an attempt to change something on the R/O FS marked the parent FS busy. But I cannot say for sure that it was a problem with your patch, because that kernel had several others. I'll try to reproduce on a naked kernel. To reproduce it, you can try this :
it _was_ an issue with 0.03 on 2.4.25 (see changelog)
Quoted 8 lines
# mount /dev/hdaXX /mnt/disk # mount -r --bind /mnt/disk /mnt/ro # touch /mnt/ro/foo Read-only file-system (that's what was expected) # umount /mnt/ro (I don't remember if the problem already arises here) # umount /mnt/disk device is busy
this has been fixed in 0.04 for 2.4.25, if you need the fix to include for 0.03 (for whatever reason) here is the relevant hunk ..
fs/namei.c 2004-03-10 12:18:35.000000000 +0100 renamed from fs/namei.c 2004-03-10 14:45:36.000000000 +0100 +1 -1
@@ -1045,7 +1045,7 @@ int open_namei(const char * pathname, in return error; error = -EROFS; if (MNT_IS_RDONLY(nd->mnt)) - return error; + goto exit; /* * We have the parent and last component. First of all, check
Quoted 1 line
Other than that, this feature is really excellent !
thanks for using it ...
Quoted 2 lines
Thanks,
Willy
Hi Herbert,
Quoted 9 lines · Herbert Poetzl
Quoted 8 lines
# mount /dev/hdaXX /mnt/disk # mount -r --bind /mnt/disk /mnt/ro # touch /mnt/ro/foo Read-only file-system (that's what was expected) # umount /mnt/ro (I don't remember if the problem already arises here) # umount /mnt/disk device is busy
Quoted 3 lines
this has been fixed in 0.04 for 2.4.25, if you need the fix to include for 0.03 (for whatever reason) here is the relevant hunk ..
I can confirm that it now works perfectly, as expected.
Thank you very much,
Willy