[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fuse-devel
Subject:    [fuse-devel] filesystem guarantees for multi-threaded access
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2011-10-02 18:28:14
Message-ID: 20111002182814.GA29982 () space ! twc ! de
[Download RAW message or body]

   Hi!

I wonder what guarantees a filesystem has to give when more than one thread is
involved. For instance, if thread 1 and thread 2 access the same file, and

  thread 1 - writes ("thread 1") to file foo
  thread 2 - writes ("thread 2") to file foo, a tiny bit later

does a filesystem have to guarantee that the file foo contains "thread 2" after
this?

Because currently, I have this implementation of write in my fuse filesystem:

{
  get_write_lock()
  write_data()
  release_write_lock()
}

Now if the write lock is unavailable (if somebody else is writing), then both,
thread 1 and thread 2 will wait for the lock. Then, eventually the write lock
becomes available, so both threads are notified that the write lock is free.

It could happen that thread 2 gets it before thread 1 and the file will then
contain "thread 1". The same could happen if thread 2 would want to read the
file after thread 1, and in many other cases.

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic