nnull

Csaba Henk csaba.henk at creo.hu
Mon Jan 2 13:12:38 PST 2006


On 2006-01-02, Matthew Dillon <dillon at xxxxxxxxxxxxxxxxxxxx> wrote:
>     What a nice Christmas present!  I was hoping someone would come along
>     and rewrite nullfs!

It's good to hear that there is someone who thinks this day is still fine
as Christmas, as I have a nice pile of unanswered Xmas greetings :)

>     There is one issue with regards to overlayed namecache entries.
>     The issue occurs when you try to do a rename() or other namespace 
>     operation and you have multiple namecache records refering to the
>     same physical namespace.  Since rename() locks the namespace by locking
>     the related namecache records, it becomes possible for a namespace
>     operation in the nullfs layer to race a namespace operation in the
>     underlying filesystem layer.  The system probably wouldn't be too happy
>     when this happens.

Hm, I played a little bit with this. Here is a little test:

$ { cat flipflop.py; echo EOF; }
import os, sys

def flipflop(a, b):
   while True:
       try:
           os.rename(a, b)
           print os.path.basename(os.getcwd()), a, b
       except OSError: pass

a, b = sys.argv[3:]

for dir in sys.argv[1:3]:
    for x,y in ((a,b), (b,a)):
        if os.fork() == 0:
           os.chdir(dir)
           flipflop(x, y)
EOF
$ mkdir A B
$ > A/a
$ mount_null A B
$ python2.4 flipflop.py A B a b

As of now, the effect not fatal... rather funny: after a while the dir(s) end
up empty.

Csaba





More information about the Kernel mailing list