NTVFS disconnect

tridge at samba.org tridge at samba.org
Fri Sep 1 09:36:56 GMT 2006


Murali,

 > Is there any reason why we are not doing an explicit raw tree disconnect as
 > part of the ntvfs disconnect? 

yes :-)

 > Is there any reason it may not work correctly?  I guess that was
 > the question on my mind.

the reason for using the talloc_free is that it takes account of
reference counting. Say for example this connection was being used as
part of some other functionality of the server. By doing a
talloc_free() we're saying "we don't need it any more, destroy it if
that means nobody is now using it". If we did an explicit disconnect
and somebody else was using it then it might break whatever they are
doing.

The 2nd obvious question is why don't we have a destructor on the
connection which sends a nice clean SMBtdis (tree disconnect) when we
talloc_free the connection? That would still take account of possible
reference counting, but the reason we don't do it is that the server
may not be responsive.

If the reason we are disconnecting the share is that the share has
become unresponsive due to the remote server being dead, then sitting
and waiting for a couple of minutes for a tcp level timeout on a
SMBtdis would be pretty annoying for users. If the server is
responsive then just dropping the socket does exactly the right thing
anyway (it implies a cleanup of all open resources), so sending the
SMBtdis doesn't actually gain anything, and potentially annoys
users. 

We could setup a full async disconnect and then after that is finished
then drop the socket, but its all fairly pointless, so we don't :-)

Cheers, Tridge


More information about the samba-technical mailing list