After the 2.8.10 release ...
"This version fixes a critical locking bug in Unix.  It turns out
that any call to close() clears all locks on file that was closed
(who knew?) which then left the database vulnerable to corruption
from other processes.  That bug has been cleared by embargoing
all close() calls until all locks of been released."

I have made some investigation...

From "Advanced Programming in the UNIX Environment" by R. Stevens:

Section 3.5 on page 51 "close Function": ... Closing a file also releases any locks that the process may have on the file.

Section 12.3 on page 373 "Implied Inheritance ad Release of Locks":
...
Locks are associated with a process and a file. This has two implications. The first is obvious: when a process terminate all its locks are released. The second is far from obvious: whenever a descriptor is closed, any locks on the file referenced by that descriptor for that process are released. This means that if we do the following four steps:


fd1 = open(pathname, ...);
read_lock(fd1, ...);
fd2 = dup(fd1);
close (fd2);

after the close (fd2) the lock that was obtained on fd1 is released. The same thing would happen if we replaced the dup with open, as in:

fd1 = open(pathname, ...);
read_lock(fd1, ...);
fd2 = open(pathname, ...);
close (fd2);

to open the same file on another descriptor.

Hope this can help to better understand this not very know "bug".

Regards,
Marco Bambini


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to