[Gluster-devel] posix-locks problem
Kevan Benson
kbenson at a-1networks.com
Mon Oct 22 16:05:58 UTC 2007
Vincent Régnard wrote:
> Using this latter script reveals that locking is working fine :)). Using
> my program properly also works. I was actually removing the lock file
> when it was locked by another instance ! So my programm was misbehaving
> after that. But the question is "why is it possible to remove a file
> when it is locked?". I can imagine the answer is that system call is not
> the same. Should'nt glusterfs translator forbid or delay unlink() on a
> file when it knows a file is locked ?
File locking is advisory unless you set specific bits in the file mode.
That is, programs will only wait on a previously locked file if they
attempt to lock it themselves. Because of this, advisory locking
requires all accessing programs to correctly try to obtain a lock on the
file. Any program that accesses the file that doesn't attempt to obtain
a lock can do anything with the file without honoring, or even knowing
about any existing locks. In this case, your manual removal of the lock
file acted as the misbehaving program.
In summary, it's not a fuse or glusterfs problem, it's just how locking
works.
--
-Kevan Benson
-A-1 Networks
More information about the Gluster-devel
mailing list