browse.dat file

Jeremy Allison jra at samba.org
Thu Apr 30 10:29:36 MDT 2015


On Thu, Apr 30, 2015 at 03:50:43PM +0200, Volker Lendecke wrote:
> On Wed, Apr 29, 2015 at 09:19:34PM -0400, rac8006 at aol.com wrote:
> > After doing some investigation.  I've found that about every twelve minutes the process
> > process_local_master_announce procedure.  This procedure also calls update_server_ttl
> > Both of these procedures sets subrec->work_changed to true.  The update_server_ttl 
> > updades the ttl value.  but this value is not stored in the browse.dat file.  Yet it sets the 
> > work_changed to true.   This causes the browse.dat file to be written.  The process local_master _announce
> > procedure either does a create_server or remove_server or updates  the record.  It should
> > write the browse.dat file id it creates or removes data.  But most of the time it is updating
> > the record with the same data that is already in the file.  Why does it have to open a new
> > file.  Write the data.  Close the file. unlink the file.  chmod on the file.  then rename the
> > file to browse.dat.  Every twelve minutes.
> > 
> > The WD MY Cloud NAS  after 10 minutes of no disk writes.  puts the disk in standby mode.
> > Then two minutes of so later it wakes the disk to rewrite the browse.dat file.
> > Why can't the file only be written when it changes.
> 
> Does the attached patch help? I haven't tested it, but from
> your description this might do it.

Oh that's really good ! I think this will fix a
persistent problem that has been bugging OEMs
for *years*.

Wish I'd spotted it :-).

> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de

> From afb43aec1b82fabff8d2e5806b3253ee1d44afc4 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Thu, 30 Apr 2015 13:49:28 +0000
> Subject: [PATCH] Do not write browse.dat when nothing changed
> 
> ---
>  source3/nmbd/nmbd_serverlistdb.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
> index 56f400f..b8df650 100644
> --- a/source3/nmbd/nmbd_serverlistdb.c
> +++ b/source3/nmbd/nmbd_serverlistdb.c
> @@ -144,6 +144,8 @@ workgroup %s.\n", name,servertype,comment, work->work_group));
>  
>  void update_server_ttl(struct server_record *servrec, int ttl)
>  {
> +	time_t old_death_time = servrec->death_time;
> +
>  	if(ttl > lp_max_ttl())
>  		ttl = lp_max_ttl();
>  
> @@ -152,7 +154,9 @@ void update_server_ttl(struct server_record *servrec, int ttl)
>  	else
>  		servrec->death_time = (ttl != PERMANENT_TTL) ? time(NULL)+(ttl*3) : PERMANENT_TTL;
>  
> -	servrec->subnet->work_changed = True;
> +	if (servrec->death_time != old_death_time) {
> +		servrec->subnet->work_changed = True;
> +	}
>  }
>  
>  /*******************************************************************
> -- 
> 1.7.9.5
> 



More information about the samba-technical mailing list