* Re: Symlink indirection [not found] ` <fa.cnblikv.qjmuqd@ifi.uio.no> @ 2002-12-15 7:24 ` junkio 2002-12-15 12:17 ` Andrew Walrond 0 siblings, 1 reply; 4+ messages in thread From: junkio @ 2002-12-15 7:24 UTC (permalink / raw) To: Andrew Walrond; +Cc: linux-kernel "AW" == Andrew Walrond <andrew@walrond.org> gives an example of a/{x,y,z}, b/{y,z}, c/z mounted on d/. in that order, later mounts covering the earlier ones. AW> echo "d/w" > d/w would create a new file in directory a. Personally I'd rather expect this to happen in c/. Imagine a/ being on read-only medium like CD-ROM containing bunch of source files, b/ to hold patched source, and c/ to hold binaries resulting from compilation. That is, rm -fr a b c d mkdir a b c d mount /cdrom a mount --bind a d mount --bind --overlay b d (cd b && bzip2 -d <../patch-2.9.91.bz2 | patch -p1) mount --bind --overlay c d (cd c && make mrproper && cat ../.config >.config && make oldconfig && make dep && make bzImage) Back to your example; what do you wish to happen when we do this? $ mv d/z d/zz && test -f d/z && cat d/z Here we rename d/z (which is really c/z) to zz. Does this reveal z that used to be hidden by that, namely b/z, and "cat d/z" now shows "b/z"? Or just like the case of creating a new file, does the union "remember" the fact that the directory "d" should not contain "z" anymore, and "test -f d/z" fails? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Symlink indirection 2002-12-15 7:24 ` Symlink indirection junkio @ 2002-12-15 12:17 ` Andrew Walrond 2002-12-15 12:58 ` John Bradford 0 siblings, 1 reply; 4+ messages in thread From: Andrew Walrond @ 2002-12-15 12:17 UTC (permalink / raw) To: junkio; +Cc: linux-kernel junkio@cox.net wrote: > "AW" == Andrew Walrond <andrew@walrond.org> gives an example of > a/{x,y,z}, b/{y,z}, c/z mounted on d/. in that order, later > mounts covering the earlier ones. > > AW> echo "d/w" > d/w would create a new file in directory a. > > Personally I'd rather expect this to happen in c/. Imagine a/ > being on read-only medium like CD-ROM containing bunch of source > files, b/ to hold patched source, and c/ to hold binaries > resulting from compilation. That is, > > rm -fr a b c d > mkdir a b c d > mount /cdrom a > mount --bind a d > mount --bind --overlay b d > (cd b && bzip2 -d <../patch-2.9.91.bz2 | patch -p1) > mount --bind --overlay c d > (cd c && make mrproper && cat ../.config >.config && > make oldconfig && make dep && make bzImage) A nice example. Lets ditch --overlay and replace it with: --transparent just like --overlay --read-transparent a bit like a pane of glass. You can see stuff behind it (read) but throw a tomato at it and it sticks to the glass (write) Then, simplifying your example a bit, we can mount the source cd then mount a directory --read-transparent over the top to hold both our patched source and compiled binaries. Or if you want to keep patched-source and binaries seperate, mount /cdrom stuff mount --bind --read-transparent patched-src stuff cd stuff patch the src mount --bind --read-transparent binaries stuff compile your code > > Back to your example; what do you wish to happen when we do > this? > > $ mv d/z d/zz && test -f d/z && cat d/z > > Here we rename d/z (which is really c/z) to zz. Does this > reveal z that used to be hidden by that, namely b/z, and "cat > d/z" now shows "b/z"? Yes - exactly > > Or just like the case of creating a new file, does the union > "remember" the fact that the directory "d" should not contain > "z" anymore, and "test -f d/z" fails? > No. Thats not necessary. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Symlink indirection 2002-12-15 12:17 ` Andrew Walrond @ 2002-12-15 12:58 ` John Bradford 2002-12-15 14:03 ` Union mounts John Bradford 0 siblings, 1 reply; 4+ messages in thread From: John Bradford @ 2002-12-15 12:58 UTC (permalink / raw) To: Andrew Walrond; +Cc: junkio, linux-kernel > > "AW" == Andrew Walrond <andrew@walrond.org> gives an example of > > a/{x,y,z}, b/{y,z}, c/z mounted on d/. in that order, later > > mounts covering the earlier ones. > > > > AW> echo "d/w" > d/w would create a new file in directory a. I disagree. It should create it in directory d, even though that is the mount point. A union mount should include files from another directory, but writes should go to the actual named directory. > > Back to your example; what do you wish to happen when we do > > this? > > > > $ mv d/z d/zz && test -f d/z && cat d/z > > > > Here we rename d/z (which is really c/z) to zz. Does this > > reveal z that used to be hidden by that, namely b/z, and "cat > > d/z" now shows "b/z"? > > Yes - exactly Union mounts should be read only. If read-write union mounts are needed, I don't think that we should implement them significantly differently to the way they work in BSD. John. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Union mounts 2002-12-15 12:58 ` John Bradford @ 2002-12-15 14:03 ` John Bradford 0 siblings, 0 replies; 4+ messages in thread From: John Bradford @ 2002-12-15 14:03 UTC (permalink / raw) To: linux-kernel; +Cc: junkio, andrew > I disagree. It should create it in directory d, even though that is > the mount point. > > A union mount should include files from another directory, but writes > should go to the actual named directory. > > Union mounts should be read only. > > If read-write union mounts are needed, I don't think that we should > implement them significantly differently to the way they work in BSD. That wasn't very well explained, what I mean is this: Example: # cd / # mkdir foo # mount -o union /dev/hda2 /foo # echo foobar > foo/bar # umount /dev/hda2 # cat foo/bar foobar That's what I would consider to be the most useful way to implement union mounts - the contents of /dev/hda2 would be accessible, read-only, at /foo/bar, with files that already exist in /foo/bar replacing files that would otherwise be visible from /dev/hda2. Writes would go to the directory foo, which is just an ordinary subdirectory of the root filesystem. This is completely different to the mount_union behavior in BSD, where writes go to the most recently added union mount. However, it might be best to implement things the BSD way for compatibility reasons, but I'm not sure how widespread the use of mount_union is. It's probably not widely used. John. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-12-15 13:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <fa.eib7vkv.1tju08k@ifi.uio.no>
[not found] ` <fa.cnblikv.qjmuqd@ifi.uio.no>
2002-12-15 7:24 ` Symlink indirection junkio
2002-12-15 12:17 ` Andrew Walrond
2002-12-15 12:58 ` John Bradford
2002-12-15 14:03 ` Union mounts John Bradford
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.