2 questions on deadtime parameter
sandeep nag
sandeepnagamalli at gmail.com
Sun Dec 4 12:19:19 UTC 2016
I am on samba source 3.6.25 and I see the connections are not getting
released though I set
1. autoodisconnect as 1 minute on windows client
2. deadtime = 2 in smb.conf
When I debugged the issue I found that:
In conn_idle_all() function:
if (sconn->using_smb2) {
298 /* SMB2 */
299 struct smbd_smb2_session *sess;
300 for (sess = sconn->smb2.sessions.list; sess; sess = sess->next)
{
301 struct smbd_smb2_tcon *ptcon;
302
303 for (ptcon = sess->tcons.list; ptcon; ptcon = ptcon->next) {
304 time_t age;
305 connection_struct *conn = ptcon->compat_conn;
306
307 if (conn == NULL) {
308 continue;
309 }
310
311 age = t - conn->lastused;
312 /* close dirptrs on connections that are idle */
313 if (age > DPTR_IDLE_TIMEOUT) {
314 dptr_idlecnum(conn);
315 }
316
317 if (conn->num_files_open > 0 || age < deadtime) { <---
318 return false;
319 }
320 }
321 }
322 }
conn->num_files_open in line#317 is non zero.
I have two questions:
1. Is their any other parameter which I could use in conjunction with
deadtime, which has to be used, in order to get it work. any workaround?
2. In the link, https://lists.samba.org/archive/samba/2006-April/119652.html
suggested a code present in the attachment snippet.txt, should I try adding
this patch, will that lead to anyother side effect?
Thanks in advance, for your time.
Thanks,
Sandeep
-------------- next part --------------
> > In your case the reason might be that clients leave *one* spoolss-pipe
> > open, after they have opened (and closed) a connection to a printer.
> > The deadtime parameter is not working, because of this one open
> > connection.
> > BTW, this is diffrent to connections with admin rights.
> >
> > To fix this, I add the following lines to smbd/conn.c:
> > ---- start code
> > for (conn=Connections;conn;conn=next) {
> > next=conn->next;
> > /* close dirptrs on connections that are idle */
> > if ((t-conn->lastused) > DPTR_IDLE_TIMEOUT)
> > dptr_idlecnum(conn);
> > + /* force the closure, even if one spoolss is open */
> > + if (conn->num_files_open == 1 && (t-conn->lastused)>=deadtime)
> {
> > + for (plist = get_first_internal_pipe(); plist;
> > + plist = get_next_internal_pipe(plist)) {
> > + if (plist->name && !strcmp (plist->name, "spoolss")) {
> > + DEBUG(2,("Client holds one spoolss connection.
> > Deadtime reached. Closing last pipe\n"));
> > + pipe_close_conn (conn);
> > + break;
> > + }
> > + }
> > + }
> > +
> > if (conn->num_files_open > 0 ||
> > (t-conn->lastused)<deadtime)
> > allidle = False;
> > }
> > ---- end code
More information about the samba-technical
mailing list