Fredrik Lundh wrote:
os.link(tempfile, lockfile) # atomic!
Fredrik, thanks for replying - I monitored python-list but didn't see
anything. Gotta get a proper Usenet feed...
Are you sure os.link() will be atomic over NFS?
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the reply; I somehow missed this entire thread in
python-list. I'm going to give it a whirl, after digging a bit into
the status quo of Linux' NFSv3 implementation.
--
http://mail.python.org/mailman/listinfo/python-list
Christopher DeMarco wrote:
Hi all...
...I've got a Python script running on a bunch of boxen sharing some
common NFS-exported space. I need (not want :) to lock files for
writing, and I need (not want :) to do it safely (i.e. atomically).
I'm doing this in Linux; NFS4 is available. As I
Christopher DeMarco wrote:
2. open(2) is atomic on a local FS, I've read discussions that imply
that link(2) is atomic over NFS (is it?), so I can link from local
lockfile to remote target atomically. I don't grok this; open(2) +
link(2) + stat(2) == 3 calls on my fingers. HTH is this
Fredrik Lundh wrote:
5) check the number of links to each file
n = os.stat(tempfile)[3]
m = os.stat(lockfile)[3]
aw, forget that. I shouldn't trust google over my own code. here's the
correct algorithm:
f = open(tempfile, w)
f.close()
n = os.stat(tempfile)[3]
Hi all...
...I've got a Python script running on a bunch of boxen sharing some
common NFS-exported space. I need (not want :) to lock files for
writing, and I need (not want :) to do it safely (i.e. atomically).
I'm doing this in Linux; NFS4 is available. As I understand it, my
options are:
1.