[PATCHES] ctdb-eventscripts: Deleting IPs should use the promote_secondaries option

Martin Schwenke martin at meltin.net
Mon Feb 3 20:02:28 MST 2014

If a primary IP address is being deleted from an interface, the
secondaries are remembered and added back after the primary is
deleted.  This is done under a lock shared by the add/del script code.
It is necessary because, by default, Linux deletes secondaries when
the corresponding primary is deleted.

There is a race here between ctdbd and the scripts, since ctdbd
doesn't know about the lock.  If ctdbd receives a release IP control
and the IP address is not on an interface then it is regarded as a
"Redundant release of IP" so no "releaseip" event is generated.  This
can occur if the IP address in question is a secondary that has been
temporarily dropped.  It is more likely if the number of secondaries
is large.

Since Linux 2.6.12 (i.e. 2005) Linux has supported a
promote_secondaries option on interfaces.  This option is currently
undocumented but that will change in Linux 3.14.  With
promote_secondaries enabled the kernel will not drop secondaries but
will promote a corresponding secondary instead.  The kernel does all
necessary locking.

Use promote_secondaries to simplify the code, avoid re-adding
secondaries, avoid re-adding routes and provide improved performance.

This could be done conditionally, with a fallback to legacy
secondary-re-adding code, but no supported Linux distribution is
running a pre-2.6.12 kernel so this is unnecessary.

Signed-off-by: Martin Schwenke <martin at meltin.net>

There are 2 patches here but the 2nd just updates test code...

Please review and push if OK.

These patches are in my ctdb branch:


peace & happiness,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ctdb-eventscripts-Deleting-IPs-should-use-the-promot.patch
Type: text/x-patch
Size: 6054 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140204/4b3df4c2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ctdb-tests-eventscripts-Testing-support-for-promote_.patch
Type: text/x-patch
Size: 1921 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140204/4b3df4c2/attachment-0001.bin>

More information about the samba-technical mailing list