removing stale replication targets

Matthieu Patou mat at
Tue Jan 31 23:31:49 MST 2012

On 31/01/2012 21:21, Andrew Tridgell wrote:
> Hi Matthieu,
> I've just reverted your patch 5bfd6251. It was causing regular
> segmentation faults in the build farm. As I said in my revert message, I
> wasn't able to reproduce the segfault, but it is pretty clear that this
> patch was the cause, given the backtraces and the complexity of the list
> handling. What I think was happening was a DSA that had an in-progress
> operation was being freed by the changes in this patch.
I'm not sure that this could happen if it is then it's unwanted because 
with this patch we should purge only the connection not purged anymore.
In order to free a DSA object that we still use we check
         /* re-use an existing source if found */
         for (s2=*oldlist; s2; s2=s2->next) {
                 if (GUID_compare(&s2->repsFrom1->source_dsa_obj_guid,
&source->repsFrom1->source_dsa_obj_guid) == 0) {
                         *s2->repsFrom1 = *source->repsFrom1;
                         talloc_steal(s2, s2->repsFrom1->other_info);
                         source = s2;
                         DLIST_REMOVE(*oldlist, s2);

In a "normal" mode all elements from the oldlist will be removed and 
transfered to the current list.

> I'm also curious why the change was needed. The
> dreplsrv_refresh_partitions() code should already be coping with changes
> made by the KCC, including removals.
The KCC takes care of changing the repsTo and the repsFrom that for 
sure, but  dreplsrv_refresh_partition() for the moment will only cope if 
you add entries.
Before this patch there wasn't any code that would actually remove a 
source if it isn't anymore in repsFrom.
If you restart samba then it will be ok but if not (and in production 
you don't restart it every 2 minutes) you'll see errors messages saying 
that you can't replicate with a DSA. This DSA is the one that has been 

A way to reproduce it is to join a Windows DC to a Samba Domain then 
remove it and then see error message appearing in the logs.
> Can you explain what situation this
> was trying to cope with? If the patch is needed then we'll need to work
> out how to make it work without the segfaults :-)

Matthieu Patou
Samba Team

More information about the samba-technical mailing list