"killtime" parameter patch ?

Stefan (metze) Metzmacher metze at samba.org
Wed May 16 00:55:39 MDT 2012


Am 16.05.2012 02:23, schrieb Jeremy Allison:
> Interesting situation just came up (original guilty party who
> raised the issue deleted :-).
> 
> Testing a Samba server for reliability. Connected Windows client
> with open files.
> 
> Ethernet cable gets unplugged for a few minutes, client IO fails,
> then it gets reconnected.
> 
> Client reconnects to Samba, gets a new smbd but finds its open files
> still locked.
> 
> "deadtime" doesn't fire because the smbd still has resources open.
> 
> Original smbd is still hanging around so sharemode detection finds
> an open process.
> 
> If the files are oplocked oplock break send will get a TCP reset
> and cause the original smbd to die, but what if the oplock was already
> broken ?
> 
> In that case a "FILE_SHARE_NONE" blocks everything for as long as
> the original smbd is still around.
> 
> Client has no way to signal original server smbd process that it
> should die.
> 
> TCP timeouts will kill after 2 hours but this is considered *way*
> too long for client to wait. "reset on zero vc" isn't set due to
> potential NAT issues.
> 
> So here is an (untested, but compiles and I think it'll do the job)
> solution. Parameter "killtime" (set in minutes). If nothing received
> on a TCP connection (including no SMBecho calls) for "killtime"
> minutes, it causes the smbd to commit suicide (even with open
> resources). Cleanly of course :-).
> 
> Thoughts on whether this is a good idea ? If so I'll write up the
> man page :-).

This is the wrong fix for SMB2.

What we need for SMB2 is the usage of the previous_session_id in
the session setup. I have the code mostly working in my WIP branch
https://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master3-reauth

The commit is
https://gitweb.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=f91aec92ec9418dc2521bb68e5c3635c4fc9a304
(Note I need to make this full async before pushing it to master)

For SMB1 it might be better to use TCP keepalives,

"socket options" supports "SO_KEEPALIVE", "TCP_KEEPCNT",
"TCP_KEEPIDLE" and "TCP_KEEPINTVL".

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20120516/ba497387/attachment.pgp>


More information about the samba-technical mailing list