Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
opening a file for read-write?
opening a file for read-only with atime enabled? (after all the atime updates need to go somewhere)
opening a file for read-only with noatime?
I can see times when each of these would be desirable
Unifying filesystems with union mounts
Posted Dec 28, 2008 22:21 UTC (Sun) by AnswerGuy (guest, #1256)
It's interesting to ask if it's possible to specify noatime on some layers and not on others. I see no reason it shouldn't be possible.
I would hope that the open for read-write or read-only or append would only *mark* the file for copy-up. Any subsequent write() on that file descriptor should trigger the actual copying.
The ugly bits are the -EXDEV (directory renames triggering the need for whole directory copies) and the "whiteout" entries. (I presume the later are technically vnodes ... inode-like structures existing only in the VFS and not written to any of the filesystems in the stack?)
Actually all of this raises interesting questions about different use cases for union file stacking. Should the removal of a file simply be an operation that only affects the top layer? Or should it drill down to all write-able layers in the stack? Should this "whiteout" persist through a umount/mount? How should the system handle cases where we are mounting filesystem in different stacks at different times. The simple use cases where we have one filesystem (CD-ROM, network read-only mount etc) are easy to imagine. Add a "magic" file on the top-level filesystem (like ext2/3's "bad-blocks" and "journals" --- files/inodes with no visible links, or like the .nfsXXXXXXXXX server files we see when files are removed on some NFS clients while still open on others; have this contain the whiteout data and any other semantics).
But what about when we want to use union filesystem stacks as a sort of transparent version control system? (Similar to the infamous MVFS/VOBS from Clearcase and other such systems). It gets messy to even define the desired semantics, much less implement them.
Posted Dec 29, 2008 0:46 UTC (Mon) by dlang (✭ supporter ✭, #313)
which either means that atime is implicitly disabled by union mounts, or the upper layer needs to store it.
I don't see how directory renames are any worse than large files that get renamed or small modifications (think logfiles for example), in both cases you have a (potentially large) disk item that needs to get copied (after all a directory is just a 'file' containing pointers to file contents). or are you saying that if a directory gets renamed all the files in that directory get copied? if so then the layering also is incompatible with hard linked files.
the other option is to extend the whiteout concept to provide a 'link' type entry as well (similar to a symlink, when file X is opened on the top layer, open file Y on lower layers)
the whiteouts (and any other modifications) definantly need to persist across mounts, otherwise the result can't be considered coherent. now if you remount with a different combination of things (or modify the underlying filesystem(s) through some other mechanism) things do get interesting.
if you want version control semantics then you probably want to use FUSE, not union mounts. if you used union mounts then for each new version you would mount another 'filesystem' on top of the stack, and each version could be accessed (read only) by other processes by mounting the appropiate layers of the stack.
the issues that you would run into here would just be efficiancy in drilling down through (potentially) many layers of the stack.
but that does bring up a question, how can you query what the stack is? If many layers have been mounted over time it may not be trivial to know how to recreate the stack for the next boot if you can't query the kernel to find out.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds