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

Re: shadowfs



On Sun, May 14, 2000 at 11:28:46AM +0300, Kalle Olavi Niemitalo wrote:
> Tomasz Wegrzanowski <maniek@beer.com> writes:
> 
> > They can be faked by shadowfs, with content scaned on demand as of other dirs
> > and maybe cached until notified of directory change
> >     (on notify not to rescan, only to invalidate cache)
> 
> So, for each open directory, the shadowfs would remember the
> steps taken to get there?  That could work.
> 
> If the user:
> 
> 1. makes a directory ~/1 and a shadowfs ~/shadow which uses it
> 2. makes a directory ~/1/foo
> 3. changes directory to ~/shadowfs/foo
> 4. renames ~/1/foo to ~/1/bar
> 5. ls
> 
> then the shadowfs tries to find ~/1/foo, and because it doesn't
> exist, the user gets ENOENT.  This sounds reasonable.
> 
> If the user then makes another directory ~/1/foo, the current
> directory starts referring to that instead, and ls works again.
> 
> ENOENT on missing directories isn't the only possible way: the
> shadowfs could instead give the user an empty (except . and ..)
> directory so that he can at least "cd ..".  Would that be better?

ENOENT seems ok.
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 ?

One solution is to block ~/1/foo/bar when ~/shadow/foo/bar
is opened and return EBUSY on unlink(2)
This seems a bit harder, and if :

5. create ~/2/foo

is okay again to delete ~/1/foo/bar if we accept giving empty dir,
but shadowfs don't know it yet

6. create ~/2/foo/bar

is okay again to delete ~/1/foo/bar
but shadowfs don't know it yet

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.



Reply to: