On Fri, Jan 19, 2007 at 04:08:35PM +0530, Bharata B Rao wrote:
> Hi,
> 
> I was using unionfs from 2620rc4mm1. I am slightly confused about the
> copyup semantics.
> 
> I have two directories dir1 and dir2
> dir1/ contains a file file1
> dir2/ contains a file file2
> While the directories have permissions drwxr-xr-x, the files in them
> have the permissions -rw-r--r--
> 
> I union mount dir1 and dir2 using the command:
> mount -t unionfs -o dirs=dir1:dir2 none union/
> 
> When I write into file2 (which belongs to lower layer) from the union
> mounted directory, I have observed the following:
> 
> 1. If I do 'echo xxxx > union/file2', write succeeds and there is no
> copyup. After unmount, I can see the file2 actually modified under
> dir2/

Makes sense.

> 2. If I write something to union/file2 using vi editor, the file is
> copied up to dir1/ and a whiteout is created in dir2/

Also makes sense.

vim (and I presume vi) creates backup files whenever you save. Generally,
something like this happens when you save a file:

- rename foo foo~
- create foo
- write contents to foo
- close foo
- if all succeeded and we're supposed to keep backups only during the write
  (see :help backup), unlink foo~

The creation takes place in dir1, and that's why you see the file there.

> 3. If I open(2) union/file2 and write(2) to it from an application,
> the write succeeds and no copyup occurs. After unmount, I can see the
> file2 modified(written) in dir2/
> 
> In all the 3 cases above, I am basically writing to a file in lower
> layer. While in cases 1 and 3, there is no copyup, there is a copyup
> in case2.

The "copyup" you see is actually vim copying the contents.

Thanks for trying the -mm code!

Jeff.

-- 
We have joy, we have fun, we have Linux on a Sun...
_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to