Alternate approaches to lock/dead-client problem.

Nicolas Williams Nicolas.Williams at
Tue Jan 26 20:23:08 GMT 1999

On Tue, Jan 26, 1999 at 03:00:51PM -0500, David Collier-Brown wrote:
> Nicolas Williams wrote:
> > But the question is: is it correct to assume that an SMB session over
> > TCP is abandoned when a new connection with the same parameters is
> > opened to the server?
> 	It is in a sort of insane sense: the CIFS spec claims
> 	so, but no-one will admit to actually doing such a 
> 	dumb thing (:-))

I guess I have... :)

> 	Any multi-user client can make connections to a server
> 	on behalf of different users.  Right now I have a connection
> 	and another process on my box has a connection.  I'd be
> 	seriously annoyed if the server dropped me when the
> 	script started.

Well, remember, my check for determining duplicate connections is based
on the following tuple:

{client IP address, server name, share name, username}

It would probably be better to use the server's NetBIOS name (the one
the client used). As for the username, I'd use the username that smbd is
using (i.e., the username after username mapping).

This pretty much identifies each connection uniquely, I hope. At least
it would allow one to distinguish between two mounts of the same share,
from the same server, on the same client, but as different users.

But if the CIFS docs say it's ok to make the assumption I'd like to
make, what the hell! :)

How does NT server handle such situations??

> 	The sufficient condition is
> 		user x from client y has locked file z &&
> 		client z has crashed and resumed &&
> 		user x from client y wants file z
> 	I was working to order this so the minimum number
> 	of checks occur in a known time-critical path.
> 	By mostly gut feel I proposed this ordering:
> 		whenever user x from client y wants file z	1
> 		&& file z is locked				2
> 		&& user x from client y has locked file z	3
> 		&& client z has crashed				4
> 	in the hopes that the check of line 3 could be decomposed
> 	into 
> 		&& lock is from the same host 			3a
> 		&& user x has locked file z			3b
> 	so I could bail out of the checking at step 3b, 
> 	before getting into expensive operations in step 4.

Yes, yes. I'd like to see Samba implement that kind of logic. It seems
to me that this would be quite some feature to add, but go ahead. I'd
like it.

For now I'm just happy to know that our workaround is sane.

> --dave
> -- 
> David Collier-Brown,  | Always do right. This will gratify some people
> 185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
> Willowdale, Ontario   |
> Work: (905) 477-0437 Home: (416) 223-8968 Email: davecb at



More information about the samba-technical mailing list