SMBClose without POSIX close()
jra at samba.org
Sun Jun 22 22:32:05 GMT 2003
On Sun, Jun 22, 2003 at 06:47:33PM +0300, Emil Rasamat wrote:
> Reading the code of fd_close_posix() I found out that when a file is closed, and there are pending locks on other fdâs the original handle is not being close()ed (by calling vfs_ops.close()), rather added to the pending_close_entries list â to be closed later (when there are no more locks pending on this file).
> The problem with this behavior is that when a file is opened from two clients (e.g. client1: rw access, client2: r access) and then closed by client1, the file is still open for rw (until the client2 will choose to close the file).
> I understand this is a kind of optimization â but I donât really understand what does it optimize? And I need the semantics to be kept (i.e. when a file is closed â it should be closed).
> Can anybody point out what I am missing?
This is by design and is due to the braindamage inherent in
POSIX locking semantics (close one fd open on a file and lose
all locks on other fd's open on the same file). We can't do
anything about it I'm afraid.
More information about the samba-technical