patch for HEAD and SAMBA_2_2

David Lee t.d.lee at
Tue Sep 25 10:23:03 GMT 2001

We have been hitting performance problems with 2.2.1a, especially the
"fcntl loop" problem, which causes occasional processes to gobble CPU.
By arrangement with Jeremy Allison and Gerry Carter, we are now running
SAMBA_2_2 (2.2.2-pre) as of the weekend: this is looking good w.r.t. to
fcntl problem.

But with both (2.2.1a, 2.2.2-pre) we are experiencing another problem,
which I had at first attributed to a side-effect of fcntl, but am now less

We routine run several hundred concurrent smbd processes as routine.  But
every few hours, the load average of the server (Sun E450, Solaris 8) 
will suddenly start to rise horribly: the only solution is "pkill smbd". 

This set me wondering about what a "dormant" smbd does.  We know that the
central "process.c" loop will awake every 60 seconds, regardless.  Thus
with, say, 300 smb processes, even all "doing nothing", there will be at
least 5 per second actually doing something ("in background").

The big question is:  anyone else seen this behaviour?

My modest contribution is the attached patch to eliminate some unnecessary
work which sometimes gets done "in background".  Basically, there are
occasional background calls to "reopen_logs()" in "lib/debug.c" which
do a double call of "lp_logfile()" and all that it entails.  The patch
reduces that to a single call.

The patch is against SAMBA_2_2 but almost certainly applies to HEAD too.

(I don't think it completely solves my problem, but it might help it a


:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :
-------------- next part --------------
*** debug.c.orig	Wed Jul 25 02:42:32 2001
--- debug.c	Tue Sep 25 17:45:37 2001
*** 316,323 ****
  	oldumask = umask( 022 );
  	pstrcpy(fname, debugf );
! 	if (lp_loaded() && (*lp_logfile()))
! 		pstrcpy(fname, lp_logfile());
  	pstrcpy(debugf, fname);
--- 316,329 ----
  	oldumask = umask( 022 );
  	pstrcpy(fname, debugf );
! 	if (lp_loaded()) {
! 		char *logfname;
! 		logfname = lp_logfile();
! 		if (*logfname) {
! 			pstrcpy(fname, logfname);
! 		}
! 	}
  	pstrcpy(debugf, fname);

More information about the samba-technical mailing list