[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shadowfs



Tomasz Wegrzanowski <maniek@beer.com> writes:

> There is big problem with giving empty dir.
> 
> User S
> 1. creates ~/1/foo/bar
> 2. enters ~/shadow/foo/bar
> 3. deletes ~/1/foo/bar
> 4. deletes ~/1/foo
> 
> What then ?

No problem, "." and ".." are both empty directories.

> One solution is to block ~/1/foo/bar when ~/shadow/foo/bar
> is opened and return EBUSY on unlink(2)

I think you mean rmdir(2).  I don't like EBUSY here.  Unix lets
one unlink files which are being used; the same should work with
directories.

BTW, Linux allows removing the current directory but gets a bit
weird with "." and "..":

kalle@PC486:/tmp$ mkdir foo
kalle@PC486:/tmp$ cd foo
kalle@PC486:/tmp/foo$ ls -al
total 21
drwxrwxr-x    2 kalle    kalle        1024 May 15 18:08 .
drwxrwxrwt    4 root     root        19456 May 15 18:08 ..
kalle@PC486:/tmp/foo$ rmdir ../foo
kalle@PC486:/tmp/foo$ ls -al
total 0
kalle@PC486:/tmp/foo$ ls -ld . ..
drwxrwxr-x    0 kalle    kalle           0 May 15 18:08 .
drwxrwxrwt    3 root     root        19456 May 15 18:08 ..
kalle@PC486:/tmp/foo$ touch bar
touch: bar: Operation not permitted
kalle@PC486:/tmp/foo$ cd ..
kalle@PC486:/tmp$

Perhaps this means that the shadowfs empty directories can be
totally empty as well.  ;-)

> So shadowfs would have to check change_notifies from /foo/bar's of all
> subfs where it exists and last directory from path of all other subfs's
> (/foo or /), to see if one directory more hasn't been just created.

If it doesn't cache anything, it needn't watch anything.
I think you should first make a prototype without caches, and
then try how much faster it gets with caching.



Reply to: