[Samba] Avoiding constant HDD access

Jeremy Allison jra at samba.org
Wed Nov 7 23:57:04 UTC 2018


On Thu, Nov 08, 2018 at 02:34:50AM +0300, Albert Berger via samba wrote:
> On Thu, Nov 08, 2018 at 06:12:40AM +1300, Andrew Bartlett wrote:
> > On Wed, 2018-11-07 at 15:19 +0300, Albert Berger via samba wrote:
> > > 
> > > I tried in sequence to start Samba in following conditions:
> > > 
> > > 1. With all clients disconnected from Samba server;
> > > 2. As above + all shares disabled;
> > > 3. As above + minimal smb.conf
> > > 4. With totally empty smb.conf.
> > > 
> > > In all cases those every-60-seconds writes persist.
> > > What else can be done in this situation? Can it be
> > > that some Debian/Raspbian patch causes this behaviour? 
> > > Should I try to compile Samba from upstream?
> > 
> > You haven't said what version you are running.  
> > 
> > But in general, there are essentially no specific Debian patches, we
> > work hard to keep those packages as upstream as possible, so unless
> > Raspbian has done something really odd (unlikely) there isn't any point
> > going upstream.
> > 
> > Andrew Bartlett
> > -- 
> > Andrew Bartlett                       http://samba.org/~abartlet/
> > Authentication Developer, Samba Team  http://samba.org
> > Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba
> > 
> 
> Well, I mentioned that the output of "smbd --version" is "4.2.14-Debian". Is
> this the package version? In Samba's source code there are mentions of 
> "housekeeping" activity: in the file process.c one can search for 
> SMBD_HOUSEKEEPING_INTERVAL and 'housekeeping_fn' which among other things
> performs some operations with log files. Can this be the explanation?

SMBD_HOUSEKEEPING_INTERVAL is 60 seconds, and run on a tevent
timer event, and it implements:

*
 * Do the recurring log file and smb.conf reload checks.
 */

static bool housekeeping_fn(const struct timeval *now, void *private_data)
{
        struct smbd_server_connection *sconn = talloc_get_type_abort(
                private_data, struct smbd_server_connection);

        DEBUG(5, ("housekeeping\n"));

        change_to_root_user();

        /* update printer queue caches if necessary */
        update_monitored_printq_cache(sconn->msg_ctx);

        /* check if we need to reload services */
        check_reload(sconn, time_mono(NULL));

        /*
         * Force a log file check.
         */
        force_check_log_size();
        check_log_size();
        return true;
}

so yes it's goint to look at smb.conf and check_log_size()
will do an fstat() on the open log file descriptor, so this
may explain it.



More information about the samba mailing list